-
Notifications
You must be signed in to change notification settings - Fork 49
107 lines (90 loc) · 3.37 KB
/
docat.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
name: docat ci
on: [push, pull_request]
jobs:
python-test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: install dependencies
working-directory: docat
run: |
python -m pip install --upgrade pip
python -m pip install poetry==1.7.1
python -m poetry install
- name: run backend linter
working-directory: docat
run: |
python -m poetry run flake8 docat tests
- name: run backend static code analysis
working-directory: docat
run: |
python -m poetry run mypy .
- name: run backend tests
working-directory: docat
run: |
python -m poetry run pytest
javascript-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: install JavaScript dependencies
working-directory: web
run: yarn install
- name: building frontend
working-directory: web
run: yarn build
- name: run linter against code
working-directory: web
run: yarn lint
- name: run test suite
working-directory: web
run: yarn test
container-image:
runs-on: ubuntu-latest
needs: [python-test, javascript-test]
strategy:
max-parallel: 2
matrix:
registry:
- name: ghcr.io
org: ${{ github.repository_owner }}
token: GITHUB_TOKEN
- name: docker.io
org: randombenj
token: DOCKERHUB
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Image
run: |
docker build . --build-arg DOCAT_VERSION=$(git describe --tags --always) --tag ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:${{ github.sha }}
docker tag ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:${{ github.sha }} ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:unstable
- name: tag latest and version on release
run: |
docker tag ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:${{ github.sha }} ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:$(git describe --tags)
docker tag ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:${{ github.sha }} ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:latest
if: startsWith(github.event.ref, 'refs/tags')
- name: Registry Login
uses: docker/login-action@v3
with:
registry: ${{ matrix.registry.name }}
username: ${{ matrix.registry.org }}
password: ${{ secrets[matrix.registry.token] }}
# Note(Fliiiix): Only login and push on main repo where the secrets are available
if: "!(github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]')"
- name: Publish Image
run: |
docker push --all-tags ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat
if: "!(github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]')"