|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +env: |
| 10 | + TAGS: "-tags=ci" |
| 11 | + COVERAGE: "-coverpkg=github.com/go-python/gopy/..." |
| 12 | + # Init() in main_test will make sure all backends are available if |
| 13 | + # GOPY_TRAVIS_CI is set |
| 14 | + GOPY_TRAVIS_CI: 1 |
| 15 | + GOTRACEBACK: crash |
| 16 | + PYPYVERSION: "v7.1.1" |
| 17 | + GO111MODULE: auto |
| 18 | + |
| 19 | +jobs: |
| 20 | + |
| 21 | + build: |
| 22 | + name: Build |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + go-version: [1.16.x, 1.15.x] |
| 26 | + platform: [ubuntu-latest] |
| 27 | + #platform: [ubuntu-latest, macos-latest, windows-latest] |
| 28 | + runs-on: ${{ matrix.platform }} |
| 29 | + steps: |
| 30 | + - name: Install Go |
| 31 | + uses: actions/setup-go@v2 |
| 32 | + with: |
| 33 | + go-version: ${{ matrix.go-version }} |
| 34 | + |
| 35 | + - name: Cache-Go |
| 36 | + uses: actions/cache@v1 |
| 37 | + with: |
| 38 | + path: | |
| 39 | + ~/go/pkg/mod # Module download cache |
| 40 | + ~/.cache/go-build # Build cache (Linux) |
| 41 | + ~/Library/Caches/go-build # Build cache (Mac) |
| 42 | + '%LocalAppData%\go-build' # Build cache (Windows) |
| 43 | +
|
| 44 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 45 | + restore-keys: | |
| 46 | + ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 47 | + |
| 48 | + - name: Checkout code |
| 49 | + uses: actions/checkout@v2 |
| 50 | + |
| 51 | + - name: Install Linux packages |
| 52 | + if: matrix.platform == 'ubuntu-latest' |
| 53 | + run: | |
| 54 | + sudo apt-get update |
| 55 | + sudo apt-get install curl libffi-dev python-cffi python3-cffi python3-pip |
| 56 | + # pypy3 isn't packaged in ubuntu yet. |
| 57 | + TEMPDIR=$(mktemp -d) |
| 58 | + curl -L https://downloads.python.org/pypy/pypy2.7-${PYPYVERSION}-linux64.tar.bz2 --output $TEMPDIR/pypy2.tar.bz2 |
| 59 | + curl -L https://downloads.python.org/pypy/pypy3.6-${PYPYVERSION}-linux64.tar.bz2 --output $TEMPDIR/pypy3.tar.bz2 |
| 60 | + tar xf $TEMPDIR/pypy2.tar.bz2 -C $TEMPDIR |
| 61 | + tar xf $TEMPDIR/pypy3.tar.bz2 -C $TEMPDIR |
| 62 | + sudo ln -s $TEMPDIR/pypy2.7-$PYPYVERSION-linux64/bin/pypy /usr/local/bin/pypy |
| 63 | + sudo ln -s $TEMPDIR/pypy3.6-$PYPYVERSION-linux64/bin/pypy3 /usr/local/bin/pypy3 |
| 64 | + # install pip (for pypy, python2) |
| 65 | + curl -L https://bootstrap.pypa.io/pip/2.7/get-pip.py --output ${TEMPDIR}/get-pip2.py |
| 66 | + python2 ${TEMPDIR}/get-pip2.py |
| 67 | + # curl -L https://bootstrap.pypa.io/get-pip.py --output ${TEMPDIR}/get-pip.py |
| 68 | + # pypy ${TEMPDIR}/get-pip.py |
| 69 | + # pypy3 ${TEMPDIR}/get-pip.py |
| 70 | +
|
| 71 | + # install pybindgen |
| 72 | + python2 -m pip install --user -U pybindgen |
| 73 | + python3 -m pip install --user -U pybindgen |
| 74 | + # pypy -m pip install --user -U pybindgen |
| 75 | + # pypy3 -m pip install --user -U pybindgen |
| 76 | +
|
| 77 | + # install goimports |
| 78 | + go get golang.org/x/tools/cmd/goimports |
| 79 | +
|
| 80 | + |
| 81 | + - name: Build-Linux |
| 82 | + if: matrix.platform == 'ubuntu-latest' |
| 83 | + run: | |
| 84 | + make |
| 85 | + - name: Test Linux |
| 86 | + if: matrix.platform == 'ubuntu-latest' |
| 87 | + run: | |
| 88 | + make test |
| 89 | + - name: Upload-Coverage |
| 90 | + if: matrix.platform == 'ubuntu-latest' |
| 91 | + uses: codecov/codecov-action@v1 |
0 commit comments