From d87400776990b0a39f6974e063de1bc587438be3 Mon Sep 17 00:00:00 2001 From: Ali Rizvi Date: Tue, 26 Nov 2024 15:45:51 -0500 Subject: [PATCH] .github/workflows: Improve pipeline with some parallel steps TODO --- .github/workflows/build.yml | 36 ++++++++++++++++----------------- .github/workflows/setup-env.yml | 24 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/setup-env.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77021d2..5295938 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,28 +7,28 @@ on: - staging jobs: - tests: + check: + name: Check Flake Outputs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.2.2 + - uses: ./.github/workflows/setup-env.yml - - name: Free Disk Space - uses: jlumbroso/free-disk-space@v1.3.1 - with: - tool-cache: true + - name: Flake Check + run: nix flake check - - name: Install Nix - uses: cachix/install-nix-action@v30 - with: - extra_nix_config: | - allow-import-from-derivation = false - eval-cache = false + build: + name: Build Flake Outputs + runs-on: ubuntu-latest + needs: ['prepare'] + strategy: + matrix: + outputs: ['nixosConfigurations.LAPTOP-3DT4F02.config.system.build.toplevel', + 'nixosConfigurations.DESKTOP-3DT4F02.config.system.build.toplevel', + 'nixosConfigurations.ISO-3DT4F02.config.system.build.isoImage'] - - name: Run Flake Check - run: nix flake check + steps: + - uses: ./.github/workflows/setup-env.yml - - name: Build NixOS Configurations + - name: Flake Build run: | - nix build '.#nixosConfigurations.LAPTOP-3DT4F02.config.system.build.toplevel' - nix build '.#nixosConfigurations.DESKTOP-3DT4F02.config.system.build.toplevel' - nix build '.#nixosConfigurations.ISO-3DT4F02.config.system.build.isoImage' + nix build '.#${{ matrix.outputs }}' diff --git a/.github/workflows/setup-env.yml b/.github/workflows/setup-env.yml new file mode 100644 index 0000000..8ea68fe --- /dev/null +++ b/.github/workflows/setup-env.yml @@ -0,0 +1,24 @@ +name: Setup Nix Environment + +on: + workflow_call: + +jobs: + setup: + name: Prepare Environment + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4.2.2 + + - name: Free Disk Space + uses: jlumbroso/free-disk-space@v1.3.1 + with: + tool-cache: true + + - name: Install Nix + uses: cachix/install-nix-action@v30 + with: + extra_nix_config: | + allow-import-from-derivation = false + eval-cache = false