diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..1a56d7d --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,65 @@ +name: Go + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + cross-build-test: + strategy: + fail-fast: false + matrix: + goos: ['android', 'linux', 'solaris', 'illumos', 'dragonfly', 'freebsd', 'openbsd', 'plan9', 'windows', 'darwin', 'netbsd'] + go-version: ['1.17', '1.18', '1.19'] + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go-version }} + + - name: Install mage + run: | + git clone https://github.com/magefile/mage + cd mage + go run bootstrap.go install + cd ./.. + + - name: Checkout code into the Go module directory + uses: actions/checkout@v3 + + - name: Print Go version and environment + id: vars + run: | + printf "Using go at: $(which go)\n" + printf "Go version: $(go version)\n" + printf "\n\nGo environment:\n\n" + go env + printf "\n\nSystem environment:\n\n" + env + + - name: Build + run: | + GOOS=$GOOS mage -v build 2> /dev/null + if [ $? -ne 0 ]; then + echo "::warning ::$GOOS Build Failed" + exit 0 + fi + + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.17 + + - uses: actions/checkout@v3 + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.29