diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16a825c..8e27189 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,7 @@ on: branches: [main] jobs: - build: - name: Linting, typechecking and testing code + build-ubuntu: runs-on: ubuntu-latest strategy: @@ -19,18 +18,13 @@ jobs: - name: Check out code uses: actions/checkout@v4 - #- name: Setup cross compilers - # run: sudo apt-get update && sudo apt-get install -y mingw-w64 - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -e .[dev] + run: python -m pip install -e .[dev] - name: Build ops obj files and runner run: bash build.sh @@ -48,11 +42,57 @@ jobs: uses: actions/upload-artifact@v4 if: strategy.job-index == 0 with: - name: object files + name: stencil-object-files path: src/copapy/obj/*.o - name: Upload compiled runner uses: actions/upload-artifact@v4 + if: strategy.job-index == 0 with: - name: runner + name: runner-linux + path: bin/* + + build-windows: + needs: [build-ubuntu] + runs-on: windows-latest + + strategy: + matrix: + python-version: ["3.10"] + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: stencil-object-files + path: src/copapy/obj + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Python dependencies + run: python -m pip install -e .[dev] + + - name: Build ops obj files and runner + run: | + mkdir bin + cl.exe /O2 src\coparun\runmem.c src\coparun\coparun.c src\coparun\mem_man.c /Fe:bin\coparun.exe + + - name: Run tests with pytest + run: pytest + + - name: Type checking with mypy + run: mypy + + #- name: Lint code with flake8 + # run: flake8 + + - name: Upload compiled runner + uses: actions/upload-artifact@v4 + with: + name: runner-win path: bin/* \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2ac0c77..72f2aaf 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ __pycache__ .pytest_cache /tests/autogenerated_*.py *test*.o -test.copapy +/bin/* token.txt /src/copapy/obj/*.o runmem2 diff --git a/build.sh b/build.sh index 1034d3d..cf96fac 100644 --- a/build.sh +++ b/build.sh @@ -5,11 +5,11 @@ python src/copapy/generate_stencils.py SRC=src/copapy/stencils.c DEST=src/copapy/obj mkdir -p $DEST -gcc -c $SRC -o $DEST/stencils_x86_64.o +gcc -c $SRC -O0 -o $DEST/stencils_x86_64_O0.o gcc -c $SRC -O1 -o $DEST/stencils_x86_64_O1.o gcc -c $SRC -O2 -o $DEST/stencils_x86_64_O2.o gcc -c $SRC -O3 -o $DEST/stencils_x86_64_O3.o mkdir bin -p -gcc -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wstrict-overflow -Werror -g src/coparun/runmem.c src/coparun/coparun.c src/coparun/mem_man.c -o bin/coparun +gcc -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wstrict-overflow -Werror -g -O3 src/coparun/runmem.c src/coparun/coparun.c src/coparun/mem_man.c -o bin/coparun #x86_64-w64-mingw32-gcc -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wstrict-overflow -Werror src/runner/runmem2.c -Wall -O3 -o bin/runmem2.exe diff --git a/test.sh b/test.sh index ad65c35..29b7fb2 100644 --- a/test.sh +++ b/test.sh @@ -4,4 +4,4 @@ echo "Compile..." python tests/test_compile.py echo "Run..." echo "-----------------------------------" -./bin/coparun test.copapy \ No newline at end of file +bin/coparun bin/test.copapy \ No newline at end of file diff --git a/tests/test_compile.py b/tests/test_compile.py index f8582fa..7637ee9 100644 --- a/tests/test_compile.py +++ b/tests/test_compile.py @@ -35,8 +35,6 @@ def test_example(): def test_compile(): - print(run_command(['bash', 'build.sh'])) - #c1 = const(1.11) #c2 = const(2.22) @@ -70,9 +68,9 @@ def test_compile(): print('* Data to runner:') il.print() - il.to_file('test.copapy') + il.to_file('bin/test.copapy') - result = run_command(['./bin/coparun', 'test.copapy']) + result = run_command(['bin/coparun', 'bin/test.copapy']) print('* Output from runner:') print(result)