.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: strategy:
matrix: matrix:
os: os:
- ubuntu-latest - label: Linux
- macos-11 image: ubuntu-latest
- label: macOS
image: macos-11
nix: nix:
- name: 2.10.3 - version: 2.10.3
url: https://releases.nixos.org/nix/nix-2.10.3/install 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: steps:
- uses: actions/checkout@v3.0.2 - uses: actions/checkout@v3.0.2
- uses: cachix/install-nix-action@v17 - uses: cachix/install-nix-action@v17
with: with:
install_url: ${{ matrix.nix.url }} install_url: ${{ matrix.nix.url }}
@ -28,48 +33,15 @@ jobs:
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix flake check - 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 - name: Build Colmena
run: nix build -L 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 - name: Build and install Colmena with flake-compat
run: nix-env -if default.nix run: nix-env -if default.nix
- name: Build manual - name: Build manual
run: nix build .#manual -L run: nix build .#manual -L
if: ${{ !contains(matrix.nix.name, '2.3') && runner.os != 'macOS' }} if: ${{ !contains(matrix.nix.version, '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') }}

View file

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

View file

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

View file

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