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

Commit 6c76e37

Browse files
committed
Test both actual image version and integration
1 parent f1582fd commit 6c76e37

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:
87
runs-on: ubuntu-latest
98
steps:
109
- name: Checkout
1110
uses: actions/checkout@v1
1211

1312
- name: Build Images & Run Queries
14-
run: cd courses/cpp/ctf-segv && ../../../scripts/test-course.sh
15-
env:
16-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
run: cd courses/cpp/ctf-segv && ../../../scripts/test-course-actual.sh
14+
test-courses-cpp-ctf-segv-latest:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v1
19+
20+
- name: Login to docker
21+
run: docker login docker.pkg.github.com -u github-actions -p ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Build Images & Run Queries
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-only.sh
19+
$DIR/test-course-only.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-only.sh
19+
$DIR/test-course-only.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)