|
| 1 | +# SPDX-License-Identifier: AGPL-3.0-or-later |
| 2 | +name: Idris 2 CI |
| 3 | + |
| 4 | +permissions: read-all |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [main] |
| 9 | + paths: |
| 10 | + - 'src/**' |
| 11 | + - 'proven.ipkg' |
| 12 | + - '.github/workflows/idris2-ci.yml' |
| 13 | + pull_request: |
| 14 | + branches: [main] |
| 15 | + paths: |
| 16 | + - 'src/**' |
| 17 | + - 'proven.ipkg' |
| 18 | + - '.github/workflows/idris2-ci.yml' |
| 19 | + workflow_dispatch: |
| 20 | + |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + idris2-version: ['0.7.0'] |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
| 31 | + |
| 32 | + - name: Install Idris 2 dependencies |
| 33 | + run: | |
| 34 | + sudo apt-get update |
| 35 | + sudo apt-get install -y chezscheme libgmp-dev |
| 36 | +
|
| 37 | + - name: Cache Idris 2 |
| 38 | + id: cache-idris2 |
| 39 | + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 |
| 40 | + with: |
| 41 | + path: | |
| 42 | + ~/.idris2 |
| 43 | + ~/idris2-${{ matrix.idris2-version }} |
| 44 | + key: idris2-${{ matrix.idris2-version }}-${{ runner.os }} |
| 45 | + |
| 46 | + - name: Install Idris 2 |
| 47 | + if: steps.cache-idris2.outputs.cache-hit != 'true' |
| 48 | + run: | |
| 49 | + git clone --depth 1 --branch v${{ matrix.idris2-version }} https://github.com/idris-lang/Idris2.git ~/idris2-${{ matrix.idris2-version }} |
| 50 | + cd ~/idris2-${{ matrix.idris2-version }} |
| 51 | + make bootstrap SCHEME=chezscheme |
| 52 | + make install |
| 53 | +
|
| 54 | + - name: Add Idris 2 to PATH |
| 55 | + run: echo "$HOME/.idris2/bin" >> $GITHUB_PATH |
| 56 | + |
| 57 | + - name: Build proven library |
| 58 | + run: idris2 --build proven.ipkg |
| 59 | + |
| 60 | + - name: Type check all modules |
| 61 | + run: | |
| 62 | + idris2 --check src/Proven.idr |
| 63 | + idris2 --check src/Proven/Core.idr |
| 64 | + idris2 --check src/Proven/SafeMath.idr |
| 65 | + idris2 --check src/Proven/SafeString.idr |
| 66 | + idris2 --check src/Proven/SafeJson.idr |
| 67 | + idris2 --check src/Proven/SafeUrl.idr |
| 68 | + idris2 --check src/Proven/SafeEmail.idr |
| 69 | + idris2 --check src/Proven/SafePath.idr |
| 70 | + idris2 --check src/Proven/SafeCrypto.idr |
| 71 | + idris2 --check src/Proven/SafePassword.idr |
| 72 | + idris2 --check src/Proven/SafeDateTime.idr |
| 73 | + idris2 --check src/Proven/SafeNetwork.idr |
| 74 | +
|
| 75 | + docs: |
| 76 | + runs-on: ubuntu-latest |
| 77 | + needs: build |
| 78 | + if: github.ref == 'refs/heads/main' |
| 79 | + |
| 80 | + steps: |
| 81 | + - name: Checkout |
| 82 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
| 83 | + |
| 84 | + - name: Install Idris 2 dependencies |
| 85 | + run: | |
| 86 | + sudo apt-get update |
| 87 | + sudo apt-get install -y chezscheme libgmp-dev |
| 88 | +
|
| 89 | + - name: Cache Idris 2 |
| 90 | + id: cache-idris2 |
| 91 | + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 |
| 92 | + with: |
| 93 | + path: | |
| 94 | + ~/.idris2 |
| 95 | + ~/idris2-0.7.0 |
| 96 | + key: idris2-0.7.0-${{ runner.os }} |
| 97 | + |
| 98 | + - name: Install Idris 2 |
| 99 | + if: steps.cache-idris2.outputs.cache-hit != 'true' |
| 100 | + run: | |
| 101 | + git clone --depth 1 --branch v0.7.0 https://github.com/idris-lang/Idris2.git ~/idris2-0.7.0 |
| 102 | + cd ~/idris2-0.7.0 |
| 103 | + make bootstrap SCHEME=chezscheme |
| 104 | + make install |
| 105 | +
|
| 106 | + - name: Add Idris 2 to PATH |
| 107 | + run: echo "$HOME/.idris2/bin" >> $GITHUB_PATH |
| 108 | + |
| 109 | + - name: Generate documentation |
| 110 | + run: idris2 --mkdoc proven.ipkg || true |
| 111 | + |
| 112 | + - name: Upload docs artifact |
| 113 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 114 | + with: |
| 115 | + name: idris2-docs |
| 116 | + path: build/docs/ |
| 117 | + if-no-files-found: ignore |
0 commit comments