-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (122 loc) · 4.19 KB
/
ci_job.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: CI Tests
permissions:
pull-requests: write
on: [push, pull_request, workflow_call]
jobs:
lint-and-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python "3.X"
uses: actions/setup-python@v5
with:
python-version: "3.X"
- name: Install dependencies
run: |
python3 -m pip install -e ./freva-rest[dev] -e ./freva-data-portal-worker[full]
- name: Generate self signed keys
run: python dev-env/config/dev-utils.py gen-certs
- name: Set up services
run: |
docker compose -f dev-env/docker-compose.yaml up -d --remove-orphans
- name: Waiting for keycloak
run: >
python dev-env/config/dev-utils.py oidc
http://localhost:8080/realms/freva/.well-known/openid-configuration
- name: Starting the local server
run: |
python run_server.py --config dev-env/api_config.toml --debug --dev -p 7777
- name: Linting, type checking and docs with tox
run: tox run-parallel --parallel-no-spinner
tests:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
- name: Install dependencies
run: |
python3 -m pip install -e ./freva-rest[dev] -e ./freva-data-portal-worker[full]
- name: Generate self signed keys
run: python dev-env/config/dev-utils.py gen-certs
- name: Set up services
run: |
docker compose -f dev-env/docker-compose.yaml up -d --remove-orphans
- name: Waiting for keycloak
run: >
python dev-env/config/dev-utils.py oidc
http://localhost:8080/realms/freva/.well-known/openid-configuration
- name: Run tests
run: tox -e test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
build-docker-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Generate self signed keys
run: python dev-env/config/dev-utils.py gen-certs
- name: Set up services
run: |
docker compose -f dev-env/docker-compose.yaml up -d redis ldap keycloak --remove-orphans
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build freva-storage-service image
uses: docker/build-push-action@v4
with:
context: freva-rest
file: freva-rest/Dockerfile
platforms: linux/amd64
push: false
load: true
tags: freva-rest:latest
- name: Waiting for keycloak
run: >
python dev-env/config/dev-utils.py oidc
http://localhost:8080/realms/freva/.well-known/openid-configuration
- name: Check databrowser image
run: python3 dev-env/check-container.py
dependabot:
name: Merge PR by dependabot
runs-on: ubuntu-latest
needs: [tests, lint-and-docs, build-docker-image]
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve dependabot's PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.TOKEN}}
- name: Auto-merge for dependabot's PR
run: gh pr merge --merge --auto "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.TOKEN}}