-
Notifications
You must be signed in to change notification settings - Fork 20
81 lines (67 loc) · 2.54 KB
/
Copy pathmain.yml
File metadata and controls
81 lines (67 loc) · 2.54 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
name: CI
on: [push, pull_request]
permissions:
contents: read
jobs:
test:
env:
MIX_ENV: test
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1.24.0
with:
otp-version: 27.3.4.12
elixir-version: 1.18.1
- run: mix deps.get
- run: mix format --check-formatted
- run: mix deps.unlock --check-unused
- run: MIX_ENV=test mix compile --warnings-as-errors
- run: mix test
docker:
name: Docker
runs-on: ubuntu-24.04-arm
permissions:
contents: 'read'
id-token: 'write'
env:
IMAGE_NAME: 'diff'
PROJECT_ID: 'hexpm-prod'
SERVICE_ACCOUNT: ${{ secrets.GCLOUD_SERVICE_ACCOUNT }}
WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCLOUD_WORKFLOW_IDENTITY_POOL_PROVIDER }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set short git commit SHA
run: echo "COMMIT_SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Google auth
id: auth
uses: 'google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093' # v3.0.0
if: ${{ github.event_name != 'pull_request' && env.SERVICE_ACCOUNT != '' }}
with:
token_format: 'access_token'
project_id: ${{ env.PROJECT_ID }}
service_account: ${{ env.SERVICE_ACCOUNT }}
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
- name: Docker Auth
id: docker-auth
uses: 'docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee' # v4.2.0
if: ${{ github.event_name != 'pull_request' && env.SERVICE_ACCOUNT != '' }}
with:
registry: gcr.io
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
- name: Build and push
id: build
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
platforms: linux/arm64
tags: gcr.io/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHORT_SHA }}
push: ${{ github.event_name != 'pull_request' && env.SERVICE_ACCOUNT != '' }}
cache-from: type=gha
cache-to: type=gha,mode=max