|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_call: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build_and_test: |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + ghc_version: |
| 14 | + - '9.8' |
| 15 | + - '9.10' |
| 16 | + - '9.12' |
| 17 | + - '9.14' |
| 18 | + include: |
| 19 | + - ghc_version: '9.8.1' |
| 20 | + oldest: true |
| 21 | + |
| 22 | + name: build_and_test (${{ matrix.ghc_version }}) |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + steps: |
| 26 | + - |
| 27 | + uses: actions/checkout@v3 |
| 28 | + - |
| 29 | + id: setup |
| 30 | + name: Set up GHC ${{ matrix.ghc_version }} |
| 31 | + uses: haskell-actions/setup@v2 |
| 32 | + with: |
| 33 | + ghc-version: ${{ matrix.ghc_version }} |
| 34 | + - |
| 35 | + name: Configure the build |
| 36 | + run: |
| 37 | + cabal configure |
| 38 | + --enable-test |
| 39 | + --test-show-details=streaming |
| 40 | + - |
| 41 | + if: ${{ matrix.oldest }} |
| 42 | + name: Use oldest dependencies |
| 43 | + run: cabal configure --enable-append --prefer-oldest |
| 44 | + - |
| 45 | + name: Get build plan |
| 46 | + run: cabal build --dry-run |
| 47 | + - |
| 48 | + name: Get current month to clear cache |
| 49 | + run: echo "CURR_MONTH=$(date +%B)" | tee -a "$GITHUB_ENV" |
| 50 | + - |
| 51 | + uses: actions/cache@v3 |
| 52 | + with: |
| 53 | + path: ${{ steps.setup.outputs.cabal-store }} |
| 54 | + key: ${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}-${{ hashFiles('**/plan.json') }} |
| 55 | + restore-keys: | |
| 56 | + ${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}- |
| 57 | + - |
| 58 | + name: Build + Test |
| 59 | + run: cabal test |
| 60 | + |
| 61 | + lint: |
| 62 | + runs-on: ubuntu-latest |
| 63 | + env: |
| 64 | + FOURMOLU_VERSION: '0.19.0.1' |
| 65 | + steps: |
| 66 | + - |
| 67 | + uses: actions/checkout@v3 |
| 68 | + - |
| 69 | + name: Install fourmolu |
| 70 | + run: | |
| 71 | + curl -sSL \ |
| 72 | + "https://github.com/fourmolu/fourmolu/releases/download/v${FOURMOLU_VERSION}/fourmolu-${FOURMOLU_VERSION}-linux-x86_64" \ |
| 73 | + -o /usr/local/bin/fourmolu |
| 74 | + chmod +x /usr/local/bin/fourmolu |
| 75 | + - |
| 76 | + name: Run fourmolu |
| 77 | + run: fourmolu -m check . |
| 78 | + |
| 79 | + build_sdist: |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - |
| 83 | + uses: actions/checkout@v3 |
| 84 | + - |
| 85 | + id: setup |
| 86 | + name: Set up GHC |
| 87 | + uses: haskell-actions/setup@v2 |
| 88 | + - |
| 89 | + name: Strip unreleased section from CHANGELOG |
| 90 | + run: sed -i -n '/^## Unreleased/d; /^## /,$p' CHANGELOG.md |
| 91 | + - |
| 92 | + name: Create sdist bundle |
| 93 | + run: cabal sdist --output-directory=. |
| 94 | + - |
| 95 | + uses: actions/upload-artifact@v4 |
| 96 | + with: |
| 97 | + name: kdl-sdist |
| 98 | + path: kdl-*.tar.gz |
0 commit comments