-
Notifications
You must be signed in to change notification settings - Fork 23
80 lines (76 loc) · 2.65 KB
/
release.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
name: Build Docker Image
# Cancel the current workflow when new commit pushed
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
# Release on any git tag
on:
push:
tags: ['*']
paths:
- .github/workflows/release.yml
- nix/t1/release/docker-image.nix
jobs:
build:
runs-on: [self-hosted, linux, nixos]
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
fail-fast: false
matrix:
config:
- blastoise
top:
- t1emu
- t1rocketemu
steps:
- uses: actions/checkout@v4
with:
# Checkout the triggered tag name
ref: ${{ github.ref_name }}
- name: Build docker image file
env:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
run: |
set -o pipefail
set -o errexit
export PATH="$(nix build '.#skopeo.out' --print-out-paths --no-link)/bin:$PATH"
export PATH="$(nix build '.#gzip.out' --print-out-paths --no-link)/bin:$PATH"
# skopeo need /run/containers to write auth.json file, lets workaround this behavior.
export REGISTRY_AUTH_FILE=$(mktemp -d)/auth.json
closure="$(nix build -L '.#t1.${{ matrix.config }}.${{ matrix.top }}.docker-image' --no-link --print-out-paths --impure)"
skopeo --insecure-policy login --username "$username" --password "$password" "$registry"
"$closure" \
| gzip --fast \
| skopeo --insecure-policy copy docker-archive:/dev/stdin \
docker://"$registry"/chipsalliance/t1-${{ matrix.config }}-${{ matrix.top }}:latest
test:
runs-on: ubuntu-latest
needs: [build]
strategy:
fail-fast: false
matrix:
config:
- blastoise
top:
- t1emu
- t1rocketemu
steps:
- name: Pull and Run tests
env:
registry: ghcr.io
run: |
set -o pipefail
set -o errexit
docker pull "$registry"/chipsalliance/t1-${{ matrix.config }}-${{ matrix.top }}:latest
docker run -d --name t1 --rm "$registry"/chipsalliance/t1-${{ matrix.config }}-${{ matrix.top }}:latest /bin/bash -c "sleep inf"
dexec() {
docker exec t1 /bin/bash -c "$@"
}
dexec 'cd examples/intrinsic.matmul && t1-cc -T /workspace/share/t1.ld matmul.c /workspace/share/main.S -o matmul.elf'
dexec '${{ matrix.top }}-verilated-simulator +t1_elf_file=/workspace/examples/intrinsic.matmul/matmul.elf'