-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (58 loc) · 1.85 KB
/
testing_codevalidator.yml
File metadata and controls
71 lines (58 loc) · 1.85 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
name: Code Validator Tests and Build
on:
push:
paths:
- 'services/code-validator/**'
pull_request:
paths:
- 'services/code-validator/**'
workflow_dispatch:
jobs:
test-code-validator:
name: Run Code Validator Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
pip install -r services/code-validator/src/requirements.txt
pip install pytest httpx
- name: Cache pip packages
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Run pytest
run: pytest --junitxml=reports/results.xml services/code-validator/tests/test.py
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: code-validator-test-results
path: reports/
build-and-push-docker:
name: Build and Push Docker Image to GitHub Packages
needs: test-code-validator
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker image
run: |
REPOSITORY_LOWER=$(echo "ghcr.io/${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
docker build -t $REPOSITORY_LOWER/code-validator:latest services/code-validator/
docker push $REPOSITORY_LOWER/code-validator:latest