Back to dev version #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Acceptance tests (CPython + PyPy) | |
on: | |
push: | |
branches: | |
- main | |
- master | |
paths: | |
- '.github/workflows/**' | |
- 'src/**' | |
- 'atest/**' | |
- '!**/*.rst' | |
jobs: | |
test_using_builtin_python: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ 'ubuntu-latest', 'windows-latest' ] | |
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8' ] | |
include: | |
- os: ubuntu-latest | |
set_display: export DISPLAY=:99; Xvfb :99 -screen 0 1024x768x24 -ac -noreset & sleep 3 | |
- os: windows-latest | |
set_codepage: chcp 850 | |
exclude: | |
- os: windows-latest | |
python-version: 'pypy-3.8' | |
runs-on: ${{ matrix.os }} | |
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup python for starting the tests | |
uses: actions/[email protected] | |
with: | |
python-version: '3.10' | |
architecture: 'x64' | |
- name: Get test starter Python at Windows | |
run: echo "ATEST_PYTHON=$((get-command python.exe).Path)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
if: runner.os == 'Windows' | |
- name: Get test starter Python | |
run: echo "ATEST_PYTHON=$(which python)" >> $GITHUB_ENV | |
if: runner.os != 'Windows' | |
- name: Setup python ${{ matrix.python-version }} for running the tests | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: 'x64' | |
- name: Get test runner Python at Windows | |
run: echo "BASE_PYTHON=$((get-command python.exe).Path)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
if: runner.os == 'Windows' | |
- name: Get test runner Python | |
run: echo "BASE_PYTHON=$(which python)" >> $GITHUB_ENV | |
if: runner.os != 'Windows' | |
- name: Install Report handling tools to Windows | |
run: | | |
choco install curl -y --no-progress | |
choco install zip -y --no-progress | |
if: runner.os == 'Windows' | |
- name: Install Ubuntu PyPy dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y -q install libxslt-dev libxml2-dev | |
if: contains(matrix.python-version, 'pypy') && contains(matrix.os, 'ubuntu') | |
- name: Install screen and report handling tools, and other required libraries to Linux | |
run: | | |
sudo apt-get update | |
sudo apt-get -y -q install xvfb scrot zip curl libxml2-dev libxslt1-dev | |
if: contains(matrix.os, 'ubuntu') | |
- name: Run acceptance tests | |
run: | | |
python -m pip install -r atest/requirements.txt | |
${{ env.ATEST_PYTHON }} -m pip install -r atest/requirements-run.txt | |
${{ matrix.set_codepage }} | |
${{ matrix.set_display }} | |
${{ env.ATEST_PYTHON }} atest/run.py --interpreter ${{ env.BASE_PYTHON }} --exclude no-ci ${{ matrix.atest_args }} atest/robot | |
- name: Delete output.xml (on Win) | |
run: | | |
Get-ChildItem atest/results -Include output.xml -Recurse | Remove-Item | |
if: always() && runner.os == 'Windows' | |
- name: Delete output.xml (on Unix-like) | |
run: | | |
find atest/results -type f -name 'output.xml' -exec rm {} + | |
if: always() && runner.os != 'Windows' | |
- name: Archive acceptances test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: at-results-${{ matrix.python-version }}-${{ matrix.os }} | |
path: atest/results | |
if: always() && job.status == 'failure' | |
- name: Upload results on *nix | |
run: | | |
echo '<html><head><meta http-equiv = "refresh" content =" 0 ; url = /report.html"></head></html>' > atest/results/index.html | |
zip -r -j site.zip atest/results > no_output 2>&1 | |
curl -s -H "Content-Type: application/zip" -H "Authorization: Bearer ${{ secrets.NETLIFY_TOKEN }}" --data-binary "@site.zip" https://api.netlify.com/api/v1/sites > response.json | |
echo "REPORT_URL=$(cat response.json|python -c "import sys, json; print('https://' + json.load(sys.stdin)['subdomain'] + '.netlify.com')")" >> $GITHUB_ENV | |
echo "JOB_STATUS=$(python -c "print('${{ job.status }}'.lower())")" >> $GITHUB_ENV | |
if: always() && job.status == 'failure' && runner.os != 'Windows' | |
- name: Upload results on Windows | |
run: | | |
echo '<html><head><meta http-equiv = "refresh" content =" 0 ; url = /report.html"></head></html>' > atest/results/index.html | |
zip -r -j site.zip atest/results > no_output 2>&1 | |
curl -s -H "Content-Type: application/zip" -H "Authorization: Bearer ${{ secrets.NETLIFY_TOKEN }}" --data-binary "@site.zip" https://api.netlify.com/api/v1/sites > response.json | |
echo "REPORT_URL=$(cat response.json|python -c "import sys, json; print('https://' + json.load(sys.stdin)['subdomain'] + '.netlify.com')")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
echo "JOB_STATUS=$(python -c "print('${{ job.status }}'.lower())")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
if: always() && job.status == 'failure' && runner.os == 'Windows' | |
- uses: octokit/request-action@89697eb6635e52c6e1e5559f15b5c91ba5100cb0 | |
name: Update status with Github Status API | |
id: update_status | |
with: | |
route: POST /repos/:repository/statuses/:sha | |
repository: ${{ github.repository }} | |
sha: ${{ github.sha }} | |
state: "${{env.JOB_STATUS}}" | |
target_url: "${{env.REPORT_URL}}" | |
description: "Link to test report." | |
context: at-results-${{ matrix.python-version }}-${{ matrix.os }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.STATUS_UPLOAD_TOKEN }} | |
if: always() && job.status == 'failure' |