-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (90 loc) · 3.31 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
name: ci
on: [push]
jobs:
set-vars:
runs-on: ubuntu-latest
outputs:
ref-b64: ${{ steps.vars.outputs.ref-b64 }}
tmp-dir: ${{ steps.vars.outputs.tmp-dir }}
host-arch: ${{ steps.vars.outputs.host-arch }}
host-os: ${{ steps.vars.outputs.host-os }}
steps:
- id: vars
run: |
set -xv
set -o errexit
set -o pipefail
{
echo "ref-b64=$(echo "${{ github.ref }}" | base64 --wrap 0 | sed -e 's/[-=/]/_/g')"
echo "tmp-dir=$(mktemp -d)"
echo "host-arch=$(docker version --format '{{ (index .Server.Components 0).Details.Arch }}')"
echo "host-os=$(docker version --format '{{ (index .Server.Components 0).Details.Os }}')"
} >> "$GITHUB_OUTPUT"
bazel:
if: false && (github.actor == 'dependabot[bot]' || github.actor == github.repository_owner)
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Set cache key
id: cache-key
run: |
{
echo "file_hashes=${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }}"
} >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: |
~/.cache
key: ${{ runner.os }}-bazel-${{ steps.cache-key.outputs.file_hashes }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-bazel-${{ steps.cache-key.outputs.file_hashes }}-
${{ runner.os }}-bazel-
- run: EMBED_LABEL="git-${{ github.sha }}" scripts/bazel.sh
- run: EMBED_LABEL="latest" scripts/bazel.sh
if: github.ref == 'refs/heads/main'
build-images:
if: github.actor == 'dependabot[bot]' || github.actor == github.repository_owner
permissions:
contents: read
packages: write
needs: [set-vars]
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux]
arch: [amd64]
# arch: [amd64, arm64]
steps:
# - name: Free up space
# run: sudo rm -fr /opt/ghc /usr/share/dotnet /usr/local/lib/android || true
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: scripts/build_test_push.sh ${{ github.sha }} ${{ needs.set-vars.outputs.ref-b64 }} ${{ matrix.os }} ${{ matrix.arch }} ${{ github.ref }} ${{ github.run_number }} ${{ needs.set-vars.outputs.host-arch }} ${{ needs.set-vars.outputs.host-os }}
build-manifests:
if: github.actor == 'dependabot[bot]' || github.actor == github.repository_owner
permissions:
contents: read
packages: write
needs: [build-images]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: scripts/publish_manifests.sh ${{ github.sha }} ${{ github.ref }} ${{ github.run_number }}