-
Notifications
You must be signed in to change notification settings - Fork 7
153 lines (132 loc) · 4.29 KB
/
Copy pathbuild.yaml
File metadata and controls
153 lines (132 loc) · 4.29 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
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
name: build
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache
uses: Swatinem/rust-cache@v2.7.3
- name: Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: clippy
- uses: bufbuild/buf-setup-action@v1
- name: Clippy
# Typically: cargo clippy --workspace --bins --examples --tests -- --no-deps
run: make clippy
- name: Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
components: rustfmt
- name: Fmt
run: cargo +nightly fmt --all --check
- uses: bufbuild/buf-setup-action@v1
- uses: bufbuild/buf-lint-action@v1
build:
strategy:
matrix:
os: [
{runner: ubuntu-2204-16-cores, arch: linux/amd64, tag_suffix: amd64},
{runner: ubuntu-2204-arm-16-cores, arch: linux/arm64, tag_suffix: arm64},
]
name: build
permissions:
id-token: write # required to use OIDC authentication
contents: read
runs-on: ${{ matrix.os.runner }}
steps:
# Checkout repo to Github Actions runner
- name: Checkout
uses: actions/checkout@v4
- name: Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "stable"
profile: minimal
- name: Cache
uses: Swatinem/rust-cache@v2.7.3
- name: Build
env:
ARCH: ${{ matrix.os.arch }}
run: make release-all
- name: Build Container Image
env:
IMAGE_TAG: ${{ github.sha }}
ARCH: ${{ matrix.os.arch }}
TAG_SUFFIX: ${{ matrix.os.tag_suffix }}
run: make docker-build
- name: Setup AWS credentials
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::750483288132:role/terraform-bitdriftlabs-star-oidc
aws-region: us-east-1
- name: Setup push AWS credentials
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::750483288132:role/ecr-push
role-duration-seconds: 1200
role-chaining: true
- name: Login to ECR
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
id: ecr-login
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- name: Push Container Image
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
env:
IMAGE_TAG: ${{ github.sha }}
ARCH: ${{ matrix.os.arch }}
TAG_SUFFIX: ${{ matrix.os.tag_suffix }}
run: make docker-push
multi-arch:
needs: build
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
permissions:
id-token: write # required to use OIDC authentication
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::750483288132:role/terraform-bitdriftlabs-star-oidc
aws-region: us-east-1
- name: Setup push AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::750483288132:role/ecr-push
role-duration-seconds: 1200
role-chaining: true
- name: Login to ECR
id: ecr-login
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- name: Push Container Image
env:
IMAGE_TAG: ${{ github.sha }}
run: make docker-multi-arch-push