Repository navigation
116 lines (100 loc) · 4.17 KB
/
Copy pathdocker.yml
File metadata and controls
116 lines (100 loc) · 4.17 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
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: Docker build CI
run-name: Docker build CI triggered from @${{ github.actor }} of ${{ github.head_ref }}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
merge_group:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
jobs:
# Detect whether anything other than the changelog changed. code_changed is
# "any file other than CHANGELOG.md or changelog/**", so a changelog-only PR
# leaves it false and skips the build below.
changes:
uses: ./.github/workflows/_detect-changes.yml
secrets: inherit
docker:
name: Docker build
runs-on: ocl-16cpu-64ram-dind-500gi
timeout-minutes: 60
needs: changes
# Skip the build for changelog-only PRs. merge_group and manual runs always
# build, since detect-changes has no PR diff base for those events.
if: github.event_name != 'pull_request' || needs.changes.outputs.code_changed == 'true'
steps:
- name: Checkout
uses: actions/checkout@v6
- id: submods
uses: ./.github/actions/init-submodules
with:
client-id: ${{ vars.NITRO_CI_APP_CLIENT_ID }}
app-private-key: ${{ secrets.NITRO_CI_APP_PRIVATE_KEY }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
with:
buildkitd-config-inline: |
[registry."docker.io"]
mirrors = ["registry-cache.registry-cache.svc.cluster.local:5000"]
[registry."registry-cache.registry-cache.svc.cluster.local:5000"]
http = true
- name: Build nitro-node-dev docker
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
with:
target: nitro-node-dev
load: true
context: .
tags: nitro-node-dev:latest
secrets: |
gh_token=${{ steps.submods.outputs.token }}
- name: Start background nitro-testnode
shell: bash
run: |
# Reuse the image we just built instead of rebuilding inside test-node.bash
docker image inspect nitro-node-dev:latest --format '{{.Id}} {{.Architecture}}'
cd nitro-testnode
./test-node.bash --init --dev --no-build-dev-nitro > /tmp/testnode.log 2>&1 &
echo "$!" > /tmp/testnode.pid
- name: Wait for rpc to come up
shell: bash
run: ${{ github.workspace }}/.github/workflows/waitForNitro.sh
- name: Dump testnode logs
if: always()
shell: bash
run: |
if [ -f /tmp/testnode.log ]; then
echo "=== Last 200 lines of testnode.log ==="
tail -200 /tmp/testnode.log
fi
# The testnode script launched above (output in /tmp/testnode.log) only relays
# docker compose's progress lines, so a container that dies on startup shows up
# as a bare "exited (1)" with no reason. Dump container states and stderr too.
- name: Dump testnode container logs
if: failure() || cancelled()
shell: bash
run: |
cd nitro-testnode
echo "=== docker compose ps ==="
docker compose ps --all || true
echo "=== docker compose logs (last 200 lines per container) ==="
docker compose logs --no-color --timestamps --tail 200 || true
- name: Print WAVM module root
id: module-root
shell: bash
run: |
# Unfortunately, `docker cp` seems to always result in a "permission denied"
# We work around this by piping a tarball through stdout
docker run --rm --entrypoint tar nitro-node-dev:latest -cf - target/machines/latest | tar xf -
module_root="$(cat "target/machines/latest/module-root.txt")"
echo "module-root=$module_root" >> "$GITHUB_OUTPUT"
echo -e "\x1b[1;34mWAVM module root:\x1b[0m $module_root"
- name: Upload WAVM machine as artifact
uses: actions/upload-artifact@v6
with:
name: wavm-machine-${{ steps.module-root.outputs.module-root }}
path: target/machines/latest/*
if-no-files-found: error