# name: Python package # on: # create: # tags: # - v* # push: # branches: # - main # pull_request: # branches: # - main # jobs: # test: # name: "Test ${{ matrix.python-version }} on ${{ matrix.os }}" # runs-on: ${{ matrix.os }} # strategy: # max-parallel: 4 # matrix: # python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy3.9'] # os: [ubuntu-latest, windows-latest] # steps: # - uses: "actions/checkout@v3" # with: # submodules: 'true' # - name: Set up Python ${{ matrix.python-version }} # uses: actions/setup-python@v4 # with: # python-version: ${{ matrix.python-version }} # - name: Install dependencies # run: | # python -m pip install --upgrade pip # pip install -e . # - name: Test with pytest # run: | # pip install pytest # pytest jellyfish/test.py # build: # name: "Build ${{ matrix.python-version }} on ${{ matrix.os }}" # runs-on: ${{ matrix.os }} # strategy: # max-parallel: 4 # matrix: # python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] # os: [ubuntu-latest, windows-latest, macos-latest] # include: # - os: ubuntu-latest # python-version: 'pypy3.9' # steps: # - uses: "actions/checkout@v3" # with: # submodules: 'true' # - name: Set up Python ${{ matrix.python-version }} # uses: actions/setup-python@v4 # with: # python-version: ${{ matrix.python-version }} # - name: Install dependencies # run: python -m pip install --upgrade pip build # - name: Build package # run: python -m build # - uses: actions/upload-artifact@v3 # if: always() # with: # name: artifacts # path: dist/* # test-aarch64: # name: "Test ${{ matrix.pyver }} aarch64" # strategy: # matrix: # pyver: [cp37-cp37m, cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311] # arch: [aarch64] # fail-fast: false # runs-on: ubuntu-latest # env: # py: /opt/python/${{ matrix.pyver }}/bin/python # img: quay.io/pypa/manylinux2014_${{ matrix.arch }} # steps: # - uses: "actions/checkout@v3" # with: # submodules: 'true' # - name: Set up QEMU # id: qemu # uses: docker/setup-qemu-action@v2 # - name: Install tools # run: | # docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ # ${{ env.img }} ${{ env.py }} -m pip install -U pip build # - name: Install dependencies # run: | # docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ # ${{ env.img }} \ # bash -exc '${{ env.py }} -m pip install virtualenv && ${{ env.py }} -m venv .env && \ # source .env/bin/activate && \ # python -m pip install --upgrade pip && \ # pip install -e . && \ # deactivate' # - name: Test with pytest # run: | # docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ # ${{ env.img }} \ # bash -exc '\ # source .env/bin/activate && \ # pip install pytest && \ # pytest jellyfish/test.py && \ # deactivate' # build-aarch64: # name: "Build on ${{ matrix.pyver }} aarch64" # strategy: # matrix: # pyver: [cp37-cp37m, cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311] # arch: [aarch64] # fail-fast: false # runs-on: ubuntu-latest # env: # py: /opt/python/${{ matrix.pyver }}/bin/python # img: quay.io/pypa/manylinux2014_${{ matrix.arch }} # steps: # - uses: "actions/checkout@v3" # with: # submodules: 'true' # - name: Set up QEMU # id: qemu # uses: docker/setup-qemu-action@v2 # - name: Install tools # run: | # docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ # ${{ env.img }} ${{ env.py }} -m pip install -U pip build pytest # - name: Make wheel # run: | # docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ # ${{ env.img }} ${{ env.py }} -m build # - name: Repair wheel wheel # run: | # docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ # ${{ env.img }} auditwheel repair dist/*.whl --wheel-dir wheelhouse/ # - name: Upload artifacts # uses: actions/upload-artifact@v3 # with: # name: artifacts # path: wheelhouse/* # publish: # name: Publish release # runs-on: ubuntu-latest # needs: # - build # - build-aarch64 # # Only publish tags # if: github.event_name == 'create' && github.event.ref_type == 'tag' # steps: # - uses: actions/download-artifact@v3 # with: # name: artifacts # path: dist # - name: clean up releases that shouldn't be uploaded # run: rm dist/*linux_x86_64* dist/*none* # - name: Push build artifacts to PyPI # uses: pypa/gh-action-pypi-publish@v1.6.4 # with: # skip_existing: true # user: __token__ # password: ${{ secrets.PYPI_API_TOKEN }}