Add Fluka "simple example" #696
This file contains 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: On-demand tests | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows | |
on: | |
issue_comment: | |
types: [created] | |
# see https://github.community/t/treating-warnings-as-errors-because-process-env-ci-true/18032 | |
env: | |
CI: false | |
jobs: | |
build_and_test: | |
# Only run if it is a PR and the comment contains /test | |
if: github.event.issue.pull_request && contains(github.event.comment.body, '/test') | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
operating-system: [ubuntu-latest, windows-latest] | |
python-version: ['3.10', '3.11', '3.12'] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
runs-on: ${{ matrix.operating-system }} | |
steps: | |
- name: Get branch of PR | |
uses: xt0rted/pull-request-comment-branch@v3 | |
id: comment-branch | |
- name: Set latest commit status as pending | |
uses: myrotvorets/[email protected] | |
with: | |
sha: ${{ steps.comment-branch.outputs.head_sha }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: pending | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
ref: ${{ steps.comment-branch.outputs.head_ref }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- run: npm ci | |
- run: npm run build --if-present | |
- name: Start application in background on Linux | |
if: matrix.operating-system == 'ubuntu-latest' | |
run: npm run start & | |
- name: Start application in background on Windows | |
if: matrix.operating-system == 'windows-latest' | |
run: | | |
Start-Process -FilePath "npm" -ArgumentList "run start" -NoNewWindow | |
- name: Wait for the app to start | |
uses: iFaxity/[email protected] | |
with: | |
resource: http://localhost:3000 | |
- name: Run tests | |
uses: nick-fields/retry@v3 | |
with: | |
max_attempts: 2 | |
retry_on: error | |
timeout_seconds: 240 | |
command: npm test | |
- name: Add workflow result as comment on PR | |
uses: actions/github-script@v7 | |
if: always() | |
with: | |
script: | | |
const workflow_name = '${{ github.workflow }}'; | |
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; | |
const success = '${{ job.status }}' === 'success'; | |
const body = `${workflow_name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`; | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}) | |
- name: Set latest commit status as ${{ job.status }} | |
uses: myrotvorets/[email protected] | |
if: always() | |
with: | |
sha: ${{ steps.comment-branch.outputs.head_sha }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: ${{ job.status }} |