docker: replace getdeps build with prebuilt binary; publish to GHCR #19
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| checks: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: linux | |
| preset: default | |
| build_dir: build | |
| - name: asan debug | |
| preset: san | |
| build_dir: build-san | |
| name: ${{ matrix.name }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install system dependencies | |
| run: bash deps/moxygen/standalone/install-system-deps.sh | |
| - name: Download moxygen release tarball | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: bash scripts/setup-deps-tarball.sh | |
| - name: Configure | |
| run: bash scripts/configure.sh ${{ matrix.build_dir }} ${{ matrix.preset }} | |
| - name: Build | |
| run: cmake --build ${{ matrix.build_dir }} -j$(nproc) | |
| - name: Test | |
| env: | |
| ASAN_OPTIONS: ${{ matrix.name == 'asan debug' && 'detect_leaks=1:abort_on_error=1' || '' }} | |
| run: ctest --test-dir ${{ matrix.build_dir }} --output-on-failure --output-junit test-results.xml | |
| - name: Publish test results | |
| uses: dorny/test-reporter@v1.9.1 | |
| if: success() || failure() | |
| with: | |
| name: "test (${{ matrix.name }})" | |
| path: ${{ matrix.build_dir }}/test-results.xml | |
| reporter: java-junit | |
| notify-failure: | |
| runs-on: ubuntu-22.04 | |
| needs: [build] | |
| if: failure() | |
| steps: | |
| - name: Notify Slack | |
| continue-on-error: true | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| SLACK_WEBHOOK_URL: ${{ secrets.OMOQ_SLACK_WEBHOOK_URL }} | |
| run: | | |
| RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| # First-failure-only: skip if previous run on this branch also failed | |
| PREV=$(gh api \ | |
| "repos/${{ github.repository }}/actions/workflows/ci.yml/runs?branch=${{ github.head_ref }}&event=pull_request&per_page=2" \ | |
| --jq '.workflow_runs[1].conclusion // "none"' 2>/dev/null) || PREV="none" | |
| if [ "$PREV" = "failure" ]; then | |
| echo "Previous run also failed — skipping" | |
| exit 0 | |
| fi | |
| TEXT=":x: *${{ github.repository }}* \`${{ github.head_ref }}\` failed — <${{ github.event.pull_request.html_url }}|PR #${{ github.event.pull_request.number }}> · <${RUN_URL}|run> · <${{ github.event.pull_request.html_url }}/checks|tests>" | |
| else | |
| SHORT="${GITHUB_SHA:0:12}" | |
| TEXT=":x: *${{ github.repository }}* \`${{ github.ref_name }}\` \`${SHORT}\` — build failed · <${RUN_URL}|run>" | |
| fi | |
| curl -s -X POST "$SLACK_WEBHOOK_URL" \ | |
| -H "Content-Type: application/json" \ | |
| --data "{\"text\": \"${TEXT}\"}" | |
| - name: Notify email (main only) | |
| if: github.event_name == 'push' | |
| continue-on-error: true | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.OMOQ_AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.OMOQ_AWS_SECRET_ACCESS_KEY }} | |
| AWS_DEFAULT_REGION: us-east-1 | |
| run: | | |
| SHORT="${GITHUB_SHA:0:12}" | |
| RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| REPO_NAME="${{ github.event.repository.name }}" | |
| SUBJECT="[${REPO_NAME}] build FAILED ${{ github.ref_name }} ${SHORT}" | |
| BODY="${{ github.repository }} · ${{ github.ref_name }} · ${SHORT}\n${RUN_URL}" | |
| aws ses send-email \ | |
| --from "noreply@ci.openmoq.org" \ | |
| --destination '{"ToAddresses":["github-notifications@openmoq.org"]}' \ | |
| --message "{ | |
| \"Subject\": {\"Data\": \"$SUBJECT\"}, | |
| \"Body\": {\"Text\": {\"Data\": \"$BODY\"}} | |
| }" |