From 22ee76066b0ebec95f7ca6dca9887ad274f4fa8c Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Mon, 23 Mar 2026 12:40:30 -0700 Subject: [PATCH] split into setup/run/upload --- .github/actions/run_tox/action.yml | 18 ++++++++++ .github/actions/setup_tox/action.yml | 38 ++++++++++++++++++++++ .github/actions/upload_coverage/action.yml | 27 +++++++++++++++ .github/workflows/standard_tests_jobs.yml | 4 ++- 4 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 .github/actions/run_tox/action.yml create mode 100644 .github/actions/setup_tox/action.yml create mode 100644 .github/actions/upload_coverage/action.yml diff --git a/.github/actions/run_tox/action.yml b/.github/actions/run_tox/action.yml new file mode 100644 index 000000000..1e365230f --- /dev/null +++ b/.github/actions/run_tox/action.yml @@ -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 diff --git a/.github/actions/setup_tox/action.yml b/.github/actions/setup_tox/action.yml new file mode 100644 index 000000000..d09cd0fe6 --- /dev/null +++ b/.github/actions/setup_tox/action.yml @@ -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 diff --git a/.github/actions/upload_coverage/action.yml b/.github/actions/upload_coverage/action.yml new file mode 100644 index 000000000..f051947b1 --- /dev/null +++ b/.github/actions/upload_coverage/action.yml @@ -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 diff --git a/.github/workflows/standard_tests_jobs.yml b/.github/workflows/standard_tests_jobs.yml index 2a4e4a23c..062d46621 100644 --- a/.github/workflows/standard_tests_jobs.yml +++ b/.github/workflows/standard_tests_jobs.yml @@ -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