Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit 3a1ddda

Browse files
committed
Move course tester script to central location to allow for sharing across courses
1 parent 55c2d45 commit 3a1ddda

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
uses: actions/checkout@v1
1212

1313
- name: Build Images & Run Queries
14-
run: cd courses/cpp/ctf-segv/image && ./test.sh
14+
run: cd courses/cpp/ctf-segv && ../../../scripts/test-course.sh
1515
env:
1616
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

courses/cpp/ctf-segv/image/test.sh renamed to scripts/test-course.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
#! /bin/bash
22

3-
# Test that the queries in ../answers produce the expected results
3+
# Build the codeql-learninglab-check & course image, and run all queries in
4+
# the course to ensure the expected result
5+
#
6+
# Should be run with the cwd being the course folder
47

58
set -e
69
set -x
710

811
TMP=$(mktemp -d -t ci-XXXXXXXXXX)
912
# Extract the expected parent tag from course Dockerfile
10-
PARENT_TAG=$(head -n 1 Dockerfile | awk -F ' ' '{print $2}')
13+
PARENT_TAG=$(head -n 1 image/Dockerfile | awk -F ' ' '{print $2}')
1114
TAG=ci-test
1215

1316
# Build codeql-learninglab-check
14-
docker build -t $PARENT_TAG ../../../../codeql-learninglab-check
17+
docker build -t $PARENT_TAG ../../../codeql-learninglab-check
1518

1619
# Build course image
17-
docker build -t $TAG .
20+
docker build -t $TAG image
1821

1922
# Prepare temporary folder to mount into docker
2023
mkdir -p $TMP
21-
cp -R ../answers $TMP/answers
24+
cp -R answers $TMP/answers
2225
echo "{}" > $TMP/event.json
2326

2427
# Run docker image

0 commit comments

Comments
 (0)