Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/actions/job_done/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Job done
description: Mark the current job as successfully completed.

runs:
using: composite
steps:
- name: Mark Unix successful completion
if: runner.os != 'Windows'
shell: bash
run: touch "${RUNNER_TEMP}/modmesh_job_completed"

- name: Mark Windows successful completion
if: runner.os == 'Windows'
shell: pwsh
run: New-Item -ItemType File -Path "$env:RUNNER_TEMP\modmesh_job_completed" -Force | Out-Null
22 changes: 22 additions & 0 deletions .github/actions/job_guard/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Job guard
description: Fail the job when it does not reach the completion marker.

runs:
using: composite
steps:
- name: Register Unix post-run completion check
if: runner.os != 'Windows'
uses: gacts/run-and-post-run@v1
with:
post: >-
test -f "${RUNNER_TEMP}/modmesh_job_completed" ||
{ echo "::error::CI job timed out, was cancelled, or stopped before completion."; exit 2; }

- name: Register Windows post-run completion check
if: runner.os == 'Windows'
uses: gacts/run-and-post-run@v1
with:
post-shell: pwsh
post: >-
if (-not (Test-Path -LiteralPath "$env:RUNNER_TEMP\modmesh_job_completed"))
{ Write-Host "::error::CI job timed out, was cancelled, or stopped before completion."; exit 2 }
15 changes: 14 additions & 1 deletion .github/workflows/devbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
with:
fetch-depth: 1

- uses: ./.github/actions/job_guard

- name: event name
run: |
echo "github.event_name: ${{ github.event_name }}"
Expand All @@ -61,6 +63,8 @@ jobs:
make standalone_buffer_setup
make standalone_buffer

- uses: ./.github/actions/job_done

build:

if: |
Expand Down Expand Up @@ -98,6 +102,8 @@ jobs:
with:
fetch-depth: 1

- uses: ./.github/actions/job_guard

- name: event name
run: |
echo "github.event_name: ${{ github.event_name }}"
Expand Down Expand Up @@ -202,6 +208,8 @@ jobs:
make buildext VERBOSE=1
make pytest VERBOSE=1

- uses: ./.github/actions/job_done

build_windows:

if: |
Expand Down Expand Up @@ -238,6 +246,8 @@ jobs:
with:
fetch-depth: 1

- uses: ./.github/actions/job_guard

- name: event name
run: |
echo "github.event_name: ${{ github.event_name }}"
Expand Down Expand Up @@ -373,15 +383,18 @@ jobs:
name: modmesh-pilot-win64
path: modmesh-pilot-win64/

- uses: ./.github/actions/job_done

send_email_on_failure:
needs: [standalone_buffer, build, build_windows]
# Run if any of the dependencies failed in master branch
# Run if any of the dependencies failed or timed out in master branch
if: ${{ always() && contains(needs.*.result, 'failure') && github.ref_name == 'master' && github.event.repository.fork == false }}
uses: ./.github/workflows/send_email_on_fail.yml
with:
job_results: |
- standalone_buffer: ${{ needs.standalone_buffer.result }}
- build: ${{ needs.build.result }}
- build_windows: ${{ needs.build_windows.result }}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. I forget this part.

secrets:
EMAIL_USERNAME: ${{ secrets.EMAIL_USERNAME }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}
6 changes: 5 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
with:
fetch-depth: 1

- uses: ./.github/actions/job_guard

- name: event name
run: |
echo "github.event_name: ${{ github.event_name }}"
Expand Down Expand Up @@ -104,9 +106,11 @@ jobs:
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3)"

- uses: ./.github/actions/job_done

send_email_on_failure:
needs: [lint]
# Run if any of the dependencies failed in master branch
# Run if any of the dependencies failed or timed out in master branch
if: ${{ always() && contains(needs.*.result, 'failure') && github.ref_name == 'master' && github.event.repository.fork == false }}
uses: ./.github/workflows/send_email_on_fail.yml
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/nouse_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
with:
fetch-depth: 1

- uses: ./.github/actions/job_guard

- name: event name
run: |
echo "github.event_name: ${{ github.event_name }}"
Expand Down Expand Up @@ -85,9 +87,11 @@ jobs:
pytest --rootdir=. -v
cd ..

- uses: ./.github/actions/job_done

send_email_on_failure:
needs: [nouse_install]
# Run if any of the dependencies failed in master branch
# Run if any of the dependencies failed or timed out in master branch
if: ${{ always() && contains(needs.*.result, 'failure') && github.ref_name == 'master' && github.event.repository.fork == false }}
uses: ./.github/workflows/send_email_on_fail.yml
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/profiling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
with:
fetch-depth: 1

- uses: ./.github/actions/job_guard

- name: event name
run: |
echo "Event name: ${{ github.event_name }}"
Expand Down Expand Up @@ -74,9 +76,11 @@ jobs:
run: |
make pyprof

- uses: ./.github/actions/job_done

send_email_on_failure:
needs: [profile]
if: ${{ always() && (needs.*.result == 'failure') && github.ref_name == 'master' && github.event.repository.fork == false }}
if: ${{ always() && contains(needs.*.result, 'failure') && github.ref_name == 'master' && github.event.repository.fork == false }}
uses: ./.github/workflows/send_email_on_fail.yml
with:
job_results: |
Expand Down
Loading