ci for windows fixed

This commit is contained in:
Nicolas 2025-10-04 23:01:44 +02:00
parent 95a7d429ef
commit d1e4f767cb
5 changed files with 56 additions and 18 deletions

View File

@ -7,8 +7,7 @@ on:
branches: [main] branches: [main]
jobs: jobs:
build: build-ubuntu:
name: Linting, typechecking and testing code
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@ -19,18 +18,13 @@ jobs:
- name: Check out code - name: Check out code
uses: actions/checkout@v4 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 }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install Python dependencies - name: Install Python dependencies
run: | run: python -m pip install -e .[dev]
python -m pip install --upgrade pip
python -m pip install -e .[dev]
- name: Build ops obj files and runner - name: Build ops obj files and runner
run: bash build.sh run: bash build.sh
@ -48,11 +42,57 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: strategy.job-index == 0 if: strategy.job-index == 0
with: with:
name: object files name: stencil-object-files
path: src/copapy/obj/*.o path: src/copapy/obj/*.o
- name: Upload compiled runner - name: Upload compiled runner
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: strategy.job-index == 0
with: 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/* path: bin/*

2
.gitignore vendored
View File

@ -10,7 +10,7 @@ __pycache__
.pytest_cache .pytest_cache
/tests/autogenerated_*.py /tests/autogenerated_*.py
*test*.o *test*.o
test.copapy /bin/*
token.txt token.txt
/src/copapy/obj/*.o /src/copapy/obj/*.o
runmem2 runmem2

View File

@ -5,11 +5,11 @@ python src/copapy/generate_stencils.py
SRC=src/copapy/stencils.c SRC=src/copapy/stencils.c
DEST=src/copapy/obj DEST=src/copapy/obj
mkdir -p $DEST 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 -O1 -o $DEST/stencils_x86_64_O1.o
gcc -c $SRC -O2 -o $DEST/stencils_x86_64_O2.o gcc -c $SRC -O2 -o $DEST/stencils_x86_64_O2.o
gcc -c $SRC -O3 -o $DEST/stencils_x86_64_O3.o gcc -c $SRC -O3 -o $DEST/stencils_x86_64_O3.o
mkdir bin -p 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 #x86_64-w64-mingw32-gcc -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wstrict-overflow -Werror src/runner/runmem2.c -Wall -O3 -o bin/runmem2.exe

View File

@ -4,4 +4,4 @@ echo "Compile..."
python tests/test_compile.py python tests/test_compile.py
echo "Run..." echo "Run..."
echo "-----------------------------------" echo "-----------------------------------"
./bin/coparun test.copapy bin/coparun bin/test.copapy

View File

@ -35,8 +35,6 @@ def test_example():
def test_compile(): def test_compile():
print(run_command(['bash', 'build.sh']))
#c1 = const(1.11) #c1 = const(1.11)
#c2 = const(2.22) #c2 = const(2.22)
@ -70,9 +68,9 @@ def test_compile():
print('* Data to runner:') print('* Data to runner:')
il.print() 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('* Output from runner:')
print(result) print(result)