gomod2nix/.github/workflows/ci.yml
dependabot[bot] 4702caff8e build(deps): bump cachix/install-nix-action from 26 to 27
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 26 to 27.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v26...V27)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-20 11:01:53 +00:00

76 lines
2.1 KiB
YAML

name: CI
on:
pull_request:
paths-ignore:
- '**.md'
push:
paths-ignore:
- '**.md'
branches:
- master
jobs:
nixpkgs-fmt:
runs-on: ubuntu-latest
env:
NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz"
steps:
- uses: cachix/install-nix-action@V27
- uses: actions/checkout@v4
- name: Check format
run: nix-shell --run 'nixpkgs-fmt --check .'
golangci-lint:
runs-on: ubuntu-latest
env:
NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz"
steps:
- uses: cachix/install-nix-action@V27
- uses: actions/checkout@v4
- name: Check format
run: nix-shell --run 'golangci-lint run'
gomod2nix_toml:
runs-on: ubuntu-latest
env:
NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz"
steps:
- uses: cachix/install-nix-action@V27
- uses: actions/checkout@v4
- name: "Build gomod2nix"
run: nix-shell --run "go build"
- name: Run gomod2nix
run: nix-shell --run gomod2nix
- name: Check diff
run: git diff --exit-code gomod2nix.toml
list-jobs:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@V27
with:
nix_path: nixpkgs=channel:nixos-unstable
- id: set-matrix
run: |
set -euo pipefail
matrix="$(go run tests/run.go list | jq --raw-input --slurp -rcM '{attr: split("\n")[:-1], os: ["ubuntu-latest"]}')"
echo "::set-output name=matrix::$matrix"
builds:
needs: list-jobs
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.list-jobs.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@V27
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: "Build gomod2nix"
run: nix-shell --run "go build"
- name: "Run test: ${{ matrix.attr }}"
run: nix-shell --run "go run tests/run.go run ${{ matrix.attr }}"