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

Commit 2ac09f6

Browse files
author
Sam Lanning
authored
Merge pull request #6 from github/script-changes
Script changes
2 parents f1582fd + 971cfb3 commit 2ac09f6

File tree

4 files changed

+52
-11
lines changed

4 files changed

+52
-11
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@ name: CI
33
on: [push]
44

55
jobs:
6-
# TODO: make this use any changes in codeql-learninglab-check
7-
test-courses-cpp-ctf-segv:
6+
test-courses-cpp-ctf-segv-actual:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v1
11+
12+
- name: Login to docker
13+
run: docker login docker.pkg.github.com -u github-actions -p ${{ secrets.GITHUB_TOKEN }}
14+
15+
- name: Build Images & Run Queries
16+
run: cd courses/cpp/ctf-segv && ../../../scripts/test-course-actual.sh
17+
test-courses-cpp-ctf-segv-latest:
818
runs-on: ubuntu-latest
919
steps:
1020
- name: Checkout
1121
uses: actions/checkout@v1
1222

1323
- name: Build Images & Run Queries
14-
run: cd courses/cpp/ctf-segv && ../../../scripts/test-course.sh
15-
env:
16-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
run: cd courses/cpp/ctf-segv && ../../../scripts/test-course-latest.sh

scripts/test-course-actual.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#! /bin/bash
2+
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
7+
8+
set -e
9+
set -x
10+
11+
# Extract the expected parent tag from course Dockerfile
12+
PARENT_TAG=$(head -n 1 image/Dockerfile | awk -F ' ' '{print $2}')
13+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
14+
15+
# Build codeql-learninglab-check
16+
docker pull $PARENT_TAG
17+
18+
# Run ./test-course-shared.sh
19+
$DIR/test-course-shared.sh

scripts/test-course-latest.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#! /bin/bash
2+
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
7+
8+
set -e
9+
set -x
10+
11+
# Extract the expected parent tag from course Dockerfile
12+
PARENT_TAG=$(head -n 1 image/Dockerfile | awk -F ' ' '{print $2}')
13+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
14+
15+
# Build codeql-learninglab-check
16+
docker build -t $PARENT_TAG $DIR/../codeql-learninglab-check
17+
18+
# Run ./test-course-shared.sh
19+
$DIR/test-course-shared.sh

scripts/test-course.sh renamed to scripts/test-course-shared.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/bash
22

3-
# Build the codeql-learninglab-check & course image, and run all queries in
3+
# Build the course image, and run all queries in
44
# the course to ensure the expected result
55
#
66
# Should be run with the cwd being the course folder
@@ -9,13 +9,8 @@ set -e
99
set -x
1010

1111
TMP=$(mktemp -d -t ci-XXXXXXXXXX)
12-
# Extract the expected parent tag from course Dockerfile
13-
PARENT_TAG=$(head -n 1 image/Dockerfile | awk -F ' ' '{print $2}')
1412
TAG=ci-test
1513

16-
# Build codeql-learninglab-check
17-
docker build -t $PARENT_TAG ../../../codeql-learninglab-check
18-
1914
# Build course image
2015
docker build -t $TAG image
2116

0 commit comments

Comments
 (0)