From 8938636dfb2a5e52e0a843cc0782a92cdf02db36 Mon Sep 17 00:00:00 2001 From: Storm <31986015+washedupdeveloper@users.noreply.github.com> Date: Sat, 29 Mar 2025 22:00:37 +0100 Subject: [PATCH] added github actions --- .github/workflows/flake-check.yml | 44 +++++++++++++++++++++++++ .github/workflows/update-flake-lock.yml | 29 ++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/workflows/flake-check.yml create mode 100644 .github/workflows/update-flake-lock.yml diff --git a/.github/workflows/flake-check.yml b/.github/workflows/flake-check.yml new file mode 100644 index 0000000..a36fa9d --- /dev/null +++ b/.github/workflows/flake-check.yml @@ -0,0 +1,44 @@ +name: nix flake check + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + types: [opened, reopened, synchronize] + repository_dispatch: + types: [create-pull-request] + +jobs: + flake-check: + runs-on: "ubuntu-latest" + steps: + - name: "Checking out repository..." + uses: actions/checkout@v4 + + - name: "Installing and configuring the nix package manager..." + uses: DeterminateSystems/nix-installer-action@main + with: + extra-conf: | + accept-flake-config = true + + - name: "Setting up packages..." + run: | + nix profile install nixpkgs#nix-fast-build # parallel nix builder + + - name: "Running `nix flake check`..." + run: nix-fast-build --skip-cached --no-nom + # NOTE: You can also limit the build only to the currentSystem + # run: nix-fast-build --skip-cached --no-nom --flake ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem)" + + - name: "Running `nix build ...`..." + run: nix-fast-build --skip-cached --no-nom --flake ".#packages" + # run: nix-fast-build --skip-cached --no-nom --flake ".#packages.$(nix eval --raw --impure --expr builtins.currentSystem)" + + - name: "Running `nix develop...`..." + run: nix-fast-build --skip-cached --no-nom --flake ".#devShells" + # run: nix-fast-build --skip-cached --no-nom --flake ".#devShells.$(nix eval --raw --impure --expr builtins.currentSystem)" + + - name: "Checking flake inputs for stale & insecure nixpkgs versions..." + uses: DeterminateSystems/flake-checker-action@main diff --git a/.github/workflows/update-flake-lock.yml b/.github/workflows/update-flake-lock.yml new file mode 100644 index 0000000..0394414 --- /dev/null +++ b/.github/workflows/update-flake-lock.yml @@ -0,0 +1,29 @@ +name: update-flake-lock +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * 0" # runs weekly on Sunday at 00:00 + +jobs: + update-flake-lock: + runs-on: ubuntu-latest + steps: + - name: "Checking out repository..." + uses: actions/checkout@v4 + + - name: "Installing and configuring the nix package manager..." + uses: DeterminateSystems/nix-installer-action@main + with: + extra-conf: | + accept-flake-config = true + + - name: "Updating flake.lock..." + uses: DeterminateSystems/update-flake-lock@main + with: + pr-title: "Automated action - Update flake.lock" + pr-labels: | + dependencies + automated + + # NOTE You can use a PAT to identify as a user, for CI purposes + # token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}