2.home-manager/.github/workflows/test.yml
dependabot[bot] c3dfce6c63 ci: bump actions/checkout from 6 to 7
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-20 12:35:00 -05:00

128 lines
5 KiB
YAML

name: Test
on:
pull_request:
schedule:
- cron: "30 2 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: {}
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
docs: ${{ steps.changes.outputs.docs }}
format: ${{ steps.changes.outputs.format }}
hm: ${{ steps.changes.outputs.hm }}
parse: ${{ steps.changes.outputs.parse }}
tests: ${{ steps.changes.outputs.tests }}
steps:
- uses: actions/checkout@v7
- uses: dorny/paths-filter@v4
id: changes
with:
filters: |
tests:
- 'flake.lock'
- 'flake.nix'
- 'modules/**'
- 'nix-darwin/**'
- 'nixos/**'
- 'tests/**'
docs:
- '**.md'
- 'docs/**'
- 'flake.lock'
- 'flake.nix'
- 'modules/**'
format:
- '**/*.nix'
hm:
- 'flake.lock'
- 'flake.nix'
- 'home-manager/**'
parse:
- '**/*.nix'
- 'flake.lock'
tests:
needs: changes
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Get Nixpkgs revision from flake.lock
id: get-nixpkgs
run: |
echo "rev=$(jq -r '.nodes.nixpkgs.locked.rev' flake.lock)" >> "$GITHUB_OUTPUT"
- uses: cachix/install-nix-action@v31
if: github.event_name == 'schedule' || needs.changes.outputs.docs == 'true' || needs.changes.outputs.tests == 'true' || needs.changes.outputs.hm == 'true' || needs.changes.outputs.parse == 'true' || needs.changes.outputs.format == 'true'
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/${{ steps.get-nixpkgs.outputs.rev }}.tar.gz
extra_nix_config: |
sandbox = true
- name: Build docs
if: github.event_name == 'schedule' || needs.changes.outputs.docs == 'true'
run: nix build --show-trace .#docs-jsonModuleMaintainers
- name: Parse Nix files with nix and Lix
if: >-
matrix.os == 'ubuntu-latest' &&
(github.event_name == 'schedule' || needs.changes.outputs.parse == 'true')
run: nix build --show-trace --keep-going .#ci-parse .#ci-parse-lix
- name: Format Check
if: >-
matrix.os == 'ubuntu-latest' &&
(github.event_name == 'schedule' || needs.changes.outputs.format == 'true')
run: nix fmt -- --ci
- name: Test init --switch with locked inputs
if: github.event_name == 'schedule' || needs.changes.outputs.hm == 'true'
run: |
# Copy lock file to home directory for consistent testing
mkdir -p ~/.config/home-manager
cp flake.lock ~/.config/home-manager/
nix run .#home-manager -- init --switch --override-input home-manager .
- name: Uninstall
if: github.event_name == 'schedule' || needs.changes.outputs.hm == 'true'
run: yes | nix run . -- uninstall
- name: Generate Job Summary
if: github.event_name == 'pull_request'
shell: bash
run: |
echo "### Test Job Summary" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "A summary of tasks triggered by file changes in this PR:" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
if [[ "${{ needs.changes.outputs.docs }}" == "true" ]]; then
echo "- ✅ **Docs Build:** Triggered" >> "$GITHUB_STEP_SUMMARY"
else
echo "- ☑️ **Docs Build:** Skipped (no relevant files changed)" >> "$GITHUB_STEP_SUMMARY"
fi
if [[ "${{ needs.changes.outputs.format }}" == "true" ]]; then
echo "- ✅ **Format Check:** Triggered" >> "$GITHUB_STEP_SUMMARY"
else
echo "- ☑️ **Format Check:** Skipped (no relevant files changed)" >> "$GITHUB_STEP_SUMMARY"
fi
if [[ "${{ needs.changes.outputs.parse }}" == "true" ]]; then
echo "- ✅ **Nix Parse (nix + Lix):** Triggered" >> "$GITHUB_STEP_SUMMARY"
else
echo "- ☑️ **Nix Parse (nix + Lix):** Skipped (no relevant files changed)" >> "$GITHUB_STEP_SUMMARY"
fi
if [[ "${{ needs.changes.outputs.hm }}" == "true" ]]; then
echo "- ✅ **Home Manager Tests:** Triggered" >> "$GITHUB_STEP_SUMMARY"
else
echo "- ☑️ **Home Manager Tests:** Skipped (no relevant files changed)" >> "$GITHUB_STEP_SUMMARY"
fi
if [[ "${{ needs.changes.outputs.tests }}" == "true" ]]; then
echo "- ✅ **General Tests:** Triggered" >> "$GITHUB_STEP_SUMMARY"
else
echo "- ☑️ **General Tests:** Skipped (no relevant files changed)" >> "$GITHUB_STEP_SUMMARY"
fi