github.com/liangmanlin/routine@v1.1.0/.github/workflows/build.yml (about) 1 # Workflow file of GitHub Actions 2 3 name: build 4 5 on: 6 push: 7 branches: 8 - main 9 - release/** 10 - feature/** 11 pull_request: 12 branches: 13 - main 14 - release/** 15 16 jobs: 17 build: 18 runs-on: ${{ matrix.os }} 19 strategy: 20 fail-fast: false 21 matrix: 22 os: [ macos-latest, ubuntu-latest, windows-latest ] 23 arch: [ 386, amd64, armv6, armv7, arm64 ] 24 go: [ 1.13, 1.14, 1.15, 1.16, 1.17, 1.18 ] 25 exclude: 26 - os: macos-latest 27 arch: 386 28 - os: macos-latest 29 arch: armv6 30 - os: macos-latest 31 arch: armv7 32 - os: macos-latest 33 arch: arm64 34 - os: windows-latest 35 arch: armv6 36 - os: windows-latest 37 arch: armv7 38 - os: windows-latest 39 arch: arm64 40 include: 41 - arch: armv6 42 archx: armv6 43 - arch: armv7 44 archx: armv7 45 - arch: arm64 46 archx: aarch64 47 48 steps: 49 - name: Checkout scm 50 uses: actions/checkout@v3 51 52 - name: Set up Go 53 uses: actions/setup-go@v3 54 with: 55 go-version: ${{ matrix.go }} 56 57 - name: 'Test with 386' 58 if: ${{ matrix.arch == '386' }} 59 env: 60 GOARCH: 386 61 run: go test -v -coverprofile='coverage.txt' -covermode=atomic ./... 62 63 - name: 'Test with amd64' 64 if: ${{ matrix.arch == 'amd64' }} 65 env: 66 GOARCH: amd64 67 run: go test -v -race -coverprofile='coverage.txt' -covermode=atomic ./... 68 69 - name: 'Build with armv6' 70 if: ${{ matrix.arch == 'armv6' }} 71 env: 72 GOARCH: arm 73 GOARM: 6 74 run: go test -v -c 75 76 - name: 'Build with armv7' 77 if: ${{ matrix.arch == 'armv7' }} 78 env: 79 GOARCH: arm 80 GOARM: 7 81 run: go test -v -c 82 83 - name: 'Build with arm64' 84 if: ${{ matrix.arch == 'arm64' }} 85 env: 86 GOARCH: arm64 87 run: go test -v -c 88 89 - name: 'Test with arm' 90 if: ${{ contains(matrix.arch, 'arm') }} 91 uses: uraimo/run-on-arch-action@v2 92 with: 93 arch: ${{ matrix.archx }} 94 distro: bullseye 95 dockerRunArgs: --mount type=bind,source="$(pwd)",target=/checkout,readonly 96 run: | 97 find /checkout -name '*.test' -type f -executable -print0 | \ 98 xargs -t -0 -I '{}' sh -c '{} -test.v' 99 100 - name: Codecov 101 if: ${{ !contains(matrix.arch, 'arm') }} 102 uses: codecov/codecov-action@v3 103 with: 104 name: Codecov on ${{ matrix.os }}/${{ matrix.arch }} go${{ matrix.go }} 105 fail_ci_if_error: false