Skip to content

ci: Rewrite update-versions in Go #307

ci: Rewrite update-versions in Go

ci: Rewrite update-versions in Go #307

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
- name: Setup Cachix
uses: cachix/cachix-action@v15
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@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
else
echo "Cachix token is not present"
nix flake check
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 }}