hello/.github/workflows/main.yml

55 lines
1.7 KiB
YAML
Raw Normal View History

2023-09-15 17:54:20 +00:00
name: "Hello"
on:
push:
branches: [ main, master ]
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: read
issues: write
2023-09-19 20:37:58 +00:00
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
2023-09-15 17:54:20 +00:00
env:
GIT_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_SHA: ${{ github.sha }}
2023-09-20 23:00:45 +00:00
CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }}
2023-09-15 17:54:20 +00:00
jobs:
2023-09-19 20:37:58 +00:00
nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
2023-09-20 17:10:43 +00:00
with:
nix_path: nixpkgs=channel:nixos-unstable
github_access_token: ${{ secrets.GITHUB_TOKEN }}
2023-09-19 20:37:58 +00:00
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
2023-09-20 22:56:37 +00:00
echo "matrix=$(nix eval --json '.#githubActions.matrix')" >> "$GITHUB_OUTPUT"
2023-09-20 18:40:29 +00:00
#echo 'matrix={"include":[{"attr":"githubActions.checks.x86_64-linux.hello","os":["ubuntu-22.04"]},{"attr":"githubActions.checks.x86_64-linux.lxc","os":["ubuntu-22.04"]}]}' >> "$GITHUB_OUTPUT"
2023-09-20 22:56:37 +00:00
#echo 'matrix={"include":[{"attr":"githubActions.checks.x86_64-linux.lxc","os":["ubuntu-22.04"]}]}' >> "$GITHUB_OUTPUT"
2023-09-20 17:10:43 +00:00
2023-09-15 17:54:20 +00:00
nix-build:
needs: nix-matrix
2023-09-19 20:37:58 +00:00
name: Build on ${{ matrix.attr }}
2023-09-20 17:10:43 +00:00
runs-on: ubuntu-latest
2023-09-15 17:54:20 +00:00
strategy:
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
steps:
2023-09-19 20:37:58 +00:00
- uses: actions/checkout@v3
2023-09-20 17:10:43 +00:00
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }}
github_access_token: ${{ secrets.GITHUB_TOKEN }}
2023-09-15 17:54:20 +00:00
- run: nix build -L ".#${{ matrix.attr }}"