Skip to content

Commit

Permalink
CI: refactor pytest tasks
Browse files Browse the repository at this point in the history
Incidentally add the missing `artifacts` pass on Linux
  • Loading branch information
nbraud committed Aug 10, 2024
1 parent 456a340 commit f098723
Showing 1 changed file with 54 additions and 86 deletions.
140 changes: 54 additions & 86 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,109 +47,77 @@ Zipapp_bootstrap_task:
- python3 /tmp/bork-pass2.pyz build
- '[ -e ./dist/bork-*.pyz ]'

pytest_task:
matrix:
- container: *linuxes
env:
PY: python3
install_script:
- apt-get update
- apt-get install -y git

Linux_task:
alias: Linux tests
container: *linuxes
install_script:
- apt-get update
- apt-get install -y git
- pip install -U --upgrade-strategy eager pip 'setuptools>61'
- pip install . .[test]
script:
- python3 --version
- bork run test
- macos_instance:
cpu: 1
image: ghcr.io/cirruslabs/macos-runner:sonoma
env:
PY: python3
PATH: ${HOME}/.pyenv/shims:${PATH}
brew_update_script:
- brew update
brew_install_script:
# Per the pyenv homebrew recommendations.
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
- brew install pyenv git
pyenv_install_script:
- pyenv install 3:latest
- pyenv global 3
- pyenv rehash

macOS_task:
alias: macOS tests
macos_instance:
cpu: 1
image: ghcr.io/cirruslabs/macos-runner:sonoma
env:
PATH: ${HOME}/.pyenv/shims:${PATH}
PYTHON: 3:latest
brew_update_script:
- brew update
brew_install_script:
# Per the pyenv homebrew recommendations.
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
- brew install pyenv git
pyenv_install_script:
- pyenv install ${PYTHON}
- pyenv global 3
- pyenv rehash
pip_install_script:
- pip install -U --upgrade-strategy eager pip 'setuptools>61'
- pip install .[test]
script:
- python3 --version
- bork run test
always:
upload_results_artifacts:
path: ./bork-junit.xml
format: junit
type: text/xml
- freebsd_instance:
image_family: freebsd-14-0
env:
matrix:
- PYTHON: 3.10
- PYTHON: 3.11
# TODO: PYTHON: 3.12
install_script:
- PY=`echo python$PYTHON | tr -d '.'`
- pkg install -y $PY git
- $PY -m ensurepip

FreeBSD_task:
alias: FreeBSD tests
freebsd_instance:
image_family: freebsd-14-0
env:
matrix:
- PYTHON: 3.10
- PYTHON: 3.11
# TODO: PYTHON: 3.12
install_script:
- PY=`echo $PYTHON | tr -d '.'`
- pkg install -y python${PY} git
- python${PYTHON} -m ensurepip
pip_install_script:
- python${PYTHON} -m pip install -U --upgrade-strategy eager pip 'setuptools>61'
- python${PYTHON} -m pip install .[test]
- windows_container:
image: cirrusci/windowsservercore:2019
env:
PY: C:\Python\python.exe
matrix:
- PYTHON: 3.10.11
- PYTHON: 3.11.9
- PYTHON: 3.12.4
python_install_script:
# https://docs.python.org/3.6/using/windows.html#installing-without-ui
- ps: Invoke-WebRequest -Uri https://www.python.org/ftp/python/${env:PYTHON}/python-${env:PYTHON}-amd64.exe -OutFile C:\python-installer.exe
- C:\python-installer.exe /quiet TargetDir=C:\Python SimpleInstall=1

build_script:
- $PY -m pip install -U --upgrade-strategy eager pip 'setuptools>61'
- $PY -m pip install .[test]
script:
- python${PYTHON} --version
- $PY --version
- bork run test
always:
upload_results_artifacts:
path: ./bork-junit.xml
format: junit
type: text/xml

Windows_task:
windows_container:
image: cirrusci/windowsservercore:2019
env:
matrix:
- PYTHON: 3.10.11
- PYTHON: 3.11.9
- PYTHON: 3.12.4
python_install_script:
# https://docs.python.org/3.6/using/windows.html#installing-without-ui
- ps: Invoke-WebRequest -Uri https://www.python.org/ftp/python/${env:PYTHON}/python-${env:PYTHON}-amd64.exe -OutFile C:\python-installer.exe
- C:\python-installer.exe /quiet TargetDir=C:\Python SimpleInstall=1
install_script:
- C:\Python\python.exe -m pip install -U --upgrade-strategy eager pip "setuptools>61"
- C:\Python\python.exe -m pip install .[test]
version_info_script:
- C:\Python\python.exe --version
test_script:
- C:\Python\python.exe -m pytest --verbose
always:
upload_results_artifacts:
path: ./bork-junit.xml
format: junit
type: text/xml

success_task:
name: CI success
container: {image: "busybox"}
depends_on:
- FreeBSD tests
- Linux tests
- macOS tests
- Zipapp bootstraps
- Lint
- Windows
- pytest
- Zipapp bootstraps

# If bork/version.py is modified on the main branch, make a release.
Release_task:
Expand Down

0 comments on commit f098723

Please sign in to comment.