-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (109 loc) · 3.55 KB
/
ci.yml
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
name: CI
on:
push:
branches:
- main
pull_request:
# Ensure only one workflow instance runs at a time. For branches other than the
# default branch, cancel the pending jobs in the group. For the default branch,
# queue them up. This avoids cancelling jobs that are in the middle of deploying
# to production.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}
jobs:
check:
name: Check
runs-on: ubuntu-latest-4-cores
env:
R8_CUDA_PREFIX: ${{ secrets.R8_CUDA_PREFIX }}
R8_CUDNN_PREFIX: ${{ secrets.R8_CUDNN_PREFIX }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- run: ./script/check
test:
name: Test
runs-on: ubuntu-latest-4-cores
env:
R8_CUDA_PREFIX: ${{ secrets.R8_CUDA_PREFIX }}
R8_CUDNN_PREFIX: ${{ secrets.R8_CUDNN_PREFIX }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- run: ./script/build
- run: ./script/build-runtime
- run: ./script/test
test-mini:
name: Test Mini
runs-on: ubuntu-latest-4-cores
env:
R8_CUDA_PREFIX: ${{ secrets.R8_CUDA_PREFIX }}
R8_CUDNN_PREFIX: ${{ secrets.R8_CUDNN_PREFIX }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- run: ./script/build
- run: ./script/test-mini
build-release:
name: Build + release ${{ matrix.image.name }} image
needs:
- check
- test
- test-mini
permissions:
contents: read
id-token: write
strategy:
matrix:
image:
- name: monobase
- name: monobase-runtime
file: runtime.Dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
us-docker.pkg.dev/replicate-production/replicate-us/${{ matrix.image.name }}
tags: |
type=sha
type=raw,value=latest,enable={{is_default_branch}},priority=0
labels: |
org.opencontainers.image.title=${{ matrix.image.name }}
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/1025538909507/locations/global/workloadIdentityPools/github/providers/github-actions
service_account: [email protected]
token_format: access_token
- name: Log into US Artifact Registry
uses: docker/login-action@v3
with:
registry: us-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: '{{defaultContext}}'
file: ${{ matrix.image.file || '' }}
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.image.name }}
cache-to: type=gha,scope=${{ matrix.image.name }},mode=max
build-args: |
COMMIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1