-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (69 loc) · 2.36 KB
/
Copy pathci.yml
File metadata and controls
82 lines (69 loc) · 2.36 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
# Build verification for pull requests and the default branch.
#
# Both published architectures are built here, so an architecture-specific failure surfaces on
# the pull request rather than during a release. Pushes to the default branch also export the
# BuildKit cache that docker-release.yml consumes.
name: CI
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE_NAME: keeper/gchat-app
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install dependencies from the lockfile
run: npm ci --omit=dev
- name: Offline end-to-end flow
run: npm run test:local
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build both published architectures
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: false
provenance: false
sbom: false
cache-from: type=gha,scope=gchat-app
cache-to: ${{ github.ref == 'refs/heads/main' && 'type=gha,mode=max,scope=gchat-app' || '' }}
- name: Load the amd64 image for a smoke test
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
load: true
push: false
provenance: false
sbom: false
tags: ${{ env.IMAGE_NAME }}:ci
cache-from: type=gha,scope=gchat-app
# The app exposes no HTTP surface, so the container-level assertion is that it starts
# and exits with a clear error when configuration is missing.
- name: Smoke test
run: |
set -euo pipefail
docker run --rm --entrypoint node "${IMAGE_NAME}:ci" \
-e 'console.log(process.arch, process.version)'
out="$(docker run --rm "${IMAGE_NAME}:ci" 2>&1 || true)"
if ! grep -q 'Missing configuration' <<<"$out"; then
echo "::error::Container did not exit with the expected configuration error"
printf '%s\n' "$out"
exit 1
fi
echo "Smoke test OK"