-
Notifications
You must be signed in to change notification settings - Fork 4
40 lines (37 loc) · 1.19 KB
/
run-tests.yaml
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
name: Backend - Run Tests
on:
workflow_dispatch:
push:
paths:
- 'backend/**'
- '.github/workflows/ci-backend.yaml'
- '.github/workflows/run-tests.yaml'
jobs:
test-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v1
- id: lowercase-repo-name
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.repository }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: "./backend"
target: test
load: true
tags: ghcr.io/${{ steps.lowercase-repo-name.outputs.lowercase }}-backend:latest
- name: Run Tests
run: |
mkdir -p $GITHUB_WORKSPACE/cov
sudo chown -R 1000:1000 $GITHUB_WORKSPACE/cov
sudo chmod g+s $GITHUB_WORKSPACE/cov
docker compose run \
--volume $GITHUB_WORKSPACE/cov:/cov \
-u 1000 \
backend sh -c \
"coverage run --data-file=/cov/.coverage -m pytest tests/ && coverage xml --data-file=/cov/.coverage -o /cov/coverage.xml"
env:
REPO_NAME: ${{ steps.lowercase-repo-name.outputs.lowercase }}