-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (65 loc) · 2.25 KB
/
ci.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
# This workflow lints the codebase, runs tests, and builds the necessary Docker images for the sd-graph production system.
# The images are built on every push to master and dev, which are the two branches used for deployment to the prod and staging servers.
# The images are versioned with the branch name.
# This means that any older builds will be immediately discarded when this succeeds, but they are not needed at the moment.
name: Lint, Test, & Build Images
on:
push:
workflow_dispatch:
permissions:
contents: read
env:
REGISTRY: ghcr.io
IMAGE_SOURCE: https://github.com/source-data/sd-graph
IMAGE_REVISION: ${{ github.sha }}
IMAGE_TAG: ${{ github.ref_name }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v3
with:
python-version: "3.7"
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-cache
- run: pip install -r requirements/ci.txt
# these three steps will fail at the moment, but should not abort the build.
- run: ruff check . || true
- run: flake8 check . || true
- run: black --check . || true
# this script also runs the three tools above, but restricts them to the files that must pass linting.
- run: scripts/lint.sh
test:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: sudo apt-get install -y zsh
- run: cp .env.ci .env
- run: scripts/run-tests.sh -vv
build-and-push-image:
strategy:
matrix:
image: ['flask_deploy', 'flask', 'traefik', 'vuejs']
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker images
run: docker-compose -f docker-compose.ci.yml build ${{ matrix.image }}
- name: Push the Docker images
run: docker-compose -f docker-compose.ci.yml push ${{ matrix.image }}