Skip to content

[FIX] build.sh: Use the same environment variables for sudo commands … #269

[FIX] build.sh: Use the same environment variables for sudo commands …

[FIX] build.sh: Use the same environment variables for sudo commands … #269

name: build
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest, macos-13, macos-latest]
tox_env: ["py,codecov"]
include:
- python: '3.12'
os: ubuntu-latest
tox_env: 'check'
- python: '3.12'
os: ubuntu-latest
tox_env: 'docs'
- python: '3.12'
os: ubuntu-latest
tox_env: 'build'
exclude:
# macos-14 AKA macos-latest has switched to being an ARM runner, only supporting newer versions of Python
# https://github.com/actions/setup-python/issues/825#issuecomment-2096792396
- python: '3.7'
os: macos-latest
- python: '3.8'
os: macos-latest
- python: '3.9'
os: macos-latest
- python: '3.10'
os: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: x64
cache: 'pip'
- name: Cache pre-commit packages
id: cache-pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python }}-pre-commit
- name: install dependencies
run: |
pip install --upgrade pip
python -mpip install --progress-bar=off -r requirements-dev.txt
virtualenv --version
pip --version
tox --version
pip list --format=freeze
- name: test
run: |
mkdir -p ~/.ssh
tox -e ${{ matrix.tox_env }} -v
# TODO: Publish package only for signed tags
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && contains(matrix.tox_env, 'build')
run: |
ls -lah dist/*
python -m twine upload --verbose -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} --repository-url https://upload.pypi.org/legacy/ dist/*