-
Notifications
You must be signed in to change notification settings - Fork 35
60 lines (52 loc) · 1.77 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
name: tests
on: [pull_request]
jobs:
unit-tests:
runs-on: ubuntu-24.04
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make python3-pyflakes python3-pycodestyle python3-pip python3-pytest
sudo pip install .[test]
- name: Run lint tests
run: make check
tasks:
runs-on: ubuntu-24.04
permissions:
# enough permissions for tests-scan to work
pull-requests: read
statuses: write
timeout-minutes: 30
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
# need this to get origin/main for git diff
fetch-depth: 0
- name: Rebase to current main
run: |
git config user.name github-actions
git config user.email [email protected]
git rebase origin/main
- name: Install test dependencies
run: |
sudo apt-get update
sudo apt-get install -y make python3-pytest
- name: Check which containers changed
id: containers_changed
run: |
tasks=$(git diff --name-only origin/main..HEAD -- tasks/container)
# print for debugging
echo "tasks: $tasks"
[ -z "$tasks" ] || echo "tasks=true" >> "$GITHUB_OUTPUT"
- name: Build tasks container if it changed
if: steps.containers_changed.outputs.tasks
run: make tasks-container
- name: Test local deployment
run: |
echo '${{ secrets.GITHUB_TOKEN }}' > github-token
PRN=$(echo "$GITHUB_REF" | cut -f3 -d '/')
python3 -m pytest -vv --pr $PRN --pr-repository '${{ github.repository }}' --github-token=github-token