|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + schedule: |
| 9 | + - cron: '0 2 * * 1-5' |
| 10 | + |
| 11 | +env: |
| 12 | + GOPROXY: "https://proxy.golang.org" |
| 13 | + TAGS: "-tags=ci" |
| 14 | + COVERAGE: "-coverpkg=github.com/go-python/gpython/..." |
| 15 | + |
| 16 | +jobs: |
| 17 | + |
| 18 | + build: |
| 19 | + name: Build |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + go-version: [1.17.x, 1.16.x] |
| 23 | + platform: [ubuntu-latest] |
| 24 | + runs-on: ${{ matrix.platform }} |
| 25 | + steps: |
| 26 | + - name: Install Go |
| 27 | + uses: actions/setup-go@v2 |
| 28 | + with: |
| 29 | + go-version: ${{ matrix.go-version }} |
| 30 | + |
| 31 | + - name: Setup Git for Windows |
| 32 | + run: | |
| 33 | + git config --global core.autocrlf false |
| 34 | + git config --global core.eol lf |
| 35 | +
|
| 36 | + - name: Checkout code |
| 37 | + uses: actions/checkout@v2 |
| 38 | + |
| 39 | + - name: Cache-Go |
| 40 | + uses: actions/cache@v1 |
| 41 | + with: |
| 42 | + # In order: |
| 43 | + # * Module download cache |
| 44 | + # * Build cache (Linux) |
| 45 | + # * Build cache (Mac) |
| 46 | + # * Build cache (Windows) |
| 47 | + path: | |
| 48 | + ~/go/pkg/mod |
| 49 | + ~/.cache/go-build |
| 50 | + ~/Library/Caches/go-build |
| 51 | + '%LocalAppData%\go-build' |
| 52 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 53 | + restore-keys: | |
| 54 | + ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 55 | +
|
| 56 | + - name: Install Linux packages |
| 57 | + if: matrix.platform == 'ubuntu-latest' |
| 58 | + run: | |
| 59 | + sudo apt-get update |
| 60 | + sudo apt-get install -qq pkg-config python3 |
| 61 | + |
| 62 | + - name: Build-Linux-32b |
| 63 | + if: matrix.platform == 'ubuntu-latest' |
| 64 | + run: | |
| 65 | + GOARCH=386 go install -v $TAGS ./... |
| 66 | + - name: Build-Linux-64b |
| 67 | + if: matrix.platform == 'ubuntu-latest' |
| 68 | + run: | |
| 69 | + GOARCH=amd64 go install -v $TAGS ./... |
| 70 | + - name: Build-Windows |
| 71 | + if: matrix.platform == 'windows-latest' |
| 72 | + run: | |
| 73 | + go install -v $TAGS ./... |
| 74 | + - name: Build-Darwin |
| 75 | + if: matrix.platform == 'macos-latest' |
| 76 | + run: | |
| 77 | + go install -v $TAGS ./... |
| 78 | + - name: Test Linux |
| 79 | + if: matrix.platform == 'ubuntu-latest' |
| 80 | + run: | |
| 81 | + GOARCH=386 go test $TAGS ./... |
| 82 | + GOARCH=amd64 go run ./ci/run-tests.go $TAGS -race $COVERAGE |
| 83 | + python3 py3test.py |
| 84 | + - name: Test Windows |
| 85 | + if: matrix.platform == 'windows-latest' |
| 86 | + run: | |
| 87 | + go run ./ci/run-tests.go $TAGS |
| 88 | + - name: Test Darwin |
| 89 | + if: matrix.platform == 'macos-latest' |
| 90 | + run: | |
| 91 | + go run ./ci/run-tests.go $TAGS |
| 92 | + - name: Upload-Coverage |
| 93 | + if: matrix.platform == 'ubuntu-latest' |
| 94 | + uses: codecov/codecov-action@v1 |
0 commit comments