-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (81 loc) · 2.62 KB
/
ci.yml
File metadata and controls
86 lines (81 loc) · 2.62 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: CI Pipeline
on:
push:
branches: [ dev ]
paths-ignore:
- '**/*.md'
- 'images/**'
- 'docs/**'
pull_request:
branches: [ staging, main ]
paths-ignore:
- '**/*.md'
- 'images/**'
- 'docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NIFIPULSE_AUTO_ENV: "1"
jobs:
build-test-dev:
if: github.ref == 'refs/heads/dev' && !(
github.event_name == 'push' && contains(github.event.head_commit.message, '[skip ci]') ||
github.event_name == 'pull_request' && (contains(github.event.pull_request.title, '[skip ci]') || contains(github.event.pull_request.body, '[skip ci]'))
)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: |
**/pyproject.toml
**/requirements*.txt
- name: Install deps
run: |
pip install -U pip
pip install -e .
pip install flake8 pytest
- name: Lint
continue-on-error: true
run: flake8 .
- name: Unit tests
run: pytest -q
- name: Docker build (skip if no Dockerfile)
run: |
if [ -f Dockerfile ]; then
docker build -t nifipulse-dev .
else
echo "No Dockerfile. Skipping docker build."
fi
integration-test-staging:
if: github.event.pull_request.base.ref == 'staging' && !(
github.event_name == 'push' && contains(github.event.head_commit.message, '[skip ci]') ||
github.event_name == 'pull_request' && (contains(github.event.pull_request.title, '[skip ci]') || contains(github.event.pull_request.body, '[skip ci]'))
)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check integration assets
id: has_assets
run: |
if [ -f docker-compose.yml ] && [ -d tests/integration ]; then
echo "run=true" >> "$GITHUB_OUTPUT"
else
echo "run=false" >> "$GITHUB_OUTPUT"
fi
- name: Docker build
if: steps.has_assets.outputs.run == 'true'
run: docker build -t nifipulse-staging .
- name: Docker compose up
if: steps.has_assets.outputs.run == 'true'
run: docker compose up -d
- name: Wait for services
if: steps.has_assets.outputs.run == 'true'
run: sleep 15
- name: Integration tests
if: steps.has_assets.outputs.run == 'true'
run: pytest -q tests/integration