-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (159 loc) · 5.94 KB
/
main.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: CI
on:
push:
permissions:
contents: write
pull-requests: write
jobs:
# Run tests and publish amd64
build_amd64:
runs-on: actuated-8cpu-20gb
concurrency:
group: ${{ github.ref }}-amd64
cancel-in-progress: true
steps:
- name: Collect Workflow Telemetry
uses: catchpoint/workflow-telemetry-action@v1
with:
github_token: ${{ secrets.DASCHBOT_PAT }}
theme: dark
- uses: actions/checkout@v4
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: extractions/setup-just@v1
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# selecting a toolchain either by action or manual `rustup` calls should happen
# before the plugin, as the cache uses the current rustc version as its cache key
- name: Add rust toolchains
run: |
rustup toolchain install stable --profile minimal
rustup toolchain install nightly --profile minimal
rustup component add rustfmt --toolchain nightly
- uses: Swatinem/rust-cache@v2
- run: just check
- run: just build
- run: just test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- run: just docker-build-amd64
- name: Push image to Docker hub only on main or tag (release)
if: (github.ref_name == 'main' || startsWith(github.ref, 'refs/tags/dsp-meta-cmd'))
run: just docker-push-amd64
# Run tests and publish arm64
build_arm64:
runs-on: actuated-arm64-16cpu-20gb
concurrency:
group: ${{ github.ref }}-arm64
cancel-in-progress: true
steps:
- name: Collect Workflow Telemetry
uses: catchpoint/workflow-telemetry-action@v1
with:
github_token: ${{ secrets.DASCHBOT_PAT }}
theme: dark
- uses: actions/checkout@v4
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: extractions/setup-just@v1
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# selecting a toolchain either by action or manual `rustup` calls should happen
# before the plugin, as the cache uses the current rustc version as its cache key
- name: Add rust toolchains
run: |
rustup toolchain install stable --profile minimal
rustup toolchain install nightly --profile minimal
rustup component add rustfmt --toolchain nightly
- uses: Swatinem/rust-cache@v2
- run: just check
- run: just build
- run: just test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- run: just docker-build-arm64
- name: Push image to Docker hub only on main or tag (release)
if: (github.ref_name == 'main' || startsWith(github.ref, 'refs/tags/dsp-meta-cmd'))
run: just docker-push-arm64
# Build, test for arm64
build_arm64_buildjet:
runs-on: buildjet-8vcpu-ubuntu-2204-arm
concurrency:
group: ${{ github.ref }}-buildjet-arm64
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: extractions/setup-just@v1
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
components: rustfmt, clippy
toolchain: nightly
- uses: buildjet/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: just check
- run: just build
- run: just test
# publish manifest combining aarch64 and amd64 images
publish_manifest:
name: Build and Publish Manifest to Dockerhub
runs-on: ubuntu-latest
needs: [ build_amd64, build_arm64 ]
if: (github.ref_name == 'main' || startsWith(github.ref, 'refs/tags/dsp-meta-cmd'))
outputs:
tag: ${{ steps.output_docker_image_tag.outputs.tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: extractions/setup-just@v1
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Output docker image tag
id: output_docker_image_tag
run: echo "tag=$(just docker-image-tag | tr -d '\n')" >> "$GITHUB_OUTPUT"
shell: bash # Explicit for fail-fast behaviour
- run: just docker-publish-manifest
trigger-dev-deployment:
name: Trigger deployment to DEV
runs-on: ubuntu-latest
needs: publish_manifest
if: github.ref_name == 'main'
steps:
- name: Trigger deployment to DEV
env:
IMAGE_TAG: ${{ needs.publish_manifest.outputs.tag }}
JENKINS_BASIC_AUTH_USER: ${{ secrets.JENKINS_BASIC_AUTH_USER }}
JENKINS_BASIC_AUTH_PASS: ${{ secrets.JENKINS_BASIC_AUTH_PASS }}
JENKINS_UPDATE_RELEASE_WEBHOOK: ${{ secrets.JENKINS_UPDATE_RELEASE_WEBHOOK }}
run: |
curl -f -u "${JENKINS_BASIC_AUTH_USER}:${JENKINS_BASIC_AUTH_PASS}" \
-X POST "${JENKINS_UPDATE_RELEASE_WEBHOOK}" \
-d "Service=meta&Version=${IMAGE_TAG}"
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
token: ${{ secrets.DASCHBOT_PAT }}
config-file: .github/release-please/config.json
manifest-file: .github/release-please/manifest.json