|
| 1 | +name: CI |
| 2 | + |
| 3 | +# Run CI when a PR is opened against the branch `master` |
| 4 | +# and when one pushes a commit to `master`. |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [master] |
| 8 | + pull_request: |
| 9 | + branches: [master] |
| 10 | + |
| 11 | +# Run CI on all 3 latest OSes |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - name: Set up Node toolchain |
| 23 | + uses: actions/setup-node@v3 |
| 24 | + with: |
| 25 | + node-version: "16" |
| 26 | + |
| 27 | + - name: Cache NPM dependencies |
| 28 | + uses: actions/cache@v3 |
| 29 | + env: |
| 30 | + cache-name: cache-node-modules |
| 31 | + with: |
| 32 | + path: ~/.npm |
| 33 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} |
| 34 | + restore-keys: | |
| 35 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 36 | + ${{ runner.os }}-build- |
| 37 | + ${{ runner.os }}- |
| 38 | +
|
| 39 | + - name: Setup PureScript tooling |
| 40 | + run: |
| 41 | + npm i -g purescript@latest purs-tidy@latest purescript-psa@latest spago@latest |
| 42 | + |
| 43 | + - name: Install NPM dependencies |
| 44 | + run: npm install |
| 45 | + |
| 46 | + - name: Cache PureScript dependencies |
| 47 | + uses: actions/cache@v3 |
| 48 | + with: |
| 49 | + key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }} |
| 50 | + path: | |
| 51 | + .spago |
| 52 | + output |
| 53 | +
|
| 54 | + # Compile the library/project |
| 55 | + # censor-lib: ignore warnings emitted by dependencies |
| 56 | + # strict: convert warnings into errors |
| 57 | + # Note: `purs-args` actually forwards these args to `psa` |
| 58 | + - name: Build the project |
| 59 | + run: | |
| 60 | + npx spago build --purs-args "--censor-lib --strict" |
| 61 | +
|
| 62 | + - name: Run tests |
| 63 | + run: | |
| 64 | + npx spago test |
| 65 | +
|
| 66 | + - name: Check Formatting |
| 67 | + if: runner.os == 'Linux' |
| 68 | + run: | |
| 69 | + purs-tidy check src test |
0 commit comments