split into setup/run/upload

This commit is contained in:
Erica Portnoy 2026-03-23 12:40:30 -07:00
parent ed1f31721b
commit 22ee76066b
4 changed files with 86 additions and 1 deletions

18
.github/actions/run_tox/action.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: run_tox
runs:
using: composite
steps:
- name: Run tox
env:
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
AWS_EC2_PEM: "github-test-farm.pem"
PIP_USE_PEP517: "${{ matrix.PIP_USE_PEP517 }}"
TOXENV: "${{ matrix.TOXENV }}"
run: |-
set -e
export TARGET_BRANCH="`echo "${BUILD_SOURCEBRANCH}" | sed -E 's!refs/(heads|tags)/!!g'`"
[ -z "${SYSTEM_PULLREQUEST_TARGETBRANCH}" ] || export TARGET_BRANCH="${SYSTEM_PULLREQUEST_TARGETBRANCH}"
env
python3 -m tox run
shell: bash

38
.github/actions/setup_tox/action.yml vendored Normal file
View file

@ -0,0 +1,38 @@
name: setup_tox
runs:
using: composite
steps:
- name: Install MacOS dependencies
if: startsWith(matrix.IMAGE_NAME, 'macOS')
run: |-
set -e
unset HOMEBREW_NO_INSTALL_FROM_API
brew untap homebrew/core homebrew/cask
brew update
brew install augeas
shell: bash
- name: Install Linux dependencies
if: startsWith(matrix.IMAGE_NAME, 'ubuntu')
run: |-
set -e
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libaugeas-dev \
nginx-light
sudo systemctl stop nginx
sudo sysctl net.ipv4.ip_unprivileged_port_start=0
shell: bash
- uses: actions/setup-python@v5.0.0
with:
python-version: "${{ matrix.PYTHON_VERSION }}"
- name: Install runtime dependencies
run: |-
set -e
python3 tools/pip_install.py tox
shell: bash
- name: Create test farm pem file
if: contains(matrix.TOXENV, 'test-farm')
env:
PEM_CONTENTS: "${{ secrets.AWS_TEST_FARM_PEM }}"
run: 'echo ${PEM_CONTENTS} >> github-test-farm.pem'
shell: bash

View file

@ -0,0 +1,27 @@
name: upload_coverage
runs:
using: composite
steps:
- name: Upload coverage data
if: env.uploadCoverage == true && (startsWith(matrix.TOXENV, 'cover') || startsWith(matrix.TOXENV, 'integration'))
run: |-
python3 tools/pip_install.py -I coverage
case "${{ runner.os }}" in
Darwin)
CODECOV_URL="https://uploader.codecov.io/latest/macos/codecov"
;;
Linux)
CODECOV_URL="https://uploader.codecov.io/latest/linux/codecov"
;;
Windows_NT)
CODECOV_URL="https://uploader.codecov.io/latest/windows/codecov.exe"
;;
*)
echo "Unexpected OS"
exit 0
esac
curl --retry 3 -o codecov "$CODECOV_URL"
chmod +x codecov
coverage xml
./codecov || echo "Uploading coverage data failed"
shell: bash

View file

@ -43,7 +43,9 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4.1.0
- uses: "./.github/actions/tox_steps"
- uses: "./.github/actions/setup_tox"
- uses: "./.github/actions/run_tox"
- uses: "./.github/actions/upload_coverage"
test_sphinx_builds:
permissions:
contents: read