From 29e7e59ffb69ad47ff6a27c58213d19b8d1ef63e Mon Sep 17 00:00:00 2001 From: Erick Ahmed Date: Wed, 12 Nov 2025 23:10:04 +0100 Subject: [PATCH] ci: add CI pipeline for FFI code --- .github/workflows/ffi-unit-test.yml | 67 ++++++++++++++++++++++++++++ .github/workflows/occt-unit-test.yml | 17 +++++++ 2 files changed, 84 insertions(+) create mode 100644 .github/workflows/ffi-unit-test.yml diff --git a/.github/workflows/ffi-unit-test.yml b/.github/workflows/ffi-unit-test.yml new file mode 100644 index 0000000..792225a --- /dev/null +++ b/.github/workflows/ffi-unit-test.yml @@ -0,0 +1,67 @@ +name: FFI CI + +on: + workflow_run: + workflows: ["OCCT CI"] + types: + - completed + push: + branches: [master, dev-occt**, dev-ffi**] + paths: + - "src/ffi/**" + - "test/ffi/**" + - "ci/scripts/ffi.sh" + - "ci/ffi.Dockerfile" + - "Cargo.toml" + - "Cargo.lock" + - "build.rs" + pull_request: + branches: [master, dev-occt, dev-ffi] + paths: + - "src/ffi/**" + - "test/ffi/**" + - "ci/scripts/ffi.sh" + - "Cargo.toml" + - "Cargo.lock" + - "build.rs" + +jobs: + build-ffi: + name: Build FFI + runs-on: ubuntu-24.04 + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name != 'workflow_run' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Pull OCCT builder image + run: | + docker pull ghcr.io/${{ github.repository }}/occt-builder:latest || echo "OCCT image not found, will build from source" + + - name: Make script executable + run: chmod +x ./ci/scripts/ffi.sh + + - name: Build FFI and run tests + run: ./ci/scripts/ffi.sh --tests + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: ffi-test-results + path: | + target/debug/ + **/test-results/ + retention-days: 7 diff --git a/.github/workflows/occt-unit-test.yml b/.github/workflows/occt-unit-test.yml index 680a678..20c33e5 100644 --- a/.github/workflows/occt-unit-test.yml +++ b/.github/workflows/occt-unit-test.yml @@ -30,8 +30,25 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Make script executable run: chmod +x ./ci/scripts/occt.sh - name: Build OCCT and run tests run: ./ci/scripts/occt.sh --unit-testing + + - name: Tag and push OCCT image + if: github.event_name != 'pull_request' + run: | + docker tag occt-builder:latest ghcr.io/${{ github.repository }}/occt-builder:latest + docker push ghcr.io/${{ github.repository }}/occt-builder:latest