Soulomoon/refactor hls test util #147
This file contains 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: Nix | |
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. | |
concurrency: | |
group: ${{ github.head_ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- '**' | |
push: | |
branches: | |
- master | |
jobs: | |
pre_job: | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip_develop: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@v5.3.1 | |
with: | |
cancel_others: false | |
paths_ignore: '[ "**/docs/**" | |
, "**.md" | |
, "**/LICENSE" | |
, ".circleci/**" | |
, "**/README.md" | |
, "FUNDING.yml" | |
, "**/stack*.yaml" | |
, "**/stack*.yaml" | |
, ".gitlab-ci.yaml" | |
, ".gitlab/**" | |
]' | |
# Enter the development shell and run `cabal build` | |
develop: | |
if: needs.pre_job.outputs.should_skip_develop != 'true' | |
needs: pre_job | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macOS-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v26 | |
with: | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v14 | |
with: | |
name: haskell-language-server | |
authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }} | |
# Don't try and run the build (although that would be a good | |
# test), it takes a long time and we have sometimes had | |
# glibc incompatibilities with the runners | |
- run: | | |
nix develop --print-build-logs --command true | |
nix_post_job: | |
if: always() | |
runs-on: ubuntu-latest | |
needs: [pre_job, develop] | |
steps: | |
- run: | | |
echo "jobs info: ${{ toJSON(needs) }}" | |
- if: contains(needs.*.result, 'failure') | |
run: exit 1 | |
- if: contains(needs.*.result, 'cancelled') && needs.pre_job.outputs.should_skip != 'true' | |
run: exit 1 |