forked from learning-unlimited/ESP-Website
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (99 loc) · 2.84 KB
/
tests.yml
File metadata and controls
105 lines (99 loc) · 2.84 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
99
100
101
102
103
104
105
name: "Unit Tests"
on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- '*.md'
- 'LICENSE'
- '.gitattributes'
- '.gitignore'
pull_request:
branches: [main]
paths-ignore:
- 'docs/**'
- '*.md'
- 'LICENSE'
- '.gitattributes'
- '.gitignore'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-24.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
python-version: [3.7]
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpassword
POSTGRES_DB: test_django
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
memcached:
image: memcached:alpine
ports:
- 11211:11211
env:
DJANGO_SETTINGS_MODULE: esp.settings
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: deadsnakes/action@v3.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('esp/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Get apt packages list
id: apt-action
run: |
PKGS=$(cat esp/packages_base.txt | grep -v '^memcached' | grep -v '^postgres' | grep -v '^libpq-dev' | grep -v '^.*pip' | tr '\n' ' ')
echo "packages=$PKGS" >> $GITHUB_OUTPUT
- name: Cache apt packages
uses: Eeems-Org/apt-cache-action@v1
with:
packages: ${{ steps.apt-action.outputs.packages }}
- name: Prepare for Installing Dependencies
run: deploy/ci/before_install
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: Install Dependencies
env:
CI_JOB: test
PYTHON_VERSION: ${{ matrix.python-version }}
run: deploy/ci/install
- name: Prepare for Test
env:
CI_JOB: test
PYTHON_VERSION: ${{ matrix.python-version }}
run: deploy/ci/before_script
- name: Run Tests
env:
CI_JOB: test
PYTHON_VERSION: ${{ matrix.python-version }}
run: deploy/ci/script
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}