Repository navigation
90 lines (75 loc) · 2.5 KB
/
Copy pathci.yml
File metadata and controls
90 lines (75 loc) · 2.5 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
name: CI
on:
push:
branches: ["**"]
pull_request:
permissions:
contents: read
packages: write
env:
IMAGE_PREFIX: ghcr.io/maroon-rides/api
APPS: gateway requester
jobs:
test:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- run: go run github.com/onsi/ginkgo/v2/ginkgo -p -r
build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
args: build --snapshot --clean
- uses: actions/upload-artifact@v4
with:
name: binaries-${{ github.sha }}
path: |
dist/*/gateway
dist/*/requester
- name: Stage docker contexts
id: stage
run: |
for app in $APPS; do
for arch in amd64 arm64; do
mkdir -p "docker/$app/linux/$arch"
cp dist/${app}_linux_${arch}*/$app "docker/$app/linux/$arch/"
done
done
echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
if: github.event_name == 'push'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: docker/gateway
file: apps/gateway/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'push' }}
tags: ${{ env.IMAGE_PREFIX }}-gateway:${{ steps.stage.outputs.short_sha }}
labels: org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
- uses: docker/build-push-action@v6
with:
context: docker/requester
file: apps/requester/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'push' }}
tags: ${{ env.IMAGE_PREFIX }}-requester:${{ steps.stage.outputs.short_sha }}
labels: org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}