-
Notifications
You must be signed in to change notification settings - Fork 1
206 lines (185 loc) · 5.91 KB
/
ci.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# Copyright (c) 2022 MobileCoin Inc.
name: ci
on:
pull_request:
push:
tags:
- 'v*.*.*'
# env:
# PUSH: ${{ github.event_name == 'pull_request' && 'false' || 'true' }}
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
lint-actions:
runs-on: mco-dev-small-x64
steps:
- name: Lint GitHub Actions
uses: mobilecoinofficial/gh-actions/lint-actions@v0
lint-docker:
runs-on: mco-dev-small-x64
steps:
- name: Lint Dockerfiles with Hadolint
uses: mobilecoinofficial/gh-actions/lint-docker@v0
docker-rust-base:
strategy:
matrix:
runner:
- mco-dev-small-x64
- mco-dev-small-arm64
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: mobilecoinofficial/gh-actions/checkout@v0
- name: Docker rust-base
id: build
uses: mobilecoinofficial/gh-actions/docker@4e8da3b222fe4dcf5a8d7ad04dd37b1c43c8c7a5
with:
dockerfile: Dockerfile.rust-base
images: mobilecoin/rust-base
outputs: type=image,name=mobilecoin/rust-base,push-by-digest=true,name-canonical=true,push=true
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-rust-base-${{ runner.arch }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
docker-rust-base-merge:
runs-on: mco-dev-small-x64
needs:
- docker-rust-base
steps:
- name: Merge and Tag Digests
uses: mobilecoinofficial/gh-actions/docker-merge-digests@8ed6075d8f78f3c63f6836526448c36a20c137d0
with:
digest_artifact_prefix: digests-rust-base
images: mobilecoin/rust-base
flavor: latest=true
tags: |
type=semver,pattern=v{{version}}
type=sha
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Download digests
# uses: actions/download-artifact@v4
# with:
# path: /tmp/digests
# pattern: digests-rust-base*
# merge-multiple: true
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Docker meta
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: mobilecoin/rust-base
# tags: |
# type=semver,pattern=v{{version}}
# type=sha
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Create manifest list and push
# shell: bash
# working-directory: /tmp/digests
# run: |
# # Grab the tags from metadata-action ENV with jq
# # Gather all the digests for the images pushed (names of empty files stored as artifacts)
# # Push a manifest (tag) with all the digests to dockerhub
# docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
# $(printf 'mobilecoin/rust-base@sha256:%s ' *)
# docker-rust-sgx:
# needs:
# - docker-rust-base
# runs-on: mco-dev-small-x64
# steps:
# - name: Checkout
# uses: mobilecoinofficial/gh-actions/checkout@v0
# - name: Docker rust-sgx
# uses: mobilecoinofficial/gh-actions/docker@v0
# with:
# flavor: latest=true
# dockerfile: Dockerfile.rust-sgx
# images: mobilecoin/rust-sgx
# tags: |
# type=ref,event=branch
# type=semver,pattern=v{{version}}
# type=semver,pattern=v{{major}}.{{minor}}
# type=semver,pattern=v{{major}}
# type=sha
# push: true
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# docker-fat-builder:
# needs:
# - docker-rust-base
# strategy:
# matrix:
# runner:
# - mco-dev-small-x64
# - mco-dev-small-arm64
# runs-on: ${{ matrix.runner }}
# steps:
# - name: Checkout
# uses: mobilecoinofficial/gh-actions/checkout@v0
# - name: Docker fat-builder
# uses: mobilecoinofficial/gh-actions/docker@v0
# with:
# flavor: latest=true
# dockerfile: Dockerfile.fat-builder
# images: mobilecoin/fat-builder
# build_args: |
# BASE_IMAGE=rust-base
# tags: |
# type=ref,event=branch
# type=semver,pattern=v{{version}}
# type=semver,pattern=v{{major}}.{{minor}}
# type=semver,pattern=v{{major}}
# type=sha
# push: true
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# docker-fat-sgx-builder:
# needs:
# - docker-rust-sgx
# runs-on: mco-dev-small-x64
# steps:
# - name: Docker fat-sgx-builder
# uses: mobilecoinofficial/gh-actions/docker@v0
# with:
# flavor: latest=true
# dockerfile: Dockerfile.fat-builder
# images: mobilecoin/fat-sgx-builder
# build_args: |
# BASE_IMAGE=rust-sgx
# tags: |
# type=ref,event=branch
# type=semver,pattern=v{{version}}
# type=semver,pattern=v{{major}}.{{minor}}
# type=semver,pattern=v{{major}}
# type=sha
# push: true
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# success:
# needs:
# - lint-actions
# - lint-docker
# - docker-rust-base
# - docker-rust-sgx
# - docker-fat-builder
# - docker-fat-sgx-builder
# runs-on: mco-dev-small-x64
# steps:
# - name: Success
# run: echo "All Builds Success"