From 60d56f2bb32201be435b7cd4462dd778ed559aa4 Mon Sep 17 00:00:00 2001 From: Cyril Cohen Date: Fri, 12 Mar 2021 10:18:31 +0100 Subject: Use nix-tool-box --- .github/workflows/nix-action.yml | 107 +++++++++++++++++++++++++++++++++++++++ .github/workflows/nix.yml | 32 ------------ 2 files changed, 107 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/nix-action.yml delete mode 100644 .github/workflows/nix.yml (limited to '.github') diff --git a/.github/workflows/nix-action.yml b/.github/workflows/nix-action.yml new file mode 100644 index 0000000..dc920d9 --- /dev/null +++ b/.github/workflows/nix-action.yml @@ -0,0 +1,107 @@ +name: Nix CI + +on: + push: + branches: + - master + pull_request: + branches: + - '**' + +jobs: + dependencies: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Cachix install + uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=channel:nixpkgs-unstable + - name: Cachix setup coq + uses: cachix/cachix-action@v8 + with: + # Name of a cachix cache to pull/substitute + name: coq + - name: Cachix setup math-comp + uses: cachix/cachix-action@v8 + with: + # Name of a cachix cache to pull/substitute + name: math-comp + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Git checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Building/fetching dependencies + run: nix-build --argstr ci-job dependencies + - name: Setup build matrix + id: set-matrix + run: | + matrix=$(nix-shell --arg do-nothing true --run nixTasks) + echo ::set-output name=matrix::{\"task\":$(echo $matrix)}\" + + main: + runs-on: ubuntu-latest + needs: + - dependencies + strategy: + matrix: ${{fromJson(needs.dependencies.outputs.matrix)}} + fail-fast: false + steps: + - name: Cachix install + uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=channel:nixpkgs-unstable + - name: Cachix setup coq + uses: cachix/cachix-action@v8 + with: + # Name of a cachix cache to pull/substitute + name: coq + - name: Cachix setup math-comp + uses: cachix/cachix-action@v8 + with: + # Name of a cachix cache to pull/substitute + name: math-comp + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Git checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Building/fetching dependencies + run: nix-build --no-out-link --argstr ci "${{ matrix.task }}" --argstr ci-job dependencies + - name: Building/fetching current project + run: nix-build --no-out-link --argstr ci "${{ matrix.task }}" --argstr ci-job main + + shell: + runs-on: ubuntu-latest + needs: + - dependencies + strategy: + matrix: ${{fromJson(needs.dependencies.outputs.matrix)}} + fail-fast: false + steps: + - name: Cachix install + uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=channel:nixpkgs-unstable + - name: Cachix setup coq + uses: cachix/cachix-action@v8 + with: + # Name of a cachix cache to pull/substitute + name: coq + - name: Cachix setup math-comp + uses: cachix/cachix-action@v8 + with: + # Name of a cachix cache to pull/substitute + name: math-comp + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Git checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Building/fetching dependencies + run: nix-build --no-out-link --argstr ci "${{ matrix.task }}" --argstr ci-job dependencies + - name: Building/fetching current project + run: nix-build --no-out-link --argstr ci "${{ matrix.task }}" --argstr ci-job shell + diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml deleted file mode 100644 index 6a34426..0000000 --- a/.github/workflows/nix.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Cachix -on: - push: -jobs: - cachix: - name: Cachix branch - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - coq: [ "8.11", "8.12" ] - steps: - - name: Get branch shortname - run: echo "##[set-output name=name;]$(echo ${GITHUB_REF#refs/heads/})" - id: branch-short - - name: Get owner name - run: echo "##[set-output name=name;]$(echo $GITHUB_REPOSITORY | cut -d/ -f1)" - id: owner - - name: Get owner lowercase name - run: echo "##[set-output name=name;]$(echo $GITHUB_REPOSITORY | cut -d/ -f1 | tr '[:upper:]' '[:lower:]')" - id: owner-lowercase - - uses: cachix/install-nix-action@v12 - - uses: cachix/cachix-action@v8 - if: steps.owner.outputs.name == 'math-comp' || steps.owner.outputs.name == 'CohenCyril' - with: - # Name of a cachix cache to push and pull/substitute - name: ${{ steps.owner-lowercase.outputs.name }} - extraPullNames: coq - # Authentication token for Cachix, needed only for private cache access - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - # building fake mathcomp-fast target - - run: nix-build https://github.com/math-comp/math-comp-nix/archive/master.tar.gz --arg config '{coq = "${{ matrix.coq }}"; mathcomp = "${{ steps.owner.outputs.name }}/${{ steps.branch-short.outputs.name }}";}' --argstr package mathcomp -- cgit v1.2.3