Move build from test.sh to action

This commit is contained in:
Paul Campbell 2022-01-01 16:00:09 +00:00
parent aa01b6f22d
commit b63569c3a2
2 changed files with 13 additions and 21 deletions

View file

@ -13,7 +13,12 @@ jobs:
- name: Setup Zig - name: Setup Zig
uses: goto-bus-stop/setup-zig@v1.3.0 uses: goto-bus-stop/setup-zig@v1.3.0
with: with:
version: master version: "0.9.0"
- uses: nektro/actions-setup-zigmod - run: zig version
- name: Tests - run: zig env
run: ./test.sh - uses: nektro/actions-setup-zigmod@v1
- run: zigmod ci
- run: zig build test
- run: zig build
- run: cp zig-out/bin/skip .
- run: ./test.sh

21
test.sh
View file

@ -2,19 +2,6 @@
set -e set -e
echo "zigmod"
zigmod ci
echo "Unit tests..."
zig build test
echo "Build..."
zig build
echo -n "Created: "
ls zig-out/bin/skip
export PATH=$PWD/zig-out/bin/:$PATH
echo "> skip a line when reading from stdin" echo "> skip a line when reading from stdin"
INPUT=$(cat<<EOF INPUT=$(cat<<EOF
line 1 line 1
@ -22,7 +9,7 @@ line 2
EOF EOF
) )
echo "line 2" > test.expect echo "line 2" > test.expect
echo "$INPUT" | skip 1 > test.out echo "$INPUT" | ./skip 1 > test.out
diff --brief test.expect test.out diff --brief test.expect test.out
echo "> skip a line when reading from a file" echo "> skip a line when reading from a file"
@ -31,7 +18,7 @@ line 1
line 2 line 2
EOF EOF
echo "line 2" > test.expect echo "line 2" > test.expect
skip 1 test.in > test.out ./skip 1 test.in > test.out
diff --brief test.expect test.out diff --brief test.expect test.out
echo "> skip until 2 matching lines seen" echo "> skip until 2 matching lines seen"
@ -42,7 +29,7 @@ alpha
gamma gamma
EOF EOF
echo "gamma" > test.expect echo "gamma" > test.expect
skip 2 test.in --line alpha > test.out ./skip 2 test.in --line alpha > test.out
diff --brief test.expect test.out diff --brief test.expect test.out
echo "> skip lines until 2 tokens seen" echo "> skip lines until 2 tokens seen"
@ -62,7 +49,7 @@ quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea laboris nisi ut aliquip ex ea
commodo consequat. commodo consequat.
EOF EOF
skip 2 test.in --token dolor > test.out ./skip 2 test.in --token dolor > test.out
diff --brief test.expect test.out diff --brief test.expect test.out
rm test.in test.out test.expect rm test.in test.out test.expect