-
Notifications
You must be signed in to change notification settings - Fork 3
77 lines (67 loc) · 2.77 KB
/
Copy pathdocker.yml
File metadata and controls
77 lines (67 loc) · 2.77 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
name: Docker
# Publish container images of the EigenScript runtime to GitHub Container
# Registry. Two triggers:
# - push to main → tag `:edge` (rolling pre-release)
# - tag v* → tags `:X.Y.Z`, `:X.Y`, and `:latest`
#
# Multi-arch: linux/amd64 (JIT) and linux/arm64 (interpreter-only;
# src/jit.c is __x86_64__-gated). arm64 builds via QEMU emulation, so
# this job is slower than the amd64-only original.
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # required by docker/login-action -> ghcr.io push
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
- name: Set up Docker buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Log in to GitHub Container Registry
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract image metadata
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ghcr.io/${{ github.repository_owner }}/eigenscript
tags: |
type=raw,value=edge,enable=${{ github.ref == 'refs/heads/main' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
- name: Build and push
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: true
sbom: true
- name: Smoke-test the image
if: github.event_name != 'pull_request'
run: |
IMAGE="$(echo '${{ steps.meta.outputs.tags }}' | head -1)"
echo 'print of "docker-ok"' > /tmp/hello.eigs
for plat in linux/amd64 linux/arm64; do
echo "=== Testing $IMAGE ($plat) ==="
docker run --rm --platform "$plat" "$IMAGE" --version
OUT=$(docker run --rm --platform "$plat" -v /tmp:/work -w /work "$IMAGE" hello.eigs)
test "$OUT" = "docker-ok" || { echo "smoke test failed on $plat: $OUT"; exit 1; }
echo "smoke test passed on $plat"
done