Skip to content

Commit

Permalink
ci: refactor out common build steps in CI pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiebrynes7 committed Aug 31, 2024
1 parent f92f275 commit 6728cbc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
15 changes: 15 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Common Setup"
description: "Sets up Nix and the development environment"
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Setup Magic Nix cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Use nix-develop shell
uses: nicknovitski/[email protected]
with:
arguments: ./nix --impure
42 changes: 16 additions & 26 deletions .github/workflows/premerge.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
name: "premerge"
on: [push]

setup_steps: &setup_steps
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Setup Magic Nix cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Use nix-develop shell
uses: nicknovitski/[email protected]
with:
arguments: ./nix --impure

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main

- name: Setup Magic Nix cache
uses: DeterminateSystems/magic-nix-cache-action@main

- name: Use nix-develop shell
uses: nicknovitski/[email protected]
with:
arguments: ./nix --impure
- name: Setup
uses: ./.github/actions/setup

- name: Install dependencies
run: npm install
Expand All @@ -41,19 +42,8 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main

- name: Setup Magic Nix cache
uses: DeterminateSystems/magic-nix-cache-action@main

- name: Use nix-develop shell
uses: nicknovitski/[email protected]
with:
arguments: ./nix --impure
- name: Setup
uses: ./.github/actions/setup

- name: Install dependencies
run: npm install
Expand Down

0 comments on commit 6728cbc

Please sign in to comment.