Skip to content

feat: Extract default devshell to devenv.nix (#42) #234

feat: Extract default devshell to devenv.nix (#42)

feat: Extract default devshell to devenv.nix (#42) #234

Workflow file for this run

name: Build
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Setup Cachix
uses: cachix/cachix-action@v14
with:
name: devenv
- name: Install devenv
run: nix-env -if https://install.devenv.sh/latest
- name: Run tests
run: devenv test
build:
strategy:
matrix:
os:
- macos-12 # Intel
- macos-14 # M1
- ubuntu-latest
fail-fast: false
runs-on: ${{ matrix.os }}
needs: [check]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Setup Cachix
uses: cachix/cachix-action@v14
with:
name: nixpkgs-terraform
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
skipPush: true
- name: Build packages
run: |
if grep -q authToken ~/.config/cachix/cachix.dhall; then
echo "Cachix token is present"
cachix watch-exec nixpkgs-terraform nix -- flake check --impure
else
echo "Cachix token is not present"
nix flake check --impure
fi
env:
NIXPKGS_ALLOW_UNFREE: 1
template:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
strategy:
matrix:
template: [default, devenv, terranix]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Replace inputs on templates
run: sed -i 's/github:stackbuilders\/nixpkgs-terraform/github:stackbuilders\/nixpkgs-terraform\/${{ github.sha }}/g' templates/*/flake.nix
- name: Create a temporary directory
run: echo "tmpdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
id: mktemp
- name: Scaffold a new project
run: nix flake init -t ${{ github.workspace }}#${{ matrix.template }}
working-directory: ${{ steps.mktemp.outputs.tmpdir }}
- name: Run smoke test
run: nix develop --accept-flake-config --impure -c terraform --version
working-directory: ${{ steps.mktemp.outputs.tmpdir }}
env:
NIXPKGS_ALLOW_UNFREE: 1