-
Notifications
You must be signed in to change notification settings - Fork 8
58 lines (49 loc) · 1.53 KB
/
test.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Test
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
jobs:
codequality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install flake8 black
- name: Test code quality
run: |
make format-check
container-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set image release tag
run: |
echo "docker_tag=dev" >> $GITHUB_ENV
- name: Set image name
run: |
echo "image_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ env.docker_tag }}" >> $GITHUB_ENV
- name: Build container
run: |
docker build . -t "${{ env.image_name }}" \
--label "org.opencontainers.image.created=$(date --rfc-3339=ns)" \
--label "org.opencontainers.image.version=${{ env.docker_tag }}" \
--label "org.opencontainers.image.revision=${{ env.GITHUB_SHA }}"
- name: Test package
run: |
docker run -w /opt/dodola --name testcontainer "${{ env.image_name }}" \
pytest -v --pyargs dodola --cov dodola --cov-report term-missing --cov-report xml
docker cp testcontainer:/opt/dodola/coverage.xml ./coverage.xml
- name: Test CLI
run: |
docker run "${{ env.image_name }}" dodola --help
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4