This repository was archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
160 lines (138 loc) · 4.52 KB
/
build.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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Build
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- '*.dockerfile'
- 'simod_http/**'
- 'tests/**'
- '.github/workflows/build.yaml'
pull_request:
branches: [ main ]
paths:
- '*.dockerfile'
- 'simod_http/**'
- 'tests/**'
- '.github/workflows/build.yaml'
env:
DOCKERHUB_USERNAME: nokal
DOCKER_SIMOD_HTTP_NAME: nokal/simod-http
DOCKER_SIMOD_HTTP_WORKER_NAME: nokal/simod-http-worker
DOCKER_SIMOD_HTTP_SCHEDULER_NAME: nokal/simod-http-scheduler
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get the version
id: versioning
run: |
pip install poetry
echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT"
- name: Install
run: poetry install
- name: Test
run: poetry run pytest
prepare:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
timeout-minutes: 20
outputs:
version: ${{ steps.versioning.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get the version
id: versioning
run: |
pip install poetry
echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT"
- name: Generate requirements.txt
run: poetry export -f requirements.txt --output requirements.txt --without-hashes
- name: Commit requirements.txt
id: requirements
uses: EndBug/add-and-commit@v9
with:
add: requirements.txt
author_name: 'Ihar Suvorau'
author_email: 'ihar.suvorau@gmail.com'
message: 'Update requirements.txt'
- name: Generate Docker Compose manifests
run: bash generate_compose.sh
env:
FLOWER_USER: ${{ secrets.FLOWER_USER }}
FLOWER_PASSWORD: ${{ secrets.FLOWER_PASSWORD }}
- name: Commit compose.yaml and ansible/compose.yaml
id: compose
uses: EndBug/add-and-commit@v9
with:
add: "['compose.yaml', 'ansible/compose.yaml']"
author_name: 'Ihar Suvorau'
author_email: 'ihar.suvorau@gmail.com'
message: 'Update compose.yaml and ansible/compose.yaml'
- name: Assign a version tag
run: |
git tag ${{ steps.versioning.outputs.version }}
git push --tags
docker:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: prepare
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push simod-http to DockerHub
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.DOCKER_SIMOD_HTTP_NAME }}:latest,${{ env.DOCKER_SIMOD_HTTP_NAME }}:${{ needs.prepare.outputs.version }}
file: http.dockerfile
context: .
platforms: linux/amd64,linux/arm64
- name: Build and push simod-http-worker to DockerHub
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.DOCKER_SIMOD_HTTP_WORKER_NAME }}:latest,${{ env.DOCKER_SIMOD_HTTP_WORKER_NAME }}:${{ needs.prepare.outputs.version }}
file: worker.dockerfile
context: .
platforms: linux/amd64,linux/arm64
- name: Build and push simod-http-scheduler to DockerHub
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.DOCKER_SIMOD_HTTP_SCHEDULER_NAME }}:latest,${{ env.DOCKER_SIMOD_HTTP_SCHEDULER_NAME }}:${{ needs.prepare.outputs.version }}
file: scheduler.dockerfile
context: .
platforms: linux/amd64,linux/arm64
# - name: Docker Scout
# id: docker-scout
# uses: docker/scout-action@v0.18.1
# with:
# command: quickview,compare
# image: ${{ env.DOCKER_SIMOD_HTTP_NAME }}
# to-latest: true
# ignore-unchanged: true
# only-severities: critical,high
# write-comment: true
# github-token: ${{ secrets.GITHUB_TOKEN }}