Skip to content

Commit 56b00c8

Browse files
1ethanhansenee7
andauthored
feat: Add CI (#10)
* feat: first go at CI * feat: adding steps to github workflow * fix: actually remove temp * fix: windows does not have bash * fix: specify bash on windows Apply suggestions from code review Co-authored-by: ee7 <45465154+ee7@users.noreply.github.com> * fix: Apply suggestions from code review security and shellcheck considerations Co-authored-by: ee7 <45465154+ee7@users.noreply.github.com> Co-authored-by: ee7 <45465154+ee7@users.noreply.github.com>
1 parent 548cadc commit 56b00c8

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Requires scripts:
1414
# - bin/test
1515

16-
name: <track> / Test
16+
name: V / Test
1717

1818
on:
1919
push:
@@ -23,17 +23,22 @@ on:
2323

2424
jobs:
2525
ci:
26-
runs-on: <image-name>
26+
name: V exercise test on ${{ matrix.os }}
27+
runs-on: ${{ matrix.os }}
28+
strategy:
29+
matrix:
30+
os: [ubuntu-latest, windows-latest, macOS-latest]
2731

2832
steps:
2933
- name: Checkout repository
3034
uses: actions/checkout@v2
3135

32-
- name: Use <setup tooling>
33-
uses: <action to setup tooling>
36+
- name: Setup Vlang
37+
uses: vlang/setup-v@f0b3323984699c80284901a9ffd8d3e2997f22b2
3438

35-
- name: Install project dependencies
36-
run: <install dependencies>
39+
# - name: Install project dependencies
40+
# run: <install dependencies>
3741

3842
- name: Run tests for all exercises
43+
shell: bash
3944
run: bin/test

bin/test

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,18 @@ done
2929
# Verify the Practice Exercises
3030
for practice_exercise_dir in ./exercises/practice/*/; do
3131
if [ -d $practice_exercise_dir ]; then
32-
echo "Checking $(basename "${practice_exercise_dir}") exercise..."
32+
stub="$(basename "${practice_exercise_dir}" | tr - _)"
33+
echo "Checking ${stub} exercise..."
3334
# TODO: run command to verify that the example solution passes the tests
35+
# create new tmp directory
36+
mkdir temp
37+
# copy and rename example.v file
38+
cp "${practice_exercise_dir}.meta/example.v" "temp/${stub}.v"
39+
# copy test v file
40+
cp "${practice_exercise_dir}run_test.v" "temp/run_test.v"
41+
# run tests in tmp directory
42+
v run temp/run_test.v
43+
# clear tmp directory
44+
rm -rf ./temp
3445
fi
3546
done
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module main
22

33
fn test_hello(){
4-
assert hello() == "Hello, world!"
4+
assert hello() == "Hello, World!"
55
}

0 commit comments

Comments
 (0)