Haskell CI #6725
Workflow file for this run
This file contains hidden or 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: Haskell CI | |
| on: | |
| merge_group: | |
| pull_request: | |
| push: | |
| # we need this to populate cache for `master` branch to make it available to the child branches, see | |
| # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache | |
| branches: | |
| - master | |
| # GH caches are removed when not accessed within 7 days - this schedule runs the job every 6 days making | |
| # sure that we always have some caches on master | |
| schedule: | |
| - cron: '0 0 */6 * *' | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.sys.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ghc: [&ghc-stable "9.6", "9.10", &ghc-latest "9.12"] | |
| cabal: [&cabal-version "3.16"] | |
| sys: | |
| - { os: ubuntu-latest, shell: bash } | |
| include: | |
| # Using include, to make sure there will only be one macOS job, even if the matrix gets expanded later on. | |
| # We want a single job, because macOS runners are scarce. | |
| - ghc: *ghc-stable | |
| cabal: *cabal-version | |
| sys: | |
| os: macos-latest | |
| shell: bash | |
| - ghc: *ghc-latest | |
| cabal: *cabal-version | |
| sys: | |
| os: windows-latest | |
| shell: 'C:/msys64/usr/bin/bash.exe -e {0}' | |
| defaults: | |
| run: | |
| shell: ${{ matrix.sys.shell }} | |
| env: | |
| # Modify this value to "invalidate" the cabal cache. | |
| CABAL_CACHE_VERSION: "2024-07-26" | |
| # these two are msys2 env vars, they have no effect on non-msys2 installs. | |
| MSYS2_PATH_TYPE: inherit | |
| MSYSTEM: MINGW64 | |
| concurrency: | |
| group: > | |
| a+${{ github.event_name }} | |
| b+${{ github.workflow_ref }} | |
| c+${{ github.job }} | |
| d+${{ matrix.ghc }} | |
| e+${{ matrix.cabal }} | |
| f+${{ matrix.sys.os }} | |
| g+${{ (startsWith(github.ref, 'refs/heads/gh-readonly-queue/') && github.run_id) || github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - name: Concurrency group | |
| run: > | |
| echo | |
| a+${{ github.event_name }} | |
| b+${{ github.workflow_ref }} | |
| c+${{ github.job }} | |
| d+${{ matrix.ghc }} | |
| e+${{ matrix.cabal }} | |
| f+${{ matrix.sys.os }} | |
| g+${{ (startsWith(github.ref, 'refs/heads/gh-readonly-queue/') && github.run_id) || github.event.pull_request.number || github.ref }} | |
| - name: Install Haskell | |
| uses: input-output-hk/actions/haskell@latest | |
| id: setup-haskell | |
| with: | |
| ghc-version: ${{ matrix.ghc }} | |
| cabal-version: ${{ matrix.cabal }} | |
| - name: Install system dependencies | |
| uses: input-output-hk/actions/base@latest | |
| with: | |
| use-sodium-vrf: true # default is true | |
| - uses: actions/checkout@v4 | |
| - name: Install gRPC system dependencies | |
| uses: ./.github/actions/grpc-deps | |
| - name: Cache and install Cabal dependencies | |
| uses: ./.github/actions/cabal-cache | |
| with: | |
| cabal-store: ${{ steps.setup-haskell.outputs.cabal-store }} | |
| cache-version: ${{ env.CABAL_CACHE_VERSION }} | |
| - name: '[Linux] [cardano-rpc] Install buf tool' | |
| if: runner.os == 'Linux' | |
| run: | | |
| curl -sSL "https://github.com/bufbuild/buf/releases/latest/download/buf-Linux-x86_64" -o "/usr/local/bin/buf" | |
| chmod +x /usr/local/bin/buf | |
| - name: '[Linux] [cardano-rpc] Install proto-lens-protoc tool' | |
| if: runner.os == 'Linux' | |
| run: cabal install proto-lens-protoc --installdir=$HOME/.local/bin | |
| - name: '[Linux] [cardano-rpc] Generate protobuf code' | |
| if: runner.os == 'Linux' | |
| working-directory: cardano-rpc | |
| run: buf generate proto | |
| - name: '[Linux] [cardano-rpc] Check that generated files from proto definitions are up to date' | |
| if: runner.os == 'Linux' | |
| run: | | |
| git add cardano-rpc/gen | |
| if ! git diff --staged --quiet -- cardano-rpc/gen; then | |
| echo "Generated files differ from repository files:" | |
| git diff --staged --name-status -- cardano-rpc/gen | |
| exit 1 | |
| fi | |
| echo "All generated files match repository files" | |
| # Now we build. | |
| - name: Build all | |
| run: cabal build all --enable-tests | |
| - name: Run tests | |
| env: | |
| TMPDIR: ${{ runner.temp }} | |
| TMP: ${{ runner.temp }} | |
| KEEP_WORKSPACE: 1 | |
| run: cabal test all --enable-tests --test-show-details=direct | |
| # Uncomment the following back in for debugging. Remember to launch a `pwsh` from | |
| # the tmux session to debug `pwsh` issues. And be reminded that the `/msys2` and | |
| # `/msys2/mingw64` paths are not in PATH by default for the workflow, but tmate | |
| # will put them in. | |
| # You may also want to run | |
| # | |
| # $env:PATH=("C:\Program Files\PowerShell\7;{0}" -f $env:ORIGINAL_PATH) | |
| # | |
| # to restore the original path. Do note that some test might need msys2 | |
| # and will silently fail if msys2 is not in path. See the "Run tests" step. | |
| # | |
| # - name: Setup tmate session | |
| # if: ${{ failure() }} | |
| # uses: mxschmitt/action-tmate@v3 | |
| # with: | |
| # limit-access-to-actor: true | |
| build-complete: | |
| needs: [build] | |
| if: ${{ always() }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check if any previous job failed | |
| run: | | |
| if [[ "${{ needs.build.result }}" == "failure" ]]; then | |
| # this ignores skipped dependencies | |
| echo 'Required jobs failed to build.' | |
| exit 1 | |
| else | |
| echo 'Build complete' | |
| fi | |
| release: | |
| needs: [build] | |
| if: ${{ startsWith(github.ref, 'refs/tags') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Create Release Tag | |
| id: create_release_tag | |
| run: | | |
| echo "TAG=${GITHUB_REF/refs\/tags\//}" >> "$GITHUB_OUTPUT" | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Release ${{ github.ref }} | |
| draft: true | |
| prerelease: false |