Skip to content

.github/workflows/default.yaml #158

.github/workflows/default.yaml

.github/workflows/default.yaml #158

Workflow file for this run

permissions:
contents: write
on:
push:
tags:
- "v*.*.*"
branches:
- main
pull_request:
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.20"
- uses: golangci/golangci-lint-action@v3
- run: go test -v ./...
build:
strategy:
matrix:
os: [linux, darwin, windows]
arch: [amd64, arm64, aarch64]
exclude:
- os: windows
arch: arm64
- os: windows
arch: aarch64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.20"
- run: |
ARCH=${{ matrix.arch }}
# For aarch64 we need to create a separate python wheel but still use arm64 for the go build
if [ $ARCH = "aarch64" ]; then
ARCH="arm64"
fi
CGO_ENABLED=0 GOOS=${{ matrix.os }} GOARCH=$ARCH \
go build -o "bin/diambra-${{ matrix.os }}-${{ matrix.arch }}" ./cmd/diambra
- uses: actions/upload-artifact@v3
with:
name: diambra-${{ matrix.os }}-${{ matrix.arch }}
path: bin/diambra-${{ matrix.os }}-${{ matrix.arch }}
- name: create pip wheel
id: mkwheel
run: |
rm -rf dist
mkdir dist
platform=$${{ matrix.os }}_${{ matrix.arch }}
if [[ "$GITHUB_REF" == "refs/tags/v"* ]]; then
version="${GITHUB_REF/refs\/tags\/v/}"
else
version="dev"
fi
./mkwheel/mkwheel diambra "$version" dist/ README.md "$platform" ./bin/diambra-${{ matrix.os }}-${{ matrix.arch }}
echo "wheel=diambra-$version-py3-none-$platform.whl" >> $GITHUB_OUTPUT
env:
linux_amd64: manylinux2014_x86_64
linux_arm64: manylinux2014_armv7l
linux_aarch64: manylinux2014_aarch64
windows_amd64: win_amd64
darwin_amd64: macosx_10_9_x86_64
darwin_arm64: macosx_11_0_arm64
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.mkwheel.outputs.wheel }}
path: dist/${{ steps.mkwheel.outputs.wheel }}
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
bin/diambra-${{ matrix.os }}-${{ matrix.arch }}
${{ steps.mkwheel.outputs.wheel }}
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TWINE_PASSWORD }}
if: startsWith(github.ref, 'refs/tags/')