Skip to content
Merged
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
14 changes: 1 addition & 13 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
- "scripts/sidecar.sh"
- "Cargo.toml"
- ".github/workflows/bundle.yml"
- ".github/workflows/release.yml"
pull_request:
workflow_dispatch:

Expand Down Expand Up @@ -43,18 +42,7 @@ jobs:
- id: look
env:
BASE: ${{ github.event.pull_request.base.sha }}
run: |
if [ -z "$BASE" ]; then
echo "packaging=true" >> "$GITHUB_OUTPUT"
exit 0
fi
watched='^(app/src-tauri/(nsis/|Info\.plist|tauri\.conf\.json|Cargo\.toml|build\.rs)|scripts/sidecar\.sh|Cargo\.toml$|\.github/workflows/(bundle|release)\.yml$)'
from=$(git merge-base "$BASE" HEAD)
if git diff --name-only --diff-filter=d "$from" HEAD | grep -qE "$watched"; then
echo "packaging=true" >> "$GITHUB_OUTPUT"
else
echo "packaging=false" >> "$GITHUB_OUTPUT"
fi
run: bash scripts/touched.sh "$BASE" | tee -a "$GITHUB_OUTPUT"

nsis:
name: the installer builds
Expand Down
41 changes: 23 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ env:
RUSTFLAGS: -D warnings

