-
Notifications
You must be signed in to change notification settings - Fork 4
97 lines (84 loc) · 3.25 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
name: Proposal tests
# run on all PRs
on:
pull_request:
workflow_dispatch:
merge_group:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
# see https://docs.docker.com/build/ci/github-actions/test-before-push/
test-proposals:
runs-on: ubuntu-latest
# UNTIL https://github.com/Agoric/agoric-3-proposals/issues/2
timeout-minutes: 120
steps:
- name: free up disk space
run: |
# Workaround to provide additional free space for testing.
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
# If this turns out not to be enough, maybe look instead at
# https://github.com/actions/runner-images/issues/2840#issuecomment-1540506686
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "=== After cleanup:"
df -h
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker multiplatform builds
run: |
DEFAULT_PLATFORM=linux/amd64
echo "DEFAULT_PLATFORM=$DEFAULT_PLATFORM" >> $GITHUB_ENV
if ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}; then
echo PLATFORMS=$DEFAULT_PLATFORM >> $GITHUB_ENV
else
echo PLATFORMS=linux/amd64,linux/arm64/v8 >> $GITHUB_ENV
fi
- name: Set up QEMU for cross-platform builds
uses: docker/setup-qemu-action@v3
if: ${{ env.PLATFORMS != env.DEFAULT_PLATFORM }}
- name: Log in to the Container registry
uses: docker/login-action@v3
# see https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# The .ts scripts depend upon this
- run: npm install --global tsx
- name: build test images
run: |
docker info
./buildTestImages.ts
- name: run test images
run: ./runTestImages.ts
# XXX this should be instant for the local platform because all the stages
# were already built in the steps above but it's re-building the last
# stage. This is deemed good enough for now. see
# https://github.com/moby/moby/issues/34715
- name: Build and push images
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ env.PLATFORMS }}
# push to registry on every repo push. A PR #2 will push with tag `pr-2` and `main` will have tag `main`.
# See https://github.com/docker/metadata-action?tab=readme-ov-file#basic.
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}