Updating math-comp-nix to version 2 #140
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cachix | |
on: | |
pull_request: | |
branches: | |
- master | |
- v2 | |
jobs: | |
setup: | |
name: Computing matrix of tested versions | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3.5.3 | |
- uses: cachix/install-nix-action@v21 | |
with: | |
nix_path: nixpkgs=channel:nixpkgs-unstable | |
- name: Setup build matrix | |
id: set-matrix | |
run: echo "matrix=$(./ci-matrix.sh)" >> $GITHUB_OUTPUT | |
builds: | |
name: Build mathcomp and coq combination | |
runs-on: ubuntu-latest | |
needs: setup | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.setup.outputs.matrix)}} | |
steps: | |
- uses: cachix/install-nix-action@v21 | |
with: | |
nix_path: nixpkgs=channel:nixpkgs-unstable | |
- uses: cachix/cachix-action@v12 | |
with: | |
# Name of a cachix cache to push and pull/substitute | |
name: math-comp | |
extraPullNames: coq | |
# Authentication token for Cachix, needed only for private cache access | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- name: Checkout | |
uses: actions/checkout@v3.5.3 | |
- name: Building mathcomp-full-shell target if required | |
run: | | |
overrides="{coq = \"${{ matrix.coq }}\"; mathcomp = \"${{ matrix.mc }}\";}" | |
storepath=$(nix eval --impure --expr "(\"\${import ./. {override = $overrides;}}\")") | |
hash=$(echo $storepath | sed "s/\"//mg" | xargs basename | cut -d- -f1) | |
url=https://math-comp.cachix.org/$hash.narinfo | |
if curl --output /dev/null --silent --head --fail "$url"; then | |
echo "In cache: $url, doing nothing" | |
else | |
echo "Not in cache, compiling" | |
nix-build --no-out-link --arg override "$overrides" | |
fi | |
summary: | |
name: Generate summary | |
runs-on: ubuntu-latest | |
needs: builds | |
steps: | |
- uses: cachix/install-nix-action@v21 | |
with: | |
nix_path: nixpkgs=channel:nixpkgs-unstable | |
- uses: cachix/cachix-action@v12 | |
with: | |
# Name of a cachix cache to push and pull/substitute | |
name: math-comp | |
extraPullNames: coq | |
# Authentication token for Cachix, needed only for private cache access | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
## does not work because the PR is updated only once | |
- name: Checkout | |
uses: actions/checkout@v3.5.3 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Update README.md | |
id: set-nixenv | |
run: | | |
./update-readme.sh | |
- name: Commit README.md | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: 'Updating README.md' | |
add: 'README.md' |