diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..67bc1ae4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: CI + +on: + push: + branches: [main] + paths: + - '**.lock' + - '**.nix' + pull_request: + workflow_dispatch: + +jobs: + format: + name: Check formatting + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v24 + + - name: Run formatter + run: | + nix run --inputs-from ./dev nixpkgs#nixpkgs-fmt -- . + + - name: Check for changes + run: git diff --color=always --exit-code + + vm: + name: Test Modules + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v24 + + - name: Setup cache + uses: DeterminateSystems/magic-nix-cache-action@v2 + + - name: Run VM + run: | + nix build -L --show-trace ./dev#checks.x86_64-linux.module-vm-test diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 51d737fa..00000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Format - -on: - push: - branches: [main] - pull_request: - -jobs: - format-check: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: cachix/install-nix-action@v24 - - - name: Run formatter - run: | - pushd dev/ - nix fmt - popd - - - name: Check for changes - run: git diff --color=always --exit-code diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b76e8d7..a728d7d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: release +name: Release on: push: @@ -6,6 +6,7 @@ on: jobs: release-please: + name: Make release runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/test-vm.yml b/.github/workflows/test-vm.yml deleted file mode 100644 index f9056920..00000000 --- a/.github/workflows/test-vm.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Test modules - -on: - push: - paths: - - '_sources/**' - - 'modules/**' - - 'test.nix' - - 'flake.*' - - 'dev/flake.*' - pull_request: - paths: - - '_sources/**' - - 'modules/**' - - 'test.nix' - - 'flake.*' - - 'dev/flake.*' - workflow_dispatch: - -jobs: - run-vm: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: cachix/install-nix-action@v24 - with: - extra_nix_config: "system-features = benchmark big-parallel kvm nixos-test uid-range" - - - uses: DeterminateSystems/magic-nix-cache-action@main - - - name: Run VM - run: | - nix build -Lv ./dev#checks.x86_64-linux.module-vm-test diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index f26cb34b..beaeb13b 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -2,44 +2,50 @@ name: Update docs on: push: + branches: [main] paths: - "modules/home-manager/**" - "modules/nixos/**" workflow_dispatch: jobs: - update-docs: + update: + name: Run update runs-on: ubuntu-latest permissions: contents: write - strategy: - max-parallel: 1 - matrix: - package: ["nixos", "home-manager"] - - # we only want this running on our repo, on the `main` branch - if: github.repository == 'Stonks3141/ctp-nix' && github.ref_name == 'main' + # we only want this running on our repo + if: github.repository == 'Stonks3141/ctp-nix' steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v24 + + - name: Install Nix + uses: cachix/install-nix-action@v24 + + - name: Set Git user info + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' - name: Get short revision id: rev run: echo "rev=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" - - name: Build doc + - name: Build & update docs run: | - nix build ./dev#${{ matrix.package }}-doc - - - name: Update doc - run: cat result > docs/${{ matrix.package }}-options.md + for module in "nixos" "home-manager"; do + nix build -L --show-trace ./dev#"$module"-doc + cat result > docs/"$module"-options.md + rm result + done - name: Commit changes - uses: EndBug/add-and-commit@v9 - with: - default_author: github_actions - message: "docs: update docs for ${{ steps.rev.outputs.rev }}" + run: | + if ! git diff --color=always --exit-code; then + git commit -am "docs: update for ${{ steps.rev.outputs.rev }}" + git push + fi diff --git a/.github/workflows/update-lock.yml b/.github/workflows/update-lock.yml index fdf27fa3..688db27a 100644 --- a/.github/workflows/update-lock.yml +++ b/.github/workflows/update-lock.yml @@ -13,7 +13,9 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v24 + + - name: Install Nix + uses: cachix/install-nix-action@v24 - name: Set Git user info run: | @@ -41,7 +43,7 @@ jobs: - name: Update upstream sources run: | - nix run --inputs-from . nixpkgs#nvfetcher + nix run --inputs-from ./dev nixpkgs#nvfetcher if ! git diff --color=always --exit-code; then git commit -am "chore: update nvfetcher sources"