Skip to content

Commit

Permalink
Merge pull request SaptakBhoumik#50 from ClientCrash/add-github-actio…
Browse files Browse the repository at this point in the history
…ns-for-auto-running-tests

Add GitHub actions for auto running tests
  • Loading branch information
SaptakBhoumik authored Oct 8, 2021
2 parents 35af60c + 362fad0 commit 14fd873
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 51 deletions.
68 changes: 40 additions & 28 deletions .github/workflows/build_with_vlang.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Action to build Peregrine and run the tests. Original Version by CLientCrash 7 - Okt - 2021
name: Build Peregrine with Vlang
on: [push,pull_request]
on:
pull_request:
branches:
- "main"
paths-ignore:
- "./github/**"
push:
branches:
- "main"
paths-ignore:
- "./github/**"


jobs:
build-peregrine:
name: Build Peregrine
Expand All @@ -17,29 +28,30 @@ jobs:
run: |
v ./Peregrine/peregrine.v -o peregrine -path='builtin/'
ls
# - uses: actions/upload-artifact@v2
# with:
# name: peregrine-bin
# path: peregrine
# run-tests:
# needs: build-peregrine
# name: run-tests
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
#
# - name: Setup Python
# uses: actions/setup-python@v2
# - name: Download Artifact Compiled peregrine
# uses: actions/download-artifact@v2
# with:
# name: peregrine-bin
# path: ./Peregrine/
# - name: Run tests
# run: |
# sudo apt-get install build-essential
# cd Peregrine
# sudo chmod +x peregrine
# sudo python test_runner.py
# echo TEST DONE
- uses: actions/upload-artifact@v2
with:
name: peregrine-bin
path: peregrine
retention-days: 1
run-tests:
needs: build-peregrine
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Install build-essential
run: sudo apt-get install build-essential
- name: Checkout
uses: actions/checkout@v2
- name: Download Artifact Compiled peregrine
uses: actions/download-artifact@v2
with:
name: peregrine-bin
path: ./Peregrine/
- name: Run tests
run: |
cd Peregrine
ls
pwd
sudo chmod 777 ./peregrine
sudo bash ./run_tests_ci.sh
echo TEST DONE
21 changes: 21 additions & 0 deletions Peregrine/run_tests_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# CI TEST RUNNER SCRIPT @ClientCrash 7 - okt - 2021
cd ./tests/ci
pwd
for file in *
do
echo $file ...
../../peregrine compile $file -emit-c
gcc temp.c -o output.o
if test -f "output.o";then
chmod +x ./output.o
./output.o
rm ./output.o
else
echo "Error: gcc failed"
exit 1
fi



done
exit 0
5 changes: 4 additions & 1 deletion Peregrine/test_runner.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import glob
import os
from sys import platform
from sys import argv
print("NOT THE OFFICIAL CI TEST RUNNER")
print("THIS WILL ONLY RUN ALL TESTS THAT REQUIRE USER INPUT")
ext = ""
sign = "/"
if platform == "win32":
ext = ".exe"
sign = "\\"
file = glob.glob(f'.{sign}tests{sign}*.pe')
file = glob.glob(f'.{sign}tests{sign}non-ci{sign}*.pe')
print("This program will compile the peregrine compiler and run some tests")
print("Compiling the peregrine compiler")
os.system(f"v peregrine.v -o peregrine{ext}")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 0 additions & 22 deletions Peregrine/tests/match_case.pe

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 14fd873

Please sign in to comment.