-
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (93 loc) · 2.82 KB
/
publish.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
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
name: Build
on:
release:
types: [published]
push:
branches:
- 'main'
paths-ignore:
- '**.md'
- 'docs/**'
pull_request:
branches:
- 'main'
paths-ignore:
- '**.md'
- 'docs/**'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install hunspell
run: sudo apt-get install -y hunspell libhunspell-dev hunspell-en-us
- name: Lint with Ruff
run: |
pip install ruff
ruff check --output-format=github .
continue-on-error: true
- name: test
run: |
pip install -r requirements.txt
pip install -r dev_requirements.txt
python3 -c "import language_tool_python; tool = language_tool_python.LanguageTool('en')"
cd dvrprocess
pytest . --junitxml=../junit/test-results.xml --cov --cov-branch --cov-report=xml:../coverage.xml --cov-report=html:../htmlcov --cov-report=term-missing
- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results
path: |
junit/test-results.xml
coverage.xml
htmlcov
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
build-and-push-image:
runs-on: ubuntu-22.04
needs: [test]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
labels: ${{ steps.meta.outputs.labels }}