-
Notifications
You must be signed in to change notification settings - Fork 8
167 lines (147 loc) · 4.91 KB
/
commit.yaml
File metadata and controls
167 lines (147 loc) · 4.91 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Commit
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build_and_test:
name: Build and Test (${{ matrix.platform.arch }}, ${{ matrix.platform.os }})
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- os: ubuntu-22.04
arch: amd64
- os: ubuntu-22.04-arm
arch: arm64
- os: macos-latest
arch: arm64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
cache: false
go-version-file: go/go.mod
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: go-test-${{ hashFiles('**/go.mod', '**/go.sum') }}
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ matrix.platform.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.platform.os }}-cargo-registry-
- name: Cache Cargo git index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ matrix.platform.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.platform.os }}-cargo-git-
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy, rustfmt
- run: make check
- run: make test
- run: make build
- run: make integration-test
docker_build_and_integration_test:
name: Integration Test with Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Build
uses: docker/build-push-action@v6
with:
load: true
push: false
tags: ghcr.io/${{ github.repository_owner }}/dynamic-modules-examples:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: actions/setup-go@v5
with:
cache: false
go-version-file: integration/go.mod
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: integration-tests-${{ hashFiles('**/go.mod', '**/go.sum') }}-${{ matrix.platform.os }}
- name: Run integration tests
env:
ENVOY_IMAGE: ghcr.io/${{ github.repository_owner }}/dynamic-modules-examples:${{ github.sha }}
run: go test -v -count=1 ./...
working-directory: ./integration
- name: Login into GitHub Container Registry
# This step will only run on push events to the main branch.
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
# This step will only run on push events to the main branch.
if: github.event_name == 'push'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository_owner }}/dynamic-modules-examples:${{ github.sha }},ghcr.io/${{ github.repository_owner }}/dynamic-modules-examples:latest
cache-from: type=gha
cache-to: type=gha,mode=max
docker_build_and_integration_test_on_main:
needs: [docker_build_and_integration_test]
name: Integration Test with Docker Image (${{ matrix.platform.arch }})
# This will only run on push events to the main branch.
# Mainly to check the multi-arch image by running the
# integration tests on both architectures.
if: github.event_name == 'push'
runs-on: ${{ matrix.platform.os }}
defaults:
run:
working-directory: ./integration
strategy:
fail-fast: false
matrix:
platform:
- os: ubuntu-22.04
arch: amd64
- os: ubuntu-22.04-arm
arch: arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
cache: false
go-version-file: integration/go.mod
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: integration-tests-${{ hashFiles('**/go.mod', '**/go.sum') }}-${{ matrix.platform.os }}
- name: Run integration tests
env:
ENVOY_IMAGE: ghcr.io/${{ github.repository_owner }}/dynamic-modules-examples:${{ github.sha }}
run: go test -v -count=1 ./...