Skip to content

tests+pypi

tests+pypi #187

Workflow file for this run

name: tests+pypi
defaults:
run:
shell: bash
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 13 * * 4'
release:
types: [published]
jobs:
debug_build_ok:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480
- run: DEBUG=1 VERBOSE=1 pip install --verbose -e .[tests]
- run: pytest -v -s -We -p no:unraisableexception tests
build:
needs: [debug_build_ok]
strategy:
matrix:
platform: [ubuntu-latest, macos-12, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
fail-fast: false
runs-on: ${{ matrix.platform }}
steps:
- if: startsWith(matrix.platform, 'macos-')
run: |
brew reinstall gcc
sudo xcode-select -s "/Applications/Xcode_13.4.1.app"
echo MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion` >> $GITHUB_ENV
- if: matrix.platform == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: >-
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-ninja
m4
- if: matrix.platform == 'windows-latest'
run: |
echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/mingw64/bin/ninja.exe" >> $GITHUB_ENV
echo CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV
echo CMAKE_GENERATOR="Ninja" >> $GITHUB_ENV
echo TEMP="D:/a/_temp/" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install --upgrade pip==22.1.2
- run: pip install build wheel
- run: |
unset CI
python -m build 2>&1 | tee build.log
exit `fgrep -i warning build.log | wc -l`
- if: matrix.platform == 'ubuntu-latest'
run: rm dist/*
- if: matrix.platform == 'ubuntu-latest'
run: python -c "import sys; vi=sys.version_info; abitag='m' if vi.minor<8 else ''; print(f'PV=cp{vi.major}{vi.minor}-cp{vi.major}{vi.minor}{abitag}')" >> $GITHUB_ENV
- if: matrix.platform == 'ubuntu-latest'
uses: RalfG/[email protected]
with:
build-requirements: 'setuptools_scm'
python-versions: ${{ env.PV }}
pre-build-command: 'git config --global --add safe.directory "*"'
- if: matrix.platform == 'ubuntu-latest'
run: rm dist/*-linux_*
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist
- env:
SYSTEM_VERSION_COMPAT: 0
run: |
pip debug --verbose
for i in dist/*.whl; do pip install $i[tests]; done;
pip show --verbose PyPartMC
### make sure PyPartMC is not picked up from a local folder
- run: |
cd tests
python -c "import PyPartMC"
pytest --durations=10 -v -s -We -p no:unraisableexception .
cd ..
- if: matrix.python-version != '3.7'
run: |
pip install -r gitmodules/devops_tests/requirements.txt
ex -sc 'g/^PyPartMC/d' -cx .binder/requirements.txt
pip install -r .binder/requirements.txt
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} pytest --durations=10 -v -s -We -p no:unraisableexception gitmodules/devops_tests
### uncomment to gain ssh access in case of failure
# - if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
dist_check:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/setup-python@v2
- run: pip install twine auditwheel
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- run: twine check --strict dist/*
- run: for i in dist/*-manylinux*.whl; do auditwheel show $i; done;
dist_upload:
runs-on: ubuntu-latest
needs: [dist_check]
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@unstable/v1
with:
repository_url: https://test.pypi.org/legacy/
- if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@unstable/v1