diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0ef75f..6ee5781 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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' }} diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index d488ad7..4426547 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -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 }} diff --git a/.github/workflows/manual-stable.yml b/.github/workflows/manual-stable.yml index bf9cfbb..1f24d4d 100644 --- a/.github/workflows/manual-stable.yml +++ b/.github/workflows/manual-stable.yml @@ -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 diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index 46581d6..222d63f 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..428253b --- /dev/null +++ b/.github/workflows/tests.yml @@ -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') }}