From 2f5ff1f07639d1b858fe1e93dc69740f0e3bf063 Mon Sep 17 00:00:00 2001 From: isabel Date: Fri, 16 Feb 2024 12:04:48 +0000 Subject: [PATCH] ci: cleanup --- .github/runners/build-common.yml | 26 ++++++++++++++++++++++++++ .github/runners/common.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/build.yml | 22 ++++------------------ .github/workflows/check.yml | 14 ++++---------- .github/workflows/docs.yml | 9 ++++----- .github/workflows/update.yml | 9 ++++----- 6 files changed, 70 insertions(+), 38 deletions(-) create mode 100644 .github/runners/build-common.yml create mode 100644 .github/runners/common.yml diff --git a/.github/runners/build-common.yml b/.github/runners/build-common.yml new file mode 100644 index 000000000..92677ac39 --- /dev/null +++ b/.github/runners/build-common.yml @@ -0,0 +1,26 @@ +name: Build Common + +on: + workflow_call: + inputs: + platform: + default: "ubuntu-latest" + required: false + type: string + github_token: + required: true + +jobs: + build-common: + - name: Maximize Space + uses: easimon/maximize-build-space@v10 + with: + overprovision-lvm: true + remove-android: true + remove-dotnet: true + remove-haskell: true + + - name: Common + uses: ./.github/runners/common.yml + with: + github_token: ${{ inputs.GITHUB_TOKEN }} diff --git a/.github/runners/common.yml b/.github/runners/common.yml new file mode 100644 index 000000000..d7dbb13b1 --- /dev/null +++ b/.github/runners/common.yml @@ -0,0 +1,28 @@ +name: Common + +on: + workflow_call: + inputs: + platform: + default: "ubuntu-latest" + required: false + type: string + github_token: + required: true + +jobs: + common: + runs-on: ${{ inputs.platform }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ inputs.github_token }} + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + with: + logger: pretty + + - name: Nix Magic Cache + uses: DeterminateSystems/magic-nix-cache-action@main diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2cfcbfe8f..ba309cbf1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,25 +23,11 @@ jobs: - plymouth-theme-catppuccin steps: - - name: Maximize Space - uses: easimon/maximize-build-space@v10 + - name: Prepare Environment + uses: ./.github/runners/build-common.yml with: - overprovision-lvm: true - remove-android: true - remove-dotnet: true - remove-haskell: true - - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - with: - logger: pretty - - - name: Magic Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@main - + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Setup cachix uses: cachix/cachix-action@v14 with: diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 874880b44..d1de3f52f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -13,17 +13,11 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main + - name: Prepare Environment + uses: ./.github/runners/common.yml with: - logger: pretty - - - name: Magic Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@main - + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Check Flake run: nix flake check --accept-flake-config diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5345ef82e..1fd6af288 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -15,11 +15,10 @@ jobs: contents: write steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install nix - uses: cachix/install-nix-action@v25 + - name: Prepare Environment + uses: ./.github/runners/common.yml + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Build Linux packages run: "nix build -L .#docs-html" diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 8497bda98..cb91357d7 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -9,11 +9,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4.1.0 - - - name: Install Nix - uses: nixbuild/nix-quick-install-action@v26 + - name: Prepare Environment + uses: ./.github/runners/common.yml + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Update Lockfile uses: DeterminateSystems/update-flake-lock@main