forked from apluslms/a-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (76 loc) · 3.04 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
name: tests
on:
# trigger when pushed to any branch (for development)
push:
# trigger when a pull request is made to master
pull_request:
branches:
- master
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: imgcache
with:
path: .docker-img.tar
key: v2-${{ hashFiles('.github/workflows/Dockerfile', 'requirements_testing.txt', 'requirements.txt') }}
# we stop here if the docker image was found in a cache
- uses: actions/cache@v2
with:
path: .docker-cache
key: v2-${{ hashFiles('.github/workflows/Dockerfile', 'requirements_testing.txt', 'requirements.txt') }}
if: steps.imgcache.outputs.cache-hit != 'true'
- uses: docker/[email protected]
if: steps.imgcache.outputs.cache-hit != 'true'
- run: docker buildx build -t testimg --output type=docker,dest=.docker-img.tar --cache-to type=local,dest=.docker-cache2,mode=max --cache-from type=local,src=.docker-cache -f .github/workflows/Dockerfile .
if: steps.imgcache.outputs.cache-hit != 'true'
- run: rm -rf .docker-cache | true
if: steps.imgcache.outputs.cache-hit != 'true'
- run: mv .docker-cache2 .docker-cache
if: steps.imgcache.outputs.cache-hit != 'true'
unit-tests:
runs-on: ubuntu-latest
needs: docker-build
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: .docker-img.tar
key: v2-${{ hashFiles('.github/workflows/Dockerfile', 'requirements_testing.txt', 'requirements.txt') }}
- run: docker load -i .docker-img.tar
- run: docker run -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} testimg bash -c 'python3 manage.py compilemessages && python3 manage.py test'
selenium-tests:
runs-on: ubuntu-latest
needs: docker-build
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: .docker-img.tar
key: v2-${{ hashFiles('.github/workflows/Dockerfile', 'requirements_testing.txt', 'requirements.txt') }}
- run: docker load -i .docker-img.tar
- run: docker run -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} testimg bash -c 'python3 manage.py compilemessages && selenium_test/run_servers_and_tests.sh'
playwright-tests:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements_testing.txt
- name: Ensure browsers are installed
run: python -m playwright install --with-deps
- name: Run tests
run: pytest e2e_tests --tracing=retain-on-failure
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-traces
path: test_results/