1- name : Build
1+ name : Continuous Integration
22
33on :
44 push :
4343 CC : ${{ matrix.compiler.cc }}
4444 CXX : ${{ matrix.compiler.cxx }}
4545 run : |
46- thread_count=` sudo cat /proc/cpuinfo| grep "processor"| wc -l`
46+ echo "THREAD_COUNT=$( sudo cat /proc/cpuinfo| grep "processor"| wc -l)" >> $GITHUB_ENV
4747 sudo mkdir -p thirdparty/antlr && cd thirdparty/antlr
4848 sudo wget https://www.antlr.org/download/antlr-4.8-complete.jar
4949 sudo wget -O ${{ runner.temp }}/antlr4-src.zip https://www.antlr.org/download/antlr4-cpp-runtime-4.8-source.zip
5252 sudo mkdir build && cd build
5353 sudo mkdir -p ${{ github.workspace }}/thirdparty/antlr-runtime
5454 sudo cmake .. -DANTLR4_INSTALL=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/thirdparty/antlr-runtime
55- sudo cmake --build . --target install -- -j $thread_count
55+ sudo cmake --build . --target install -- -j $THREAD_COUNT
5656 - name : Move Antlr Runtime into /usr/local
5757 run : |
5858 cd ${{ github.workspace }}/thirdparty/antlr-runtime
@@ -63,24 +63,27 @@ jobs:
6363 CC : ${{ matrix.compiler.cc }}
6464 CXX : ${{ matrix.compiler.cxx }}
6565 run : |
66- thread_count=`sudo cat /proc/cpuinfo| grep "processor"| wc -l`
6766 sudo mkdir cmake-build-debug cmake-build-release
6867 cd cmake-build-debug
6968 sudo cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
70- sudo cmake --build . --target staticscript document -- -j $thread_count
71- for file in ../examples/*.ss
72- do
73- sudo ./lib/staticscript $file --emit-llvm -o ss-ir.ll
74- sudo ./lib/staticscript $file -o ss-obj.o
75- done
69+ sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
7670 cd ../cmake-build-release
7771 sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
78- sudo cmake --build . --target staticscript document -- -j $thread_count
79- for file in ../examples/*.ss
80- do
81- sudo ./lib/staticscript $file --emit-llvm -o ss-ir.ll
82- sudo ./lib/staticscript $file -o ss-obj.o
83- done
72+ sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
73+ - name : Upload Debug Executable File
74+ uses : actions/upload-artifact@v2
75+ with :
76+ name : staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-debug
77+ path : |
78+ cmake-build-debug/staticscript
79+ cmake-build-debug/lib/*.bc
80+ - name : Upload Release Executable File
81+ uses : actions/upload-artifact@v2
82+ with :
83+ name : staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-release
84+ path : |
85+ cmake-build-release/staticscript
86+ cmake-build-release/lib/*.bc
8487
8588 build_on_macos :
8689 name : Build on macOS
@@ -101,21 +104,73 @@ jobs:
101104 CC : ${{ matrix.compiler.cc }}
102105 CXX : ${{ matrix.compiler.cxx }}
103106 run : |
104- thread_count=` sudo sysctl -n machdep.cpu.thread_count`
107+ echo "THREAD_COUNT=$( sudo sysctl -n machdep.cpu.thread_count)" >> $GITHUB_ENV
105108 sudo mkdir cmake-build-debug cmake-build-release
106109 cd cmake-build-debug
107110 sudo cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
108- sudo cmake --build . --target staticscript document -- -j $thread_count
109- for file in ../examples/*.ss
110- do
111- sudo ./lib/staticscript $file --emit-llvm -o ss-ir.ll
112- sudo ./lib/staticscript $file -o ss-obj.o
113- done
111+ sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
114112 cd ../cmake-build-release
115113 sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
116- sudo cmake --build . --target staticscript document -- -j $thread_count
117- for file in ../examples/*.ss
114+ sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
115+ - name : Upload Debug Executable File
116+ uses : actions/upload-artifact@v2
117+ with :
118+ name : staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-debug
119+ path : |
120+ cmake-build-debug/staticscript
121+ cmake-build-debug/lib/*.bc
122+ - name : Upload Release Executable File
123+ uses : actions/upload-artifact@v2
124+ with :
125+ name : staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-release
126+ path : |
127+ cmake-build-release/staticscript
128+ cmake-build-release/lib/*.bc
129+
130+ test :
131+ name : Test
132+ needs : [ build_on_linux, build_on_macos ]
133+ runs-on : ${{ matrix.os }}
134+ strategy :
135+ matrix :
136+ os : [ ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11.0 ]
137+ compiler :
138+ - { cc: gcc, cxx: g++ }
139+ - { cc: clang, cxx: clang++ }
140+ steps :
141+ - name : Fetch Codebase
142+ uses : actions/checkout@v2
143+ - name : Download Debug Executable File
144+ uses : actions/download-artifact@v2
145+ with :
146+ name : staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-debug
147+ path : executables/debug
148+ - name : Download Release Executable File
149+ uses : actions/download-artifact@v2
150+ with :
151+ name : staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-release
152+ path : executables/release
153+ - name : Test Exmaple Code on Debug Compiler
154+ working-directory : executables/debug
155+ run : |
156+ chmod +x ./staticscript
157+ for file in ${{ github.workspace }}/tests/*.ss
158+ do
159+ base=$(basename $file)
160+ sudo ./staticscript $file -L lib --emit-llvm -o $base.ll
161+ sudo ./staticscript $file -L lib -o $base.o
162+ sudo clang $base.o -lm -o $base.exe
163+ sudo ./$base.exe
164+ done
165+ - name : Test Exmaple Code on Release Compiler
166+ working-directory : executables/release
167+ run : |
168+ chmod +x ./staticscript
169+ for file in ${{ github.workspace }}/tests/*.ss
118170 do
119- sudo ./lib/staticscript $file --emit-llvm -o ss-ir.ll
120- sudo ./lib/staticscript $file -o ss-obj.o
171+ base=$(basename $file)
172+ sudo ./staticscript $file -L lib --emit-llvm -o $base.ll
173+ sudo ./staticscript $file -L lib -o $base.o
174+ sudo clang $base.o -lm -o $base.exe
175+ sudo ./$base.exe
121176 done
0 commit comments