Skip to content

Commit

Permalink
build: Move common nix setup steps to a local action
Browse files Browse the repository at this point in the history
  • Loading branch information
bow committed Jul 25, 2024
1 parent e4a4de8 commit ec49dd0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
25 changes: 25 additions & 0 deletions .github/actions/setup-nix/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Setup Nix and Cachix

description: Checkout the repository, setup nix, and setup cachix

inputs:
nix_path:
default: nixpkgs=flake:nixpkgs
cachix_name:
default: bow
cachix_auth_token:
required: true

runs:
using: composite
steps:
- name: Install Nix
uses: cachix/install-nix-action@v27
with:
nix_path: ${{ inputs.nix_path }}

- name: Install Cachix
uses: cachix/cachix-action@v15
with:
name: ${{ inputs.cachix_name }}
authToken: '${{ inputs.cachix_auth_token }}'
48 changes: 12 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,10 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v27
- name: Set up Nix
uses: ./.github/actions/setup-nix
with:
nix_path: nixpkgs=flake:nixpkgs

- name: Install Cachix
uses: cachix/cachix-action@v15
with:
name: bow
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
cachix_auth_token: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Run tests
run: nix develop .#ci --command make test
Expand Down Expand Up @@ -71,16 +65,10 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=flake:nixpkgs

- name: Install Cachix
uses: cachix/cachix-action@v15
- name: Set up Nix
uses: ./.github/actions/setup-nix
with:
name: bow
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
cachix_auth_token: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: ${{ matrix.lint.name }}
run: |
Expand All @@ -99,16 +87,10 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v27
- name: Set up Nix
uses: ./.github/actions/setup-nix
with:
nix_path: nixpkgs=flake:nixpkgs

- name: Install Cachix
uses: cachix/cachix-action@v15
with:
name: bow
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
cachix_auth_token: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Set image tag
run: >
Expand Down Expand Up @@ -143,16 +125,10 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=flake:nixpkgs

- name: Install Cachix
uses: cachix/cachix-action@v15
- name: Set up Nix
uses: ./.github/actions/setup-nix
with:
name: bow
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
cachix_auth_token: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Push to ReadTheDocs
env:
Expand Down

0 comments on commit ec49dd0

Please sign in to comment.