File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030 cs50/cli:amd64
3131 cs50/cli:canary-amd64
3232
33+ - name : Check out tests
34+ uses : actions/checkout@v7
35+
36+ - name : Smoke-test linux/amd64 build
37+ run : |
38+ bash tests/smoke.sh cs50/cli:canary-amd64
39+
3340 - name : Push linux/amd64 build to Docker Hub
3441 if : ${{ github.ref == 'refs/heads/main' }}
3542 run : |
6875 cs50/cli:arm64
6976 cs50/cli:canary-arm64
7077
78+ - name : Check out tests
79+ uses : actions/checkout@v7
80+
81+ - name : Smoke-test linux/arm64 build
82+ run : |
83+ bash tests/smoke.sh cs50/cli:canary-arm64
84+
7185 - name : Push linux/arm64 build to Docker Hub
7286 if : ${{ github.ref == 'refs/heads/main' }}
7387 run : |
Original file line number Diff line number Diff line change @@ -13,7 +13,10 @@ rebuild:
1313 docker build --build-arg VCS_REF=$(shell git rev-parse HEAD) --no-cache --tag $(IMAGE ) .
1414
1515run :
16- docker run --env LANG=$(LANG ) --env LOCAL_WORKSPACE_FOLDER=" $( PWD) " --env WORKDIR=/mnt --interactive --publish-all --rm --security-opt seccomp=unconfined --tty --volume " $( PWD) " :/mnt --volume /var/run/docker.sock:/var/run/docker-host.sock --workdir /mnt cs50/cli bash --login || true
16+ docker run --env LANG=$(LANG ) --env LOCAL_WORKSPACE_FOLDER=" $( PWD) " --env WORKDIR=/mnt --interactive --publish-all --rm --security-opt seccomp=unconfined --tty --volume " $( PWD) " :/mnt --volume /var/run/docker.sock:/var/run/docker-host.sock --workdir /mnt $(IMAGE ) bash --login || true
17+
18+ smoke :
19+ bash tests/smoke.sh $(IMAGE )
1720
1821squash : depends
1922 docker-squash --tag $(IMAGE ) $(IMAGE )
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Smoke-tests a built cs50/cli image. Usage: tests/smoke.sh [IMAGE]
3+ # Each check has a timeout so that a regression that hangs the shell fails loudly.
4+
5+ set -o errexit -o nounset -o pipefail
6+
7+ IMAGE=" ${1:- cs50/ cli} "
8+ run () { timeout 60 docker run --rm " $@ " ; }
9+
10+ echo " Checking $IMAGE "
11+
12+ echo " - non-interactive login shell exits (help50 must not start without a terminal)"
13+ run " $IMAGE " bash --login -c ' echo ok' | grep -qx ok
14+ echo true | run --interactive " $IMAGE " bash --login
15+
16+ echo " - runtime dependencies of help50 are installed"
17+ run " $IMAGE " bash --login -c ' for c in ansi2txt col file script fold; do command -v "$c" > /dev/null || { echo "missing $c" >&2; exit 1; }; done'
18+
19+ echo " - help50 controller is the Bash version, on PATH, and enabled by default"
20+ run " $IMAGE " bash --login -c ' test "$(type -P help50)" = /opt/cs50/bin/help50 && help50 is-enabled && test "$(help50 status)" = stopped' > /dev/null
21+
22+ echo " - wrappers print their message even when stdin is redirected"
23+ run " $IMAGE " bash --login -c ' valgrind python x.py < /dev/null; test $? -eq 1' 2>&1 | grep -q ' does not support Python'
24+
25+ echo " - _fold wraps without a terminal"
26+ run " $IMAGE " bash --login -c ' . /opt/cs50/lib/cli; TERM= _fold "$(printf "a %.0s" {1..100})"' | head -n 1 | grep -qE ' ^.{1,80}$'
27+
28+ echo " OK"
You can’t perform that action at this time.
0 commit comments