.github: Restructure workflows

This commit is contained in:
Zhaofeng Li 2022-08-16 20:15:43 -06:00
parent c99a8246c2
commit 5e76e8ab26
5 changed files with 70 additions and 43 deletions

View file

@ -7,14 +7,19 @@ jobs:
strategy:
matrix:
os:
- ubuntu-latest
- macos-11
- label: Linux
image: ubuntu-latest
- label: macOS
image: macos-11
nix:
- name: 2.10.3
- version: 2.10.3
url: https://releases.nixos.org/nix/nix-2.10.3/install
runs-on: ${{ matrix.os }}
name: ${{ matrix.os.label }} + Nix ${{ matrix.nix.version }}
runs-on: ${{ matrix.os.image }}
steps:
- uses: actions/checkout@v3.0.2
- uses: cachix/install-nix-action@v17
with:
install_url: ${{ matrix.nix.url }}
@ -28,48 +33,15 @@ jobs:
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix flake check
if: ${{ !contains(matrix.nix.name, '2.3') && runner.os != 'macOS' }}
if: ${{ !contains(matrix.nix.version, '2.3') && runner.os != 'macOS' }}
- name: Build Colmena
run: nix build -L
if: ${{ !contains(matrix.nix.name, '2.3') }}
if: ${{ !contains(matrix.nix.version, '2.3') }}
- name: Build and install Colmena with flake-compat
run: nix-env -if default.nix
- name: Build manual
run: nix build .#manual -L
if: ${{ !contains(matrix.nix.name, '2.3') && runner.os != 'macOS' }}
tests:
strategy:
matrix:
os:
- ubuntu-latest
nix:
- name: 2.3.16
url: https://releases.nixos.org/nix/nix-2.3.16/install
- name: 2.4
url: https://releases.nixos.org/nix/nix-2.4/install
- name: 2.10.3
url: https://releases.nixos.org/nix/nix-2.10.3/install
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2.3.5
- uses: cachix/install-nix-action@v17
with:
install_url: ${{ matrix.nix.url }}
extra_nix_config: |
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v10
with:
name: colmena
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Set up pinned nixpkgs
run: echo "NIX_PATH=nixpkgs=$(nix-instantiate --eval flake-compat.nix -A defaultNix.inputs.nixpkgs.outPath | sed 's|\"||g')" >> $GITHUB_ENV
- run: nix-shell --run "cargo test"
if: ${{ !contains(matrix.nix.name, '2.3') }}
- run: nix-shell --run "cargo test -- --skip flake"
if: ${{ contains(matrix.nix.name, '2.3') }}
if: ${{ !contains(matrix.nix.version, '2.3') && runner.os != 'macOS' }}

View file

@ -4,17 +4,20 @@ on:
pull_request:
push:
jobs:
build:
linters:
name: Linters
runs-on: ubuntu-latest
strategy:
matrix:
nix:
- name: 2.10.3
- version: 2.10.3
url: https://releases.nixos.org/nix/nix-2.10.3/install
steps:
- uses: actions/checkout@v2.3.4
- uses: cachix/install-nix-action@v17
with:
install_url: ${{ matrix.nix.url }}

View file

@ -10,21 +10,26 @@ on:
- release-0.4.x
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
if: github.repository == 'zhaofengli/colmena'
strategy:
matrix:
nix:
- name: 2.10.3
- version: 2.10.3
url: https://releases.nixos.org/nix/nix-2.10.3/install
steps:
- uses: actions/checkout@v3.0.2
- uses: cachix/install-nix-action@v17
with:
install_url: ${{ matrix.nix.url }}
extra_nix_config: |
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v10
with:
name: colmena

View file

@ -10,7 +10,10 @@ on:
- completed
jobs:
deploy-unstable:
name: Deploy
runs-on: ubuntu-latest
if: github.repository == 'zhaofengli/colmena'
strategy:
matrix:
@ -20,11 +23,13 @@ jobs:
steps:
- uses: actions/checkout@v3.0.2
- uses: cachix/install-nix-action@v17
with:
install_url: ${{ matrix.nix.url }}
extra_nix_config: |
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v10
with:
name: colmena

42
.github/workflows/tests.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: Tests
on:
pull_request:
push:
jobs:
tests:
strategy:
matrix:
os:
- label: Linux
image: ubuntu-latest
nix:
- version: 2.3.16
url: https://releases.nixos.org/nix/nix-2.3.16/install
- version: 2.4
url: https://releases.nixos.org/nix/nix-2.4/install
- version: 2.10.3
url: https://releases.nixos.org/nix/nix-2.10.3/install
name: ${{ matrix.os.label }} + Nix ${{ matrix.nix.version }}
runs-on: ${{ matrix.os.image }}
steps:
- uses: actions/checkout@v2.3.5
- uses: cachix/install-nix-action@v17
with:
install_url: ${{ matrix.nix.url }}
extra_nix_config: |
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v10
with:
name: colmena
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Set up pinned nixpkgs
run: echo "NIX_PATH=nixpkgs=$(nix-instantiate --eval flake-compat.nix -A defaultNix.inputs.nixpkgs.outPath | sed 's|\"||g')" >> $GITHUB_ENV
- run: nix-shell --run "cargo test"
if: ${{ !contains(matrix.nix.version, '2.3') }}
- run: nix-shell --run "cargo test -- --skip flake"
if: ${{ contains(matrix.nix.version, '2.3') }}