-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (106 loc) · 3.73 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Testing
on: pull_request
jobs:
test_hdl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Run tests
run: |
for file in projects/01/*.tst; do echo "$file"; tools/HardwareSimulator.sh "$file"; done;
for file in projects/02/*.tst; do echo "$file"; tools/HardwareSimulator.sh "$file"; done;
for file in projects/03/**/*.tst; do echo "$file"; tools/HardwareSimulator.sh "$file"; done;
for file in projects/04/**/*.tst; do echo "$file"; tools/CPUEmulator.sh "$file"; done;
for file in projects/05/*.tst; do echo "$file"; tools/HardwareSimulator.sh "$file"; done;
- name: Notify success
if: success()
run: echo "Test passed!"
- name: Notify failure
if: failure()
run: echo "Tests failed!"
test_python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run tests
run: |
for file in projects/06/**/*.asm; do echo "$file"; python3 projects/06/assembler/hack_assembler.py "$file"; done;
for file in projects/06/**/*-py.hack; do
echo "Checking $file and ${file/-py.hack/.hack} with PYTHON assembler";
diff --brief "$file" "${file/-py.hack/.hack}"
done;
for file in projects/07/**/**/*.vm; do echo "$file"; python3 projects/07/vm_translator_py/translator.py "$file"; done;
for file in $(find projects/07 -type f -name "*.tst" | grep -v "VME"); do echo "$file"; tools/CPUEmulator.sh "$file"; done;
- name: Notify success
if: success()
run: echo "Test passed!"
- name: Notify failure
if: failure()
run: echo "Tests failed!"
build_go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build Assembler
run: |
cd projects/06/go-assembler
go build -o assembler
- name: Upload assembler binary
uses: actions/upload-artifact@v3
with:
name: assembler
path: projects/06/go-assembler/assembler
- name: Build Translator
run: |
cd projects/07/vm-translator-go
go build -o translator
- name: Upload translator binary
uses: actions/upload-artifact@v3
with:
name: translator
path: projects/07/vm-translator-go/translator
test_go:
needs: build_go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download assembler binary from build_go
uses: actions/download-artifact@v3
with:
name: assembler
- name: Download translator binary from build_go
uses: actions/download-artifact@v3
with:
name: translator
- name: Grant executable permission to Assembler and Translator
run: |
chmod +x assembler
chmod +x translator
- name: Run tests
run: |
for file in projects/06/**/*.asm; do echo "$file"; ./assembler "$file"; done;
for file in projects/06/**/*-go.hack; do
echo "Checking $file and ${file/-go.hack/.hack} with GO assembler";
diff --brief "$file" "${file/-go.hack/.hack}"
done;
for file in projects/07/**/**/*.vm; do echo "$file"; ./translator "$file"; done;
for file in $(find projects/07 -type f -name "*.tst" | grep -v "VME"); do echo "$file"; tools/CPUEmulator.sh "$file"; done;
- name: Notify success
if: success()
run: echo "Test passed!"
- name: Notify failure
if: failure()
run: echo "Tests failed!"