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

Commit 1a77cde

Browse files
author
Sam Lanning
authored
Merge pull request #7 from github/template
Flesh out template directory
2 parents a3d44fe + 36478e7 commit 1a77cde

File tree

11 files changed

+69
-0
lines changed

11 files changed

+69
-0
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,22 @@ jobs:
2222

2323
- name: Build Images & Run Queries
2424
run: cd courses/cpp/ctf-segv && ../../../scripts/test-course-latest.sh
25+
test-courses-template-actual:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v1
30+
31+
- name: Login to docker
32+
run: docker login docker.pkg.github.com -u github-actions -p ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Build Images & Run Queries
35+
run: cd courses/template && ../../scripts/test-course-actual.sh
36+
test-courses-template-latest:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v1
41+
42+
- name: Build Images & Run Queries
43+
run: cd courses/template && ../../scripts/test-course-latest.sh

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ including links to the lines of source code on GitHub when possible:
2121

2222
![](docs/comment_screenshot.png)
2323

24+
<!-- TODO: add README table of contents -->
25+
2426
## Creating your own course
2527

2628
There are two main components to any Learning Lab course for CodeQL that uses
@@ -110,6 +112,7 @@ we recommend structuring your course folder like so:
110112

111113
```
112114
├── answers <─── Model Answers
115+
│ ├── qlpack.yml
113116
│ ├── step-01.ql <─┬─ Answers with expected paths
114117
│ ├── step-02.ql <─┤ (relative to answers/)
115118
│ └── ... <─┘ as specified in config.json

courses/cpp/ctf-segv/image/publish.sh

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

3+
# TODO: move to /scripts/
4+
35
set -e
46
set -x
57

courses/template/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: 'Check queries'
2+
description: 'Check that the queries that have been pushed produce the correct results'
3+
author: 'GitHub <[email protected]>'
4+
runs:
5+
using: 'docker'
6+
image: 'docker.pkg.github.com/<owner>/<repo>/<pkg>'
7+
branding:
8+
icon: 'check-circle'
9+
color: 'purple'

courses/template/answers/qlpack.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: course-template
2+
version: 0.0.0
3+
libraryPathDependencies: codeql-cpp # Update this with appropriate language

courses/template/answers/step-01.ql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import cpp
2+
3+
from Function f
4+
where f.getName() = "getchar"
5+
select f

courses/template/answers/step-02.ql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import cpp
2+
3+
from Function f
4+
where f.getName() = "getchar"
5+
select f

courses/template/image/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM docker.pkg.github.com/github/codeql-learninglab-actions/codeql-learninglab-check:v0.0.6
2+
3+
## Add course config
4+
COPY --chown=codeql:codeql config /home/codeql/config
5+
WORKDIR /home/codeql/config
6+
# Download, unzip and then delete the zip file in one step to reduce image size
7+
RUN wget --quiet https://downloads.lgtm.com/snapshots/cpp/GNU/glibc/bminor_glibc_cpp-srcVersion_333221862ecbebde60dd16e7ca17d26444e62f50-dist_odasa-lgtm-2019-04-08-af06f68-linux64.zip -O snapshot.zip && unzip -qq snapshot.zip && rm -rf snapshot.zip
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"snapshotPath": "bminor_glibc_3332218",
3+
"locationPaths": "https://github.com/<org>/<repo>/blob/<sha>{path}#L{line-start}-L{line-end}",
4+
"expectedResults": {
5+
"step-01.ql": "step-01.csv",
6+
"step-02.ql": "step-02.csv"
7+
}
8+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"f","URL for f","col1"
2+
"getchar","file:///opt/src/libio/getchar.c:33:1:33:7","a getchar function"
3+
"getchar","file:///opt/src/libio/bits/stdio.h:47:1:47:7","a getchar function"
4+
"getchar","file:///opt/src/libio/bits/stdio.h:47:1:47:7","a getchar function"

0 commit comments

Comments
 (0)