From 05a3f89a818b4a42e8c194358a31ecc995d5953b Mon Sep 17 00:00:00 2001 From: DanielGavin Date: Thu, 11 Jul 2024 21:08:10 +0200 Subject: CI should use ci.bat/sh instead --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/nightly.yml | 10 +++++----- build.bat | 12 +----------- build.sh | 32 -------------------------------- ci.bat | 16 ++++++++++++++++ ci.sh | 39 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 52 deletions(-) create mode 100644 ci.bat create mode 100644 ci.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d4132a..348a73c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,10 +29,10 @@ jobs: run: | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat cd Odin - ./build.bat 1 + ./ci.bat 1 - name: Build ols shell: cmd - run: ./build.bat CI + run: ./ci.bat CI linux: strategy: matrix: @@ -53,7 +53,7 @@ jobs: git clone --depth 1 https://github.com/odin-lang/Odin cd Odin && ./build_odin.sh release - name: Build ols - run: ./build.sh CI + run: ./ci.sh CI macos: strategy: @@ -75,4 +75,4 @@ jobs: git clone --depth 1 https://github.com/odin-lang/Odin cd Odin && ./build_odin.sh release - name: Build ols - run: ./build.sh CI + run: ./ci.sh CI diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0f1aac0..344e2f8 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -24,7 +24,7 @@ jobs: cd Odin ./build_odin.sh release - name: Build ols - run: ./build.sh CI_NO_TESTS -target:darwin_arm64 -extra-linker-flags:"--target=arm64-apple-macos" + run: ./ci.sh CI_NO_TESTS -target:darwin_arm64 -extra-linker-flags:"--target=arm64-apple-macos" - name: Move to Dist run: | mkdir dist @@ -54,7 +54,7 @@ jobs: cd Odin make release - name: Build ols - run: ./build.sh CI + run: ./ci.sh CI - name: Move to Dist run: | mkdir dist @@ -84,7 +84,7 @@ jobs: cd Odin ./build_odin.sh release - name: Build ols - run: ./build.sh CI + run: ./ci.sh CI - name: Move to Dist run: | mkdir dist @@ -109,10 +109,10 @@ jobs: run: | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat cd Odin - ./build.bat 1 + ./ci.bat 1 - name: Build ols shell: cmd - run: ./build.bat CI + run: ./ci.bat CI - name: Move to Dist shell: cmd run: | diff --git a/build.bat b/build.bat index b8d2c0b..ce3da49 100644 --- a/build.bat +++ b/build.bat @@ -1,17 +1,7 @@ @echo off setlocal enabledelayedexpansion -if "%1" == "CI" ( - set "PATH=%cd%\Odin;!PATH!" - - rem odin test tests -collection:src=src -define:ODIN_TEST_THREADS=1 - rem if %errorlevel% neq 0 exit /b 1 - - odin build src\ -collection:src=src -out:ols.exe -o:speed - - call "tools/odinfmt/tests.bat" - if %errorlevel% neq 0 exit /b 1 -) else if "%1" == "test" ( +if "%1" == "test" ( odin test tests -collection:src=src -debug -define:ODIN_TEST_THREADS=1 ) else if "%1" == "single_test" ( odin test tests -collection:src=src -define:ODIN_TEST_NAMES=%2 -debug diff --git a/build.sh b/build.sh index 611b45d..a354db5 100755 --- a/build.sh +++ b/build.sh @@ -1,38 +1,6 @@ #!/usr/bin/env bash -if [[ $1 == "CI" ]] -then - shift - - export PATH=$PATH:$PWD/Odin - #BUG in odin test, it makes the executable with the same name as a folder and gets confused. - cd tests - - odin test ../tests -collection:src=../src -o:speed $@ -define:ODIN_TEST_THREADS=1 - - if ([ $? -ne 0 ]) - then - echo "Ols tests failed" - exit 1 - fi - - cd .. - - tools/odinfmt/tests.sh - - if ([ $? -ne 0 ]) - then - echo "Odinfmt tests failed" - exit 1 - fi -fi -if [[ $1 == "CI_NO_TESTS" ]] -then - shift - - export PATH=$PATH:$PWD/Odin -fi if [[ $1 == "single_test" ]] then shift diff --git a/ci.bat b/ci.bat new file mode 100644 index 0000000..c8b3830 --- /dev/null +++ b/ci.bat @@ -0,0 +1,16 @@ +@echo off + +setlocal enabledelayedexpansion +if "%1" == "CI" ( + set "PATH=%cd%\Odin;!PATH!" + + rem odin test tests -collection:src=src -define:ODIN_TEST_THREADS=1 + rem if %errorlevel% neq 0 exit /b 1 + + odin build src\ -collection:src=src -out:ols.exe -o:speed + + call "tools/odinfmt/tests.bat" + if %errorlevel% neq 0 exit /b 1 +) else ( + odin build src\ -collection:src=src -out:ols.exe -o:speed -no-bounds-check +) \ No newline at end of file diff --git a/ci.sh b/ci.sh new file mode 100644 index 0000000..c07b1a6 --- /dev/null +++ b/ci.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + + +if [[ $1 == "CI" ]] +then + shift + + export PATH=$PATH:$PWD/Odin + #BUG in odin test, it makes the executable with the same name as a folder and gets confused. + cd tests + + odin test ../tests -collection:src=../src -o:speed $@ -define:ODIN_TEST_THREADS=1 + + if ([ $? -ne 0 ]) + then + echo "Ols tests failed" + exit 1 + fi + + cd .. + + tools/odinfmt/tests.sh + + if ([ $? -ne 0 ]) + then + echo "Odinfmt tests failed" + exit 1 + fi +fi + +if [[ $1 == "CI_NO_TESTS" ]] +then + shift + + export PATH=$PATH:$PWD/Odin +fi + + +odin build src/ -show-timings -collection:src=src -out:ols -no-bounds-check -o:speed $@ -- cgit v1.2.3