-
-
Notifications
You must be signed in to change notification settings - Fork 34
90 lines (73 loc) · 2.5 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
container:
image: ghcr.io/weasyl/ci-base-image@sha256:960e621bcdde15bdf9b1dd29c8b45dec93927aa67f2e7f4ab3f763a16f2b99f4
options: --user 1001
services:
weasyl-database:
image: postgres:9.6
env:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: weasyl
POSTGRES_DB: weasyl_test
# probably ready by the time the tests run anyway; no need to add latency
#options: >-
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
weasyl-memcached:
image: memcached:1.5-alpine
steps:
- uses: actions/checkout@v4
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: cache-${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
cache-${{ runner.os }}-npm-
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: cache-${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
cache-${{ runner.os }}-poetry-
- name: Create virtualenv
run: python3 -m venv --system-site-packages .venv
- name: Install npm dependencies
run: npm ci
- name: Install Poetry dependencies
run: poetry install
- name: Configure Weasyl
run: |
cp ci/site.config.txt config/
cp config/weasyl-staff.example.py config/weasyl-staff.py
cat imagemagick-policy.xml > /usr/etc/ImageMagick-6/policy.xml
printf %.8s "$GITHUB_SHA" > version.txt
- name: Build assets
run: node build.js
- name: Test libweasyl
env:
WEASYL_TEST_SQLALCHEMY_URL: postgresql+psycopg2://weasyl@weasyl-database/weasyl_test
run: .venv/bin/coverage run -m pytest libweasyl.test libweasyl.models.test
- name: Test weasyl
env:
WEASYL_APP_ROOT: .
WEASYL_STORAGE_ROOT: testing
run: .venv/bin/coverage run -m pytest weasyl.test
- name: Create coverage report
run: |
.venv/bin/coverage combine
.venv/bin/coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}