-
Notifications
You must be signed in to change notification settings - Fork 104
123 lines (123 loc) · 3.93 KB
/
test.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
name: "Test"
on:
pull_request:
push:
branches:
- "qa/**"
- "stable/**"
jobs:
test:
name: "Test ${{ matrix.rule }} on ${{ matrix.python-version }}"
runs-on: "ubuntu-22.04"
strategy:
fail-fast: false
matrix:
rule: ["mcp-server", "mcp-client", "dashboard", "archivematica-common"]
python-version: ["3.8", "3.9", "3.10"]
include:
- rule: "storage-service"
python-version: "3.9"
- rule: "migrations"
python-version: "3.9"
steps:
- name: "Check out repository"
uses: "actions/checkout@v3"
- name: "Check out the archivematica-storage-service submodule"
run: |
git submodule update --init hack/submodules/archivematica-storage-service/
- name: "Set up buildx"
uses: "docker/setup-buildx-action@v2"
id: buildx
with:
install: true
- name: "Set up docker cache"
uses: "actions/cache@v3"
with:
path: /tmp/.docker-cache-old
key: ${{ runner.os }}-docker-${{ matrix.python-version }}-${{ matrix.rule }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-docker-${{ matrix.python-version }}-${{ matrix.rule }}-
${{ runner.os }}-docker-${{ matrix.python-version }}-
${{ runner.os }}-docker-
- name: "Build archivematica-tests image"
uses: "docker/build-push-action@v4"
with:
context: .
file: ./hack/Dockerfile
target: archivematica-tests
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
tags: archivematica-tests:latest
push: false
load: true
cache-from: type=local,src=/tmp/.docker-cache-old
cache-to: type=local,dest=/tmp/.docker-cache-new,mode=max
- name: "Create external volumes"
run: |
make -C hack/ create-volumes
- name: "Run make rule"
run: |
make -C hack/ test-${{ matrix.rule }}
env:
TOXARGS: -vv
PYTEST_ADDOPTS: -vv --cov /src/src/ --cov-config=/src/.coveragerc --cov-report xml:/src/coverage.xml
PYTHON_VERSION: ${{ matrix.python-version }}
- name: "Upload coverage report"
if: matrix.rule != 'storage-service' && matrix.rule != 'migrations' && github.repository == 'artefactual/archivematica'
uses: "codecov/codecov-action@v3"
with:
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
name: ${{ matrix.rule }}
- name: "Set newest docker cache"
run: |
rm -rf /tmp/.docker-cache-old
mv /tmp/.docker-cache-new /tmp/.docker-cache-old
frontend:
name: "Test frontend"
runs-on: "ubuntu-22.04"
defaults:
run:
working-directory: "./src/dashboard/frontend/"
steps:
- name: "Check out repository"
uses: "actions/checkout@v3"
- name: "Set up Node JS"
uses: "actions/setup-node@v3"
with:
node-version: "8"
- name: "Cache npm packages"
uses: "actions/cache@v3"
with:
path: "~/.npm"
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
${{ runner.os }}-node-
- name: "Install frontend dependencies"
run: |
npm install
- name: "Run tests"
run: |
npm run "test-single-run"
linting:
name: "Lint"
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository"
uses: "actions/checkout@v3"
- name: "Set up Python 3.9"
uses: "actions/setup-python@v4"
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: |
requirements-dev.txt
- name: "Install tox"
run: |
python -m pip install --upgrade pip
pip install tox
- name: "Run tox"
run: |
tox -e linting