From 0f53d785f8df79ad0144b99f9c4e04ca2c7d3796 Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Tue, 28 Jan 2025 10:53:43 +0000 Subject: [PATCH] Try using composite gha workflow --- .github/actions/nix-cachix-setup/action.yml | 23 ++++++ .github/workflows/binaries.yaml | 24 ++----- .github/workflows/cardano-node.yaml | 19 +++-- .github/workflows/ci-nix.yaml | 80 ++++----------------- .github/workflows/docker.yaml | 12 +--- .github/workflows/formatting.yaml | 12 +--- .github/workflows/network-test.yaml | 12 +--- .github/workflows/publish-docs.yaml | 8 +-- .github/workflows/smoke-test.yaml | 7 +- .github/workflows/weeder.yaml | 12 +--- 10 files changed, 64 insertions(+), 145 deletions(-) create mode 100644 .github/actions/nix-cachix-setup/action.yml diff --git a/.github/actions/nix-cachix-setup/action.yml b/.github/actions/nix-cachix-setup/action.yml new file mode 100644 index 00000000000..c3e9f391990 --- /dev/null +++ b/.github/actions/nix-cachix-setup/action.yml @@ -0,0 +1,23 @@ +name: Checkout With Cachix +description: Checkout a repository and also set up nix + +inputs: + authToken: + required: true + +runs: + using: composite + + steps: + - name: ❄ Prepare nix + uses: cachix/install-nix-action@v30 + with: + extra_nix_config: | + accept-flake-config = true + log-lines = 1000 + + - name: ❄ Cachix cache of nix derivations + uses: cachix/cachix-action@v15 + with: + name: cardano-scaling + authToken: '${{ inputs.authToken }}' diff --git a/.github/workflows/binaries.yaml b/.github/workflows/binaries.yaml index f740b6681bc..5ac00ebe36b 100644 --- a/.github/workflows/binaries.yaml +++ b/.github/workflows/binaries.yaml @@ -20,17 +20,9 @@ jobs: # Also ensure we have all history with all tags fetch-depth: 0 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 - with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: 🕵 Determine version @@ -64,17 +56,9 @@ jobs: # Also ensure we have all history with all tags fetch-depth: 0 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 - with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: 🕵 Determine version diff --git a/.github/workflows/cardano-node.yaml b/.github/workflows/cardano-node.yaml index 834f4108e94..1ef893d591c 100644 --- a/.github/workflows/cardano-node.yaml +++ b/.github/workflows/cardano-node.yaml @@ -17,12 +17,11 @@ jobs: repository: IntersectMBO/cardano-node ref: 8.7.2 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 - with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup + with: + name: cardano-scaling + authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: ❄ Build cardano-node static executables run: | @@ -49,12 +48,10 @@ jobs: repository: ch1bo/cardano-node ref: 170817f5ba3f7838ffd9bd181bc30504906a6506 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 + authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: ❄ Build executables run: | diff --git a/.github/workflows/ci-nix.yaml b/.github/workflows/ci-nix.yaml index bbaeec10040..eb570057835 100644 --- a/.github/workflows/ci-nix.yaml +++ b/.github/workflows/ci-nix.yaml @@ -38,17 +38,9 @@ jobs: - name: 📥 Checkout repository uses: actions/checkout@v4 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 - with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: ❓ Test @@ -113,17 +105,9 @@ jobs: - name: 📥 Checkout repository uses: actions/checkout@v4 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 - with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: 📚 Documentation (Haddock) @@ -157,17 +141,9 @@ jobs: - name: 📥 Checkout repository uses: actions/checkout@v4 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 - with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: 📈 Benchmark @@ -236,17 +212,9 @@ jobs: - name: 📥 Checkout repository uses: actions/checkout@v4 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 - with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: ❄ Nix Flake Check @@ -261,17 +229,9 @@ jobs: - name: 📥 Checkout repository uses: actions/checkout@v4 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 - with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: ❄ Build specification PDF @@ -299,12 +259,10 @@ jobs: # Ensure we have all history with all commits fetch-depth: 0 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 + authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: Set up and use the "ci" devShell uses: nicknovitski/nix-develop@v1 @@ -369,17 +327,9 @@ jobs: - name: "Checkout the PR as the 'new' source" uses: actions/checkout@v4 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 - with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: Set up and use the "ci" devShell diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 4f4af26a693..b4b2e3f56d0 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -44,17 +44,9 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 - with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: 🔨 Build image using nix diff --git a/.github/workflows/formatting.yaml b/.github/workflows/formatting.yaml index 80d9fc40aa8..ef9749e471c 100644 --- a/.github/workflows/formatting.yaml +++ b/.github/workflows/formatting.yaml @@ -13,17 +13,9 @@ jobs: - name: 📥 Checkout repository uses: actions/checkout@v4 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 - with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: 📐 Check code formatting diff --git a/.github/workflows/network-test.yaml b/.github/workflows/network-test.yaml index 7b616cf242a..796ab03f4f5 100644 --- a/.github/workflows/network-test.yaml +++ b/.github/workflows/network-test.yaml @@ -39,17 +39,9 @@ jobs: with: submodules: true - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 - with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: Set up and use the "ci" devShell diff --git a/.github/workflows/publish-docs.yaml b/.github/workflows/publish-docs.yaml index 172e6843aad..76e373e69b9 100644 --- a/.github/workflows/publish-docs.yaml +++ b/.github/workflows/publish-docs.yaml @@ -24,12 +24,10 @@ jobs: # Also ensure we have all history with all tags fetch-depth: 0 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 + authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: Set up and use the "ci" devShell uses: nicknovitski/nix-develop@v1 diff --git a/.github/workflows/smoke-test.yaml b/.github/workflows/smoke-test.yaml index 558a2ef4876..7be41e862f3 100644 --- a/.github/workflows/smoke-test.yaml +++ b/.github/workflows/smoke-test.yaml @@ -34,11 +34,10 @@ jobs: with: submodules: true - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true + authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: 🧹 Cleanup hydra-node state run: | diff --git a/.github/workflows/weeder.yaml b/.github/workflows/weeder.yaml index 672c9983634..277a9760e72 100644 --- a/.github/workflows/weeder.yaml +++ b/.github/workflows/weeder.yaml @@ -13,17 +13,9 @@ jobs: - name: 📥 Checkout repository uses: actions/checkout@v4 - - name: ❄ Prepare nix - uses: cachix/install-nix-action@v30 + - name: ❄ Setup Nix/Cachix + uses: ./.github/actions/nix-cachix-setup with: - extra_nix_config: | - accept-flake-config = true - log-lines = 1000 - - - name: ❄ Cachix cache of nix derivations - uses: cachix/cachix-action@v15 - with: - name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - name: 📐 Check weeder