Skip to content

Fix build for >1.9 #338

Fix build for >1.9

Fix build for >1.9 #338

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@V27
with:
nix_path: nixpkgs=channel:nixos-24.05-small
- name: Install devenv
run: |
nix profile install --accept-flake-config nixpkgs#devenv
devenv version
- name: Run tests
run: devenv test
build:
strategy:
matrix:
os:
- macos-13 # x86_64-darwin
- macos-latest # aarch64-darwin
- ubuntu-latest # x86_64-linux
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@V27
- name: Setup Cachix
uses: cachix/cachix-action@v15
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 --max-jobs 2
else
echo "Cachix token is not present"
nix flake check --max-jobs 2
fi
template:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
strategy:
matrix:
template:
- name: config
test: nix flake metadata
- name: default
test: nix develop --accept-flake-config --impure -c terraform --version
- name: devenv
test: nix develop --accept-flake-config --impure -c terraform --version
- name: terranix
test: nix develop --accept-flake-config --impure -c terraform --version
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@V27
- 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.name }}
working-directory: ${{ steps.mktemp.outputs.tmpdir }}
- name: Run test
run: ${{ matrix.template.test }}
working-directory: ${{ steps.mktemp.outputs.tmpdir }}