|
| 1 | +name: concrete-rust tests linux-cpu |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + paths: |
| 7 | + - .github/workflows/concrete_rust_tests_linux.yml |
| 8 | + - frontends/concrete-rust/** |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - 'main' |
| 12 | + - 'release/*' |
| 13 | + |
| 14 | +env: |
| 15 | + DOCKER_IMAGE_TEST: ghcr.io/zama-ai/concrete/compiler-ci |
| 16 | + ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 17 | + SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} |
| 18 | + SLACK_USERNAME: ${{ secrets.BOT_USERNAME }} |
| 19 | + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
| 20 | + |
| 21 | +concurrency: |
| 22 | + group: concrete_rust_tests_linux_${{ github.ref }} |
| 23 | + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| 24 | + |
| 25 | +jobs: |
| 26 | + setup-instance: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + outputs: |
| 29 | + runner-name: ${{ steps.start-instance.outputs.label }} |
| 30 | + steps: |
| 31 | + - name: Start instance |
| 32 | + id: start-instance |
| 33 | + uses: zama-ai/slab-github-runner@f26b8d611b2e695158fb0a6980834f0612f65ef8 # v1.4.0 |
| 34 | + with: |
| 35 | + mode: start |
| 36 | + github-token: ${{ secrets.SLAB_ACTION_TOKEN }} |
| 37 | + slab-url: ${{ secrets.SLAB_BASE_URL }} |
| 38 | + job-secret: ${{ secrets.JOB_SECRET }} |
| 39 | + backend: aws |
| 40 | + profile: cpu-test |
| 41 | + |
| 42 | + build-and-test-rust: |
| 43 | + needs: setup-instance |
| 44 | + runs-on: ${{ needs.setup-instance.outputs.runner-name }} |
| 45 | + steps: |
| 46 | + - name: Checkout concrete |
| 47 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 48 | + with: |
| 49 | + submodules: recursive |
| 50 | + fetch-depth: 0 |
| 51 | + |
| 52 | + - name: Create concrete build directory |
| 53 | + run: mkdir build |
| 54 | + |
| 55 | + - name: Build rust bindings |
| 56 | + uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3 |
| 57 | + with: |
| 58 | + registry: ghcr.io |
| 59 | + image: ${{ env.DOCKER_IMAGE_TEST }} |
| 60 | + username: ${{ secrets.GHCR_LOGIN }} |
| 61 | + password: ${{ secrets.GHCR_PASSWORD }} |
| 62 | + options: >- |
| 63 | + -v ${{ github.workspace }}:/concrete |
| 64 | + -v ${{ github.workspace }}/build:/build |
| 65 | + shell: bash |
| 66 | + run: | |
| 67 | + set -e |
| 68 | + ccache -z |
| 69 | + ccache -p |
| 70 | + cd /concrete/compilers/concrete-compiler/compiler |
| 71 | + make BUILD_DIR=/build DATAFLOW_EXECUTION_ENABLED=ON CCACHE=ON Python3_EXECUTABLE=$(which python) concrete-rust |
| 72 | + echo "Debug: ccache statistics (after the build):" |
| 73 | + ccache -s |
| 74 | +
|
| 75 | + - name: Run tests |
| 76 | + uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3 |
| 77 | + with: |
| 78 | + registry: ghcr.io |
| 79 | + image: ${{ env.DOCKER_IMAGE_TEST }} |
| 80 | + username: ${{ secrets.GHCR_LOGIN }} |
| 81 | + password: ${{ secrets.GHCR_PASSWORD }} |
| 82 | + options: >- |
| 83 | + -v ${{ github.workspace }}:/concrete |
| 84 | + -v ${{ github.workspace }}/build:/build |
| 85 | + shell: bash |
| 86 | + run: | |
| 87 | + set -e |
| 88 | + cd /concrete/frontends/concrete-rust |
| 89 | + RUSTFLAGS="-Clink-args=-Wl,/usr/lib64/libstdc++.so.6" make COMPILER_BUILD_DIRECTORY=/build test |
| 90 | +
|
| 91 | + - name: Slack Notification |
| 92 | + if: ${{ failure() && github.ref == 'refs/heads/main' }} |
| 93 | + continue-on-error: true |
| 94 | + uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 |
| 95 | + env: |
| 96 | + SLACK_COLOR: ${{ job.status }} |
| 97 | + SLACK_MESSAGE: "build-and-test-rust finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})" |
| 98 | + |
| 99 | + teardown-instance: |
| 100 | + if: ${{ always() && needs.setup-instance.result != 'skipped' }} |
| 101 | + needs: [ setup-instance, build-and-test-rust] |
| 102 | + runs-on: ubuntu-latest |
| 103 | + steps: |
| 104 | + - name: Stop instance |
| 105 | + id: stop-instance |
| 106 | + uses: zama-ai/slab-github-runner@f26b8d611b2e695158fb0a6980834f0612f65ef8 # v1.4.0 |
| 107 | + with: |
| 108 | + mode: stop |
| 109 | + github-token: ${{ secrets.SLAB_ACTION_TOKEN }} |
| 110 | + slab-url: ${{ secrets.SLAB_BASE_URL }} |
| 111 | + job-secret: ${{ secrets.JOB_SECRET }} |
| 112 | + label: ${{ needs.setup-instance.outputs.runner-name }} |
| 113 | + |
| 114 | + - name: Slack Notification |
| 115 | + if: ${{ failure() }} |
| 116 | + continue-on-error: true |
| 117 | + uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 |
| 118 | + env: |
| 119 | + SLACK_COLOR: ${{ job.status }} |
| 120 | + SLACK_MESSAGE: "Instance teardown finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})" |
0 commit comments