diff --git a/.actrc b/.actrc index bb7ec3af..089eff4b 100644 --- a/.actrc +++ b/.actrc @@ -1,13 +1,11 @@ ---workflows .github/act-serial.yaml ---platform js-20.04=ghcr.io/catthehacker/ubuntu:js-20.04 ---platform ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04 +--workflows .github/workflows/main.yml +# Use this to run only specific variants of a matrix: +# -j test --matrix python-version:3.12 --matrix python-version:3.13 --platform ubuntu-22.04=ghcr.io/catthehacker/ubuntu:act-22.04 +--platform ubuntu-24.04=ghcr.io/catthehacker/ubuntu:act-24.04 --platform ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest # If using podman, use one of these, preferably in your ~/.actrc: -# For act-cli.rpm on Fedora 37: -# --container-daemon-socket /run/user/1000/podman/podman.sock -# For the latest act, use this in your ~/.actrc: # --container-daemon-socket unix:///run/user/1000/podman/podman.sock # More information on setting up act can be found at: # https://github.com/xenserver/python-libs/blob/master/CONTRIBUTING.md#running-github-actions-locally-using-act diff --git a/.github/act-serial.yaml b/.github/act-serial.yaml deleted file mode 100644 index e427ef5d..00000000 --- a/.github/act-serial.yaml +++ /dev/null @@ -1,66 +0,0 @@ -# actions can be run locally using act and docker, on Fedora 37 also with podman, using: -# https://github.com/nektos/act -# sudo dnf install -y act-cli podman-docker -# act --bind --container-daemon-socket $XDG_RUNTIME_DIR/podman/podman.sock -W .github/workflows/main.yml - -name: Unit tests - -concurrency: # On new workflow, cancel old workflows from the same PR, branch or tag: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -# Checks can be skipped by adding "skip-checks: true" to a commit message, -# or requested by adding "request-checks: true" if disabled by default for pushes: -# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks#skipping-and-requesting-checks-for-individual-commits -on: [push, pull_request] -env: - PYTHONWARNINGS: "ignore:DEPRECATION" - PIP_ROOT_USER_ACTION: "ignore" # For local testing using act-cli - PIP_NO_WARN_SCRIPT_LOCATION: "0" # For local testing using act-cli - PIP_DISABLE_PIP_VERSION_CHECK: "1" # Reduce noise in logs - -jobs: - test: - strategy: - # See: https://github.com/xenserver/python-libs/pull/26#discussion_r1179482169 - max-parallel: 1 - # Want to get the results of all the tests, don't terminate all on a fail: - fail-fast: true - matrix: - include: - # This tests with Python 2.7 and with Ubuntu-20.04's Python 3.8 for combined py2+3 coverage: - - python-version: '3.6' - os: ubuntu-20.04 - - python-version: '3.10' - os: ubuntu-22.04 - - python-version: '3.11' - os: ubuntu-22.04 - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # Needed by diff-cover to get the changed lines: origin/master..HEAD - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install Python 2.7 from Ubuntu 20.04 using apt-get install - if: ${{ matrix.os == 'ubuntu-20.04' }} - run: apt-get update && apt-get install -y python2-dev - - - name: Run of tox on ubuntu-latest - if: ${{ startsWith(matrix.python-version, '3.') && matrix.python-version != 3.6 }} - run: | - pip install 'virtualenv<20.22' 'tox==4.5.1' tox-gh-actions - tox --workdir .github/workflows/.tox --recreate - - # tox >= 4.0.0 is needed for using optional-dependencies from pyproject.toml, which is - # is not available for python <= 3.6, so use the python3.8 of Ubuntu-20.04 to install it: - - name: Tox on ${{ matrix.os }} (Using 3.8 to use extras from pyproject.toml) - if: ${{ matrix.python-version == 3.6 }} - run: | - set -xv;curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py - python3.8 get-pip.py - python3.8 -m pip install 'virtualenv<20.22' 'tox==4.5.1' - tox --workdir .github/workflows/.tox --recreate -e py36-lint-test diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 90403a09..476a0293 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,27 +40,26 @@ jobs: with: fetch-depth: 0 # Needed by diff-cover to get the changed lines: origin/master..HEAD - name: Set up Python ${{ matrix.python-version }} + # Python 3.11 is not supported in the nektos/act container, so we skip this step + if: ${{ !(matrix.python-version == '3.11' && github.actor == 'nektos/act') }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install Python 2.7 from Ubuntu 20.04 using apt-get install - if: ${{ matrix.os == 'ubuntu-20.04' }} - run: sudo apt-get update && sudo apt-get install -y python2-dev - - name: Install missing cpio in containers of nektos/act - if: ${{ github.actor == 'nektos/act'}} + if: ${{ (github.actor == 'nektos/act' && matrix.python-version != '3.11') }} run: apt-get update && apt-get install -y cpio - - name: Run of tox on ubuntu-latest - if: ${{ startsWith(matrix.python-version, '3.') && matrix.python-version != 3.6 }} + - name: Run of tox on Ubuntu + # Python 3.11 is not supported in the nektos/act container, so we skip this step + if: ${{ !(matrix.python-version == '3.11' && github.actor == 'nektos/act') }} run: | - pip install 'virtualenv<20.22' 'tox==4.5.1' tox-gh-actions + pip install tox tox-gh-actions tox --workdir .github/workflows/.tox --recreate - name: Select the coverage file for upload if: | - ( matrix.python-version == '3.6' || matrix.python-version == '3.11' ) && + matrix.python-version == '3.11' && ( !cancelled() && github.actor != 'nektos/act' ) id: coverage run: mv $( ls -t .github/workflows/.tox/*/log/.coverage | head -1 ) .coverage