-
Notifications
You must be signed in to change notification settings - Fork 175
136 lines (119 loc) · 3.84 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
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