Add code testing on MacOS (#563)

* feat: add code testing on macos

* change name of test job

Keep the test job named `test` to align with current branch protection checks

Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
hackercat 2021-03-29 16:55:51 +02:00 committed by GitHub
parent af5140f13e
commit f5a02581c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 74 additions and 59 deletions

View File

@ -6,81 +6,96 @@ jobs:
name: Lint name: Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: golangci/golangci-lint-action@v2 - uses: golangci/golangci-lint-action@v2
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
with: with:
version: v1.32.2 version: v1.32.2
test: test:
name: Test name: Test on Linux
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
- uses: actions/setup-go@v1 - uses: actions/setup-go@v1
with: with:
go-version: 1.14 go-version: 1.14
- run: go test -cover -coverprofile=coverage.txt -covermode=atomic ./... - run: go test -cover -coverprofile=coverage.txt -covermode=atomic ./...
env: env:
CGO_ENABLED: 0
- uses: codecov/codecov-action@v1
with:
files: coverage.txt
fail_ci_if_error: true # optional (default = false)
test-macos:
name: Test on MacOS
runs-on: macos-latest
continue-on-error: true # Don't let macos test fail whole workflow
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.14
- name: Install MacOS Docker
uses: docker-practice/actions-setup-docker@master
- run: go test -v -timeout 1h -cover ./...
env:
CGO_ENABLED: 0 CGO_ENABLED: 0
- uses: codecov/codecov-action@v1
with:
files: coverage.txt
fail_ci_if_error: true # optional (default = false)
snapshot: snapshot:
name: Snapshot name: Snapshot
if: ${{ github.event_name == 'pull_request' }} if: ${{ github.event_name == 'pull_request' }}
needs: needs:
- lint - lint
- test - test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: GoReleaser - name: GoReleaser
uses: goreleaser/goreleaser-action@v2 uses: goreleaser/goreleaser-action@v2
with: with:
version: latest version: latest
args: release --snapshot --rm-dist args: release --snapshot --rm-dist
- name: Capture Linux Binary - name: Capture Linux Binary
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: act-linux name: act-linux
path: dist/act_linux_amd64/act path: dist/act_linux_amd64/act
- name: Capture Windows Binary - name: Capture Windows Binary
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: act-windows name: act-windows
path: dist/act_windows_amd64/act.exe path: dist/act_windows_amd64/act.exe
- name: Capture MacOS Binary - name: Capture MacOS Binary
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: act-macos name: act-macos
path: dist/act_darwin_amd64/act path: dist/act_darwin_amd64/act
release: release:
name: Release name: Release
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
needs: needs:
- lint - lint
- test - test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: GoReleaser - name: GoReleaser
uses: goreleaser/goreleaser-action@v1 uses: goreleaser/goreleaser-action@v1
with: with:
version: latest version: latest
args: release --rm-dist args: release --rm-dist
env: env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
- name: Chocolatey - name: Chocolatey
uses: ./.github/actions/choco uses: ./.github/actions/choco
with: with:
version: ${{ github.ref }} version: ${{ github.ref }}
apiKey: ${{ secrets.CHOCO_APIKEY }} apiKey: ${{ secrets.CHOCO_APIKEY }}