-
Notifications
You must be signed in to change notification settings - Fork 9
65 lines (58 loc) · 2.03 KB
/
test.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
name: test
on:
pull_request:
push:
branches:
- master
jobs:
test:
env:
REGISTRY: ghcr.io
runs-on: ubuntu-latest
name: test
steps:
- name: Checkout
uses: actions/checkout@v2
- name: shellcheck
run: shellcheck builder.sh example/example.sh
- name: Log in to the container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: test build Docker image
env:
IMAGE_NAME: ${{ env.REGISTRY }}/${{ github.repository }}
run: |
docker pull ${IMAGE_NAME} || true
DOCKER_OPTS="--cache-from ${IMAGE_NAME}:latest"
./builder.sh build-docker-image --skip-sudo --docker-opts "$DOCKER_OPTS"
- name: test run command in container using shell command
run: |
OUT=$(echo "pwd" | ./builder.sh shell --skip-sudo)
if [ "$OUT" != "/workdir" ]; then
echo "ERROR (shell): expected pwd in builder container to return /workdir but got $OUT"
exit 1
fi
- name: test run command in container
run: |
OUT=$(./builder.sh run --skip-sudo -o workdir -- sh -c "pwd")
if [ "$OUT" != "/workdir" ]; then
echo "ERROR (run): expected pwd in builder container to return /workdir but got $OUT"
exit 1
fi
- name: test build OpenWrt image
env:
OPENWRT_VERSION: "v21.02.0-rc4"
run: |
mkdir -p workdir
./builder.sh run --skip-sudo\
-o workdir\
--docker-opts "-v=$(pwd)/example:/workdir/example"\
--docker-opts "-e=OPENWRT_VERSION=${OPENWRT_VERSION}" \
-- sh -c "./example/example.sh example/config-rpi"
- uses: actions/upload-artifact@v2
with:
name: example image
path: workdir/openwrt/bin/targets/bcm27xx/bcm2709/