name: CI Pipeline on: push: branches: [main] pull_request: branches: [main] jobs: build_stencils: runs-on: ubuntu-latest container: image: ghcr.io/nonannet/cross_compiler_unix:1 steps: - uses: actions/checkout@v4 - name: Build & test aux functions run: bash tools/test_stencil_aux.sh - name: Build object files run: bash tools/crosscompile.sh - uses: actions/upload-artifact@v4 with: name: stencil-object-files path: src/copapy/obj/*.o build-ubuntu: needs: [build_stencils] runs-on: ubuntu-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: Compile coparun run: | mkdir -p bin gcc -DENABLE_BASIC_LOGGING -O3 -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 - name: Install ARM binutils run: | sudo apt-get download binutils-aarch64-linux-gnu sudo dpkg -i -o Dpkg::Options::="--no-triggers" binutils-aarch64-linux-gnu_*.deb - name: Generate debug asm files if: strategy.job-index == 0 run: | python tools/make_example.py python tools/extract_code.py "bin/test.copapy" "bin/test.copapy.bin" objdump -D -b binary -m i386:x86-64 --adjust-vma=0x1000 bin/test.copapy.bin > bin/test.copapy.asm echo '
test.copapy.asm
' >> $GITHUB_STEP_SUMMARY python tools/clean_asm.py bin/test.copapy.asm >> $GITHUB_STEP_SUMMARY objdump -d -x src/copapy/obj/stencils_x86_64_O3.o > bin/stencils_x86_64_O3.asm echo 'stencils_x86_64_O3.asm
' >> $GITHUB_STEP_SUMMARY python tools/clean_asm.py bin/stencils_x86_64_O3.asm >> $GITHUB_STEP_SUMMARY aarch64-linux-gnu-objdump -d -x src/copapy/obj/stencils_arm64_O3.o > bin/stencils_arm64_O3.asm echo 'stencils_arm64_O3.asm
' >> $GITHUB_STEP_SUMMARY python tools/clean_asm.py bin/stencils_arm64_O3.asm >> $GITHUB_STEP_SUMMARY - name: Run tests with pytest run: pytest - name: Type checking with mypy run: mypy #- name: Lint code with flake8 # run: flake8 - uses: actions/upload-artifact@v4 if: strategy.job-index == 0 with: name: runner-linux path: bin/* build-windows: needs: [build_stencils] 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: Set up MSVC environment uses: microsoft/setup-msbuild@v2 with: vs-version: 'latest' - name: Compile coparun shell: cmd run: | mkdir bin call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 cl /DENABLE_BASIC_LOGGING /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 - uses: actions/upload-artifact@v4 if: strategy.job-index == 0 with: name: runner-win path: bin/* release-stencils: needs: [build_stencils, build-ubuntu, build-windows] runs-on: ubuntu-latest if: github.event_name == 'push' permissions: contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 1 sparse-checkout: | pyproject.toml tools/get_tag.sh - name: Download artifacts uses: actions/download-artifact@v4 with: path: tmp - name: Get version tag name id: version run: bash tools/get_tag.sh - name: Release stencils env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | set -v mkdir -p release cp tmp/stencil-object-files/*.o release/ cp tmp/runner-linux/coparun release/ cp tmp/runner-win/coparun.exe release/ TAG="${{ steps.version.outputs.version }}" if ! gh release view "$TAG" &>/dev/null; then echo "Creating new stencil release $TAG" gh release create "$TAG" release/* \ --prerelease \ --title "$TAG" \ --notes "Automated release stencil for $TAG" else echo "Updating existing release for $TAG" gh release upload "$TAG" release/* --clobber fi