Skip to content

Book tests

Book tests #1296

Workflow file for this run

---
name: Book tests
on:
schedule:
- cron: "45 15 * * *"
push:
branches:
main
pull_request:
jobs:
chapter-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test_chapter: [
test_chapter_01,
test_chapter_02_unittest,
test_chapter_03_unit_test_first_view,
test_chapter_04_philosophy_and_refactoring,
test_chapter_05_post_and_database,
test_chapter_06_explicit_waits_1,
test_chapter_07_working_incrementally,
test_chapter_08_prettification,
test_chapter_09_docker,
test_chapter_10_production_readiness,
test_chapter_11_server_prep,
test_chapter_12_ansible,
test_chapter_13_organising_test_files,
test_chapter_14_database_layer_validation,
test_chapter_15_simple_form,
test_chapter_16_advanced_forms,
test_chapter_17_javascript,
test_chapter_19_spiking_custom_auth,
test_chapter_20_mocking_1,
test_chapter_21_mocking_2,
test_chapter_22_fixtures_and_wait_decorator,
test_chapter_23_debugging_prod,
test_chapter_24_outside_in,
test_chapter_25_CI,
test_chapter_26_page_pattern,
]
env:
PY_COLORS: "1" # enable coloured output in pytest
steps:
- uses: actions/checkout@v4
- name: checkout submodules
shell: bash
run: |
sed -i '[email protected]:_https://github.com/_' .gitmodules
git submodule init
git submodule status | cut -d" " -f2 | xargs -n1 -P0 git submodule update
- name: setup Git
shell: bash
run: |
git config --global user.email "[email protected]"
git config --global user.name "Elspeth See-Eye"
git config --global init.defaultBranch main
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install apt stuff and other dependencies
shell: bash
run: |
sudo apt remove -y --purge firefox
sudo add-apt-repository ppa:mozillateam/ppa
sudo apt update -y
sudo apt install -y \
asciidoctor \
language-pack-en \
ruby-coderay \
ruby-pygments.rb \
firefox-esr \
tree
# fix failed to install firefox bin/symlink
which firefox || sudo ln -s /usr/bin/firefox-esr /usr/bin/firefox
# remove old geckodriver
which geckodriver && sudo rm $(which geckodriver) || exit 0
pip install uv
- name: Install Python requirements.txt globally
shell: bash
run: |
uv pip install --system .
- name: Install Python requirements.txt into virtualenv
shell: bash
run: |
make .venv/bin
- name: Display firefox version
shell: bash
run: |
apt show firefox-esr
dpkg -L firefox-esr
firefox --version
which geckodriver && geckodriver --version || exit 0
- name: Run chapter test
shell: bash
run: |
make ${{ matrix.test_chapter }}
- name: Save tempdir path to an env var
if: always()
shell: bash
run: |
TMPDIR_PATH=$(cat .tmpdir.${{ matrix.test_chapter }})
echo "TMPDIR_PATH=$TMPDIR_PATH" >> $GITHUB_ENV
- name: Archive the temp dir
uses: actions/upload-artifact@v4
if: always()
with:
name: test-source-${{ matrix.test_chapter }}
path: ${{ env.TMPDIR_PATH }}
- name: Archive the built html files
uses: actions/upload-artifact@v4
if: always()
with:
name: built-html-${{ matrix.test_chapter }}
path: |
*.html
*.css