|
| 1 | +--- |
| 2 | +name: macOS |
| 3 | + |
| 4 | +on: |
| 5 | + push: {} |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + name: py-${{ matrix.py.ver }} libgit2-${{ matrix.libgit2}} |
| 10 | + runs-on: macos-latest |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + libgit2: ['maint/v0.99'] |
| 15 | + py: |
| 16 | + - ver: '3.6' |
| 17 | + release: '3.6.8' # last Python.org binary release |
| 18 | + - ver: '3.7' |
| 19 | + release: '3.7.7' |
| 20 | + - ver: '3.8' |
| 21 | + release: '3.8.2' |
| 22 | + env: |
| 23 | + HOMEBREW_CACHE: ${{ github.workspace }}/.cache/brew |
| 24 | + CCACHE_DIR: ${{ github.workspace }}/.cache/ccache |
| 25 | + CCACHE_COMPRESS: 1 |
| 26 | + PIP_CACHE_DIR: ${{ github.workspace }}/.cache/pip |
| 27 | + steps: |
| 28 | + - name: checkout pygit2 |
| 29 | + uses: actions/checkout@v2 |
| 30 | + with: |
| 31 | + path: pygit2 |
| 32 | + |
| 33 | + - name: checkout libgit2 |
| 34 | + uses: actions/checkout@v2 |
| 35 | + with: |
| 36 | + repository: libgit2/libgit2 |
| 37 | + path: libgit2 |
| 38 | + ref: ${{ matrix.libgit2 }} |
| 39 | + |
| 40 | + - id: cache |
| 41 | + uses: actions/cache@v1.1.0 |
| 42 | + with: |
| 43 | + path: .cache |
| 44 | + key: cache-libgit2.${{ matrix.libgit2 }}-py.${{ matrix.py.release }} |
| 45 | + restore-keys: | |
| 46 | + cache- |
| 47 | +
|
| 48 | + - name: setup python |
| 49 | + run: | |
| 50 | + mkdir -p .cache/python/ .cache/pip/ |
| 51 | + PKG="python-${{ matrix.py.release }}-macosx10.9.pkg" |
| 52 | + URL="https://www.python.org/ftp/python/${{ matrix.py.release }}/$PKG" |
| 53 | + wget --no-verbose -P .cache/python -N "$URL" |
| 54 | + sudo installer -pkg ".cache/python/$PKG" -target / |
| 55 | + export PATH=/Library/Frameworks/Python.framework/Versions/${{ matrix.py.ver }}/bin:$PATH |
| 56 | + echo "::add-path::/Library/Frameworks/Python.framework/Versions/${{ matrix.py.ver }}/bin" |
| 57 | + which python3 |
| 58 | + python3 -VV |
| 59 | + test "$(python3 -V)" = "Python ${{ matrix.py.release }}" |
| 60 | +
|
| 61 | + - name: setup |
| 62 | + run: | |
| 63 | + mkdir -p .cache/brew/ .cache/ccache/ |
| 64 | + brew install ccache pkg-config |
| 65 | + python3 -m venv venv/ |
| 66 | + echo "::add-path::${{ github.workspace }}/venv/bin:/usr/local/opt/ccache/libexec" |
| 67 | + venv/bin/pip3 install delocate pytest |
| 68 | +
|
| 69 | + - name: build libgit2 |
| 70 | + id: libgit2 |
| 71 | + working-directory: libgit2 |
| 72 | + env: |
| 73 | + PKG_CONFIG_PATH: /dev/null |
| 74 | + run: | |
| 75 | + mkdir env/ |
| 76 | + cmake . \ |
| 77 | + -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/libgit2/env \ |
| 78 | + -DBUILD_EXAMPLES=NO \ |
| 79 | + -DBUILD_CLAR=NO \ |
| 80 | + -DUSE_SSH=NO |
| 81 | + cmake --build . --target install |
| 82 | + VERSION=$(PKG_CONFIG_PATH=$(pwd) pkg-config --modversion libgit2) |
| 83 | + echo "::set-output name=version::$VERSION" |
| 84 | +
|
| 85 | + - name: build pygit2 |
| 86 | + id: pygit2 |
| 87 | + working-directory: pygit2 |
| 88 | + env: |
| 89 | + LIBGIT2: "${{ github.workspace }}/libgit2/env" |
| 90 | + LDFLAGS: "-Wl,-rpath,'${{ github.workspace }}/libgit2/env/lib'" |
| 91 | + run: | |
| 92 | + python3 setup.py bdist_wheel |
| 93 | + delocate-listdeps dist/pygit2-*macosx*.whl |
| 94 | + delocate-wheel -v -w dist/fixed-wheels/ dist/pygit2-*macosx*.whl |
| 95 | + WHEEL=$(basename dist/fixed-wheels/*.whl) |
| 96 | + echo "::set-output name=wheel::$WHEEL" |
| 97 | + delocate-listdeps dist/fixed-wheels/$WHEEL |
| 98 | +
|
| 99 | + - name: pygit2 tests |
| 100 | + working-directory: pygit2 |
| 101 | + run: | |
| 102 | + mv pygit2 pygit2~ |
| 103 | + mv ../libgit2/env ../libgit2/env~ |
| 104 | + pip3 install dist/fixed-wheels/pygit2-*.whl |
| 105 | + mkdir -p testresults/ |
| 106 | + pytest -v test/ --junitxml=testresults/testresults.xml |
| 107 | +
|
| 108 | + - name: save test results |
| 109 | + uses: actions/upload-artifact@v1 |
| 110 | + if: always() |
| 111 | + with: |
| 112 | + name: "test-results-py_${{ matrix.py.ver }}-libgit2_${{ steps.libgit2.outputs.version }}" |
| 113 | + path: pygit2/testresults/ |
| 114 | + |
| 115 | + - name: save wheel |
| 116 | + uses: actions/upload-artifact@v1 |
| 117 | + with: |
| 118 | + name: "macOS-wheel-py_${{ matrix.py.ver }}-libgit2_${{ steps.libgit2.outputs.version }}" |
| 119 | + path: pygit2/dist/fixed-wheels/ |
0 commit comments