Skip to content

Add multiline capture input with Ctrl+J (#47) #18

Add multiline capture input with Ctrl+J (#47)

Add multiline capture input with Ctrl+J (#47) #18

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
permissions:
actions: read
checks: write
contents: read
pull-requests: write
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
format:
name: Format
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.94"
components: rustfmt
- name: Check Rust formatting
id: rust_fmt
run: cargo fmt --all -- --check
- name: Write summary
if: always()
run: |
{
echo "## Flow Format Summary"
echo
echo "- Runner: \`ubuntu-24.04\`"
echo "- Rust formatting: \`${{ steps.rust_fmt.outcome }}\`"
echo "- Run URL: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
} >> "${GITHUB_STEP_SUMMARY}"
clippy:
name: Clippy
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.94"
components: clippy
- name: Cache Rust
uses: swatinem/rust-cache@v2
- name: Run Clippy
id: rust_clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Write summary
if: always()
run: |
{
echo "## Flow Clippy Summary"
echo
echo "- Runner: \`ubuntu-24.04\`"
echo "- Clippy: \`${{ steps.rust_clippy.outcome }}\`"
echo "- Run URL: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
} >> "${GITHUB_STEP_SUMMARY}"
test:
name: Test
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.94"
- name: Cache Rust
uses: swatinem/rust-cache@v2
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Run tests with JUnit output
id: rust_tests
run: cargo nextest run --workspace --profile ci
- name: Upload test artefacts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: target/nextest/ci/junit.xml
if-no-files-found: warn
- name: Publish unit test results
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
check_name: Flow Tests
files: target/nextest/ci/junit.xml
- name: Write summary
if: always()
run: |
{
echo "## Flow Test Summary"
echo
echo "- Runner: \`ubuntu-24.04\`"
echo "- Tests: \`${{ steps.rust_tests.outcome }}\`"
echo "- Test artefact: \`target/nextest/ci/junit.xml\`"
echo "- Run URL: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
} >> "${GITHUB_STEP_SUMMARY}"
report-pr-results:
name: PR summary
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork
needs:
- format
- clippy
- test
runs-on: ubuntu-latest
steps:
- name: Post CI summary comment
uses: actions/github-script@v7
with:
script: |
const marker = '<!-- ci-check-summary -->';
const label = (result) =>
result === 'success' ? '[PASS]' :
result === 'failure' ? '[FAIL]' : '[SKIP]';
const fmt = '${{ needs.format.result }}';
const clippy = '${{ needs.clippy.result }}';
const tests = '${{ needs.test.result }}';
const body = [
marker,
'## CI check summary',
'',
`- ${label(fmt)} Format: \`${fmt}\``,
`- ${label(clippy)} Clippy: \`${clippy}\``,
`- ${label(tests)} Test: \`${tests}\``,
].join('\n');
const issue_number = context.issue.number;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number,
per_page: 100,
});
const existing = comments.find((c) =>
c.user?.type === 'Bot' && c.body?.includes(marker)
);
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number,
body,
});
}