1212 - main
1313
1414jobs :
15- test :
15+ lint :
1616 runs-on : ubuntu-latest
1717
1818 steps :
@@ -23,40 +23,98 @@ jobs:
2323 uses : actions/setup-python@v6
2424 with :
2525 python-version : ' 3.13'
26- cache : ' pip' # caching pip dependencies
26+ cache : ' pip'
2727
2828 - name : Install dependencies
29- run : |
30- pip install -r requirements.txt
31- pip install -e .
29+ run : python -m pip install -e ".[dev]"
3230
3331 - name : Lint
3432 run : make lint
3533
34+ unit :
35+ runs-on : ubuntu-latest
36+ strategy :
37+ fail-fast : false
38+ matrix :
39+ python-version : ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
40+
41+ steps :
42+ - name : Checkout code
43+ uses : actions/checkout@v4
44+
45+ - name : Set up Python
46+ uses : actions/setup-python@v5
47+ with :
48+ python-version : ${{ matrix.python-version }}
49+ cache : ' pip'
50+
51+ - name : Install dependencies
52+ run : python -m pip install -e ".[dev]"
53+
54+ - name : Run smoke tests
55+ run : make test-unit
56+
57+ integration :
58+ runs-on : ubuntu-latest
59+ needs :
60+ - lint
61+ - unit
62+ strategy :
63+ fail-fast : false
64+ matrix :
65+ include :
66+ - python-version : ' 3.8'
67+ moodle-image : erseco/alpine-moodle:v4.5.5
68+ moodle-label : Moodle 4.5.5
69+ moodle-cache-key : moodle-4-5-5
70+ run-examples : false
71+ - python-version : ' 3.13'
72+ moodle-image : erseco/alpine-moodle:v5.0.1
73+ moodle-label : Moodle 5.0.1
74+ moodle-cache-key : moodle-5-0-1
75+ run-examples : true
76+
77+ steps :
78+ - name : Checkout code
79+ uses : actions/checkout@v4
80+
81+ - name : Set up Python
82+ uses : actions/setup-python@v5
83+ with :
84+ python-version : ${{ matrix.python-version }}
85+ cache : ' pip'
86+
87+ - name : Install dependencies
88+ run : python -m pip install -e ".[dev]"
89+
3690 - name : Cache Docker images
3791 uses : actions/cache@v5
3892 with :
39- path : /tmp/docker-cache
40- key : ${{ runner.os }}-docker-${{ hashFiles('docker-compose.yml') }}
93+ path : /tmp/docker-cache/${{ matrix.moodle-cache-key }}
94+ key : ${{ runner.os }}-docker-${{ matrix.moodle-cache-key }}-${{ hashFiles('docker-compose.yml') }}
4195
4296 - name : Load cached Docker images
4397 run : |
44- if [ -f /tmp/docker-cache/postgres.tar ]; then docker load -i /tmp/docker-cache/postgres.tar; fi
45- if [ -f /tmp/docker-cache/moodle.tar ]; then docker load -i /tmp/docker-cache/moodle.tar; fi
98+ if [ -f /tmp/docker-cache/${{ matrix.moodle-cache-key }}/postgres.tar ]; then
99+ docker load -i /tmp/docker-cache/${{ matrix.moodle-cache-key }}/postgres.tar
100+ fi
101+ if [ -f /tmp/docker-cache/${{ matrix.moodle-cache-key }}/moodle.tar ]; then
102+ docker load -i /tmp/docker-cache/${{ matrix.moodle-cache-key }}/moodle.tar
103+ fi
46104
47- - name : Start Moodle with Docker Compose (in backgroud)
48- run : make upd
105+ - name : Start ${{ matrix.moodle-label }} with Docker Compose
106+ run : MOODLE_DOCKER_IMAGE="${{ matrix.moodle-image }}" make upd
49107
50108 - name : Run tests
51- run : make test
109+ run : make test-local
52110
53111 - name : Run example_script.py
112+ if : matrix.run-examples
54113 run : python example_script.py
55114
56115 - name : Save Docker images to cache
57116 if : always()
58117 run : |
59- mkdir -p /tmp/docker-cache
60- docker save postgres:alpine -o /tmp/docker-cache/postgres.tar
61- docker save erseco/alpine-moodle:v4.5.5 -o /tmp/docker-cache/moodle.tar
62-
118+ mkdir -p /tmp/docker-cache/${{ matrix.moodle-cache-key }}
119+ docker save postgres:16-alpine -o /tmp/docker-cache/${{ matrix.moodle-cache-key }}/postgres.tar
120+ docker save "${{ matrix.moodle-image }}" -o /tmp/docker-cache/${{ matrix.moodle-cache-key }}/moodle.tar
0 commit comments