-
Notifications
You must be signed in to change notification settings - Fork 28
98 lines (97 loc) · 3.93 KB
/
ci.yaml
File metadata and controls
98 lines (97 loc) · 3.93 KB
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
name: Continuous Integration
on:
push:
branches:
- main
pull_request:
pull_request_target:
types: [opened, synchronize, reopened, labeled]
jobs:
code_tests:
name: Code tests
if: github.event_name != 'pull_request_target'
runs-on: ubuntu-22.04
env:
NIX_BUILD_SHELL: bash
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- name: Run tests
run: nix-shell --command "scripts/test.sh"
integration_tests:
name: Integration tests
if: github.event_name != 'pull_request_target'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14, macos-15, ubuntu-22.04]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- name: Setup git
run: |
git config --global user.email "example@example.com"
git config --global user.name "Example"
- name: Create test project
run: |
scripts/script-create-django-app.sh --name integration
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
- name: Run tests
run: |
cd integration
nix-shell --command "python manage.py generate_client_assets"
nix-shell --command "python manage.py build"
nix-shell --command "scripts/test.sh --all"
- name: Test server renders home page
run: |
cd integration
nix-shell --command "python manage.py runserver 8000 &"
sleep 20
curl -f http://localhost:8000/ | grep -q "The install worked successfully"
kill %1 || true
- name: Run tests after removing example
run: |
cd integration
nix-shell --command "scripts/remove_example.sh"
nix-shell --command "python manage.py generate_client_assets"
nix-shell --command "python manage.py build"
nix-shell --command "scripts/test.sh --all"
website_tests:
name: Website tests
runs-on: ubuntu-22.04
if: |
github.event_name == 'push' ||
(github.event_name == 'pull_request_target' &&
(github.event.action != 'labeled' && github.repository_owner == github.actor) ||
(github.event.action == 'labeled' && contains(github.event.pull_request.labels.*.name, 'website')))
steps:
- name: Remove website label
if: contains(github.event.pull_request.labels.*.name, 'website')
run: |
curl --silent --fail \
-X DELETE \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: token ${{ github.token }}' \
'https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels/website'
- uses: actions/checkout@v3
if: github.event_name == 'push'
with:
fetch-depth: 0
- uses: actions/checkout@v3
if: github.event_name == 'pull_request_target'
with:
fetch-depth: 0
# See: https://github.com/actions/checkout/issues/518
ref: "refs/pull/${{ github.event.number }}/merge"
- uses: ./.github/actions/setup
- name: Run tests
run: |
cd website
nix-shell --command "python manage.py generate_client_assets"
nix-shell --command "scripts/test.sh --all"