jobs:
# Anything not known to stay out of Rust's way counts as Rust, so a new path runs the whole suite.
changes:
name: what the branch touched
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
rust: ${{ steps.look.outputs.rust }}
picker: ${{ steps.look.outputs.picker }}
deps: ${{ steps.look.outputs.deps }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -32,22 +33,8 @@ jobs:

- id: look
env:
EVENT: ${{ github.event_name }}
BASE: ${{ github.event.pull_request.base.sha }}
run: |
if [ "$EVENT" != "pull_request" ]; then
echo "rust=true" >> "$GITHUB_OUTPUT"
exit 0
fi
aside='^(app/src/|app/(\.gitignore|biome\.json|index\.html|package(-lock)?\.json|stryker\.config\.json|tsconfig(\.node)?\.json|vite\.config\.ts)$|hooks/|packaging/|resources/|(CLA|COMMERCIAL|CONTRIBUTING|PRIVACY|README|SECURITY)\.md$|package(-lock)?\.json$|\.markdownlint-cli2\.jsonc$|\.editorconfig$|\.github/(FUNDING|dependabot)\.yml$|\.github/(not-this-spanish|oversized)\.txt$|\.github/workflows/(bundle|caches|cla|commits|feed|mutants|mutants-sweep|release|rules|update-badge)\.yml$)'
from=$(git merge-base "$BASE" HEAD)
changed=$(git diff --name-only "$from" HEAD)
# The resident embeds the news, so it is Rust's though it lives beside the picker.
first=$( { echo "$changed" | grep -x 'app/src/news.json'; echo "$changed" | grep -vE "$aside"; } \
| grep -v '^$' | head -1 || true)
[ -n "$first" ] && rust=true || rust=false
echo "rust=$rust" >> "$GITHUB_OUTPUT"
echo "the first path Rust has to answer for: ${first:-none}"
run: bash scripts/touched.sh "$BASE" | tee -a "$GITHUB_OUTPUT"

test:
name: test / ${{ matrix.os }}
Expand Down Expand Up @@ -123,6 +110,8 @@ jobs:

lint:
name: fmt
needs: changes
if: needs.changes.outputs.rust == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
Expand All @@ -134,6 +123,8 @@ jobs:

picker:
name: frontend
needs: changes
if: needs.changes.outputs.picker == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 20
defaults:
Expand All @@ -151,6 +142,9 @@ jobs:
- run: npm ci
- run: npm run lint
- run: npm run build
# Coverage, which runs the tests everywhere else, skips Dependabot's bumps.
- if: github.event.pull_request.user.login == 'dependabot[bot]'
run: npm test

prose:
name: markdown
Expand All @@ -168,8 +162,11 @@ jobs:
- run: npm ci
- run: npm run lint:md

# On a pull request only the manifests, the locks and deny.toml can change what this says; main reads it every push.
audit:
name: advisories + licences
needs: changes
if: needs.changes.outputs.deps == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
Expand Down Expand Up @@ -211,8 +208,10 @@ jobs:
coverage:
name: coverage
needs: changes
# A dependency bump changes no line of ours, so it pays for neither coverage nor Sonar.
if: github.actor != 'dependabot[bot]'
# A dependency bump changes no line of ours, and neither does prose, so they pay for neither coverage nor Sonar.
if: >-
github.actor != 'dependabot[bot]'
&& (needs.changes.outputs.rust == 'true' || needs.changes.outputs.picker == 'true')
runs-on: ubuntu-24.04
timeout-minutes: 40
steps:
Expand Down Expand Up @@ -248,13 +247,19 @@ jobs:
sudo apt-get install -y -qq libgtk-3-dev libayatana-appindicator3-dev libxdo-dev libfontconfig1-dev libfreetype6-dev libxkbcommon-dev libwayland-dev libxcb1-dev
cargo llvm-cov nextest -p linkunbound-core -p linkunbound-shell --lcov --output-path lcov-rust.info

- name: No picker lines to measure on this branch
if: needs.changes.outputs.picker != 'true'
run: mkdir -p app/coverage && touch app/coverage/lcov.info

- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
if: needs.changes.outputs.picker == 'true'
with:
node-version: 22
cache: npm
cache-dependency-path: app/package-lock.json

- name: The picker
if: needs.changes.outputs.picker == 'true'
working-directory: app
run: |
npm ci
Expand Down
25 changes: 8 additions & 17 deletions .github/workflows/mutants-sweep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ concurrency:
env:
CARGO_TERM_COLOR: always
DESKTOP_LIBS: libgtk-3-dev libayatana-appindicator3-dev libxdo-dev libfontconfig1-dev libfreetype6-dev libxkbcommon-dev libwayland-dev libxcb1-dev
NOT_ON_LINUX: "mac::|local_web_file|launchable_file|host::|reaction_to|sent_by_launch_services|platform::|dress_natively|replace is_bundle|relaunch_resident|relay_links|hand_to_the_resident|replace base -> Option|replace address -> String|replace named -> Option<Name|replace make_room|replace forget with"
MAC_BRANCHES: "mac::|host::|local_web_file|launchable_file|reaction_to|sent_by_launch_services|replace drawing|replace base -> Option|replace address -> String|replace named -> Option<Name|replace make_room"

jobs:
core:
Expand All @@ -26,10 +28,6 @@ jobs:
with:
persist-credentials: false
- uses: ./.github/actions/toolchain
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
shared-key: workspace
save-if: false
- uses: taiki-e/install-action@5488ac5a951645ce95062214902ac4b6bc1a1037 # v2.87.32
with:
tool: nextest,cargo-mutants
Expand All @@ -38,7 +36,7 @@ jobs:
id: run
run: |
set +e
cargo mutants -p linkunbound-core -j 2 --exclude-re 'mac::|local_web_file|launchable_file|host::|reaction_to|sent_by_launch_services|platform::|dress_natively|replace is_bundle|relaunch_resident|relay_links|hand_to_the_resident|replace base -> Option|replace address -> String|replace named -> Option<Name|replace make_room|replace forget with'
cargo mutants -p linkunbound-core -j 2 --exclude-re "$NOT_ON_LINUX"
echo "code=$?" >> "$GITHUB_OUTPUT"

- name: What survived
Expand Down Expand Up @@ -68,10 +66,6 @@ jobs:
with:
persist-credentials: false
- uses: ./.github/actions/toolchain
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
shared-key: workspace
save-if: false
- uses: taiki-e/install-action@5488ac5a951645ce95062214902ac4b6bc1a1037 # v2.87.32
with:
tool: nextest,cargo-mutants
Expand All @@ -86,7 +80,7 @@ jobs:
run: |
set +e
cargo mutants -p linkunbound-shell --shard $(( ${{ matrix.shard }} - 1 ))/4 -j 2 \
--exclude-re 'mac::|local_web_file|launchable_file|host::|reaction_to|sent_by_launch_services|platform::|dress_natively|replace is_bundle|relaunch_resident|relay_links|hand_to_the_resident|replace base -> Option|replace address -> String|replace named -> Option<Name|replace make_room|replace forget with'
--exclude-re "$NOT_ON_LINUX"
echo "code=$?" >> "$GITHUB_OUTPUT"

- name: What survived
Expand Down Expand Up @@ -116,10 +110,6 @@ jobs:
with:
persist-credentials: false
- uses: ./.github/actions/toolchain
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
shared-key: workspace
save-if: false
- uses: taiki-e/install-action@5488ac5a951645ce95062214902ac4b6bc1a1037 # v2.87.32
with:
tool: nextest,cargo-mutants
Expand All @@ -137,7 +127,7 @@ jobs:
run: |
set +e
cargo mutants -p linkunbound-settings --shard $(( ${{ matrix.shard }} - 1 ))/2 --in-place \
--exclude-re 'mac::|local_web_file|launchable_file|host::|reaction_to|sent_by_launch_services|platform::|dress_natively|replace is_bundle|relaunch_resident|relay_links|hand_to_the_resident|replace base -> Option|replace address -> String|replace named -> Option<Name|replace make_room|replace forget with'
--exclude-re "$NOT_ON_LINUX"
echo "code=$?" >> "$GITHUB_OUTPUT"

- name: What survived
Expand Down Expand Up @@ -181,7 +171,7 @@ jobs:
cargo mutants -p linkunbound-mac --shard $(( ${{ matrix.shard }} - 1 ))/2 -j 2
code=$?
cargo mutants -p linkunbound-core -p linkunbound-shell --shard $(( ${{ matrix.shard }} - 1 ))/2 -j 2 \
-F 'mac::|local_web_file|launchable_file|reaction_to|sent_by_launch_services|replace drawing|replace base -> Option|replace address -> String|replace named -> Option<Name|replace make_room' -o mutants-elsewhere
-F "$MAC_BRANCHES" -o mutants-elsewhere
elsewhere=$?
[ "$elsewhere" -eq 0 ] || code=$elsewhere
echo "code=$code" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -215,6 +205,7 @@ jobs:
path: mutants-elsewhere/mutants.out/
retention-days: 14

# Stryker runs in place: the notices markdown.test.ts reads live outside app/, where no sandbox reaches.
window:
name: window / shard ${{ matrix.shard }} of 4
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -259,7 +250,7 @@ jobs:
}' \
| paste -sd, -)
echo "$list"
npx stryker run --mutate "$list" --concurrency 4 \
npx stryker run --inPlace --mutate "$list" --concurrency 4 \
--reporters progress-append-only,clear-text,json

- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
Expand Down
Loading
Loading