Skip to content

Bump actions/checkout from 3 to 4 #9837

Bump actions/checkout from 3 to 4

Bump actions/checkout from 3 to 4 #9837

Workflow file for this run

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 }}
should_skip_build: ${{ steps.skip_check_no_nix.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
with:
cancel_others: false
paths_ignore: '[ "**/docs/**"
, "**.md"
, "**/LICENSE"
, ".circleci/**"
, "**/README.md"
, "FUNDING.yml"
, "**/stack*.yaml"
, "**/stack*.yaml"
, ".gitlab-ci.yaml"
, ".gitlab/**"
]'
- id: skip_check_no_nix
uses: fkirc/[email protected]
with:
cancel_others: false
paths: '[ "**.nix" ]'
# 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@v4
- uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
experimental-features = nix-command flakes
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: haskell-language-server
# Disable pushing, we will do that in job `build`
skipPush: true
- run: |
nix develop --print-build-logs --command cabal update
nix develop --print-build-logs --command cabal build
# Build and then push HLS binaries with developmet shell to cachix
# This job runs when
# 1. PRs are merged to master (runs on master)
# 2. Nix files are changed (runs on PR)
build:
needs: pre_job
runs-on: ${{ matrix.os }}
env:
HAS_TOKEN: ${{ secrets.HLS_CACHIX_AUTH_TOKEN != '' }}
if: (needs.pre_job.outputs.should_skip_build != 'true' && needs.pre_job.outputs.should_skip_pr != 'true') || (github.repository_owner == 'haskell' && github.ref == 'refs/heads/master')
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
experimental-features = nix-command flakes
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: haskell-language-server
authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }}
- name: Build development shell
run: nix develop --print-build-logs --profile dev
- name: Build all development shell (without nix dependencies)
run: nix develop --print-build-logs .#all-simple-dev-shells --profile dev
# We only build nix dev shell for current GHC version because some are
# failing with different GHC version on darwin.
- name: Build development shell with nix dependencies for current GHC version
if: matrix.os == 'macOS-latest'
run: nix develop --print-build-logs .#haskell-language-server-dev-nix --profile dev
- name: Build development shells with nix dependencies
if: matrix.os == 'ubuntu-latest'
run: nix develop --print-build-logs .#all-nix-dev-shells --profile dev
- name: Push development shell
if: ${{ env.HAS_TOKEN == 'true' }}
run: cachix push haskell-language-server dev
- name: Build binaries
run: nix build --print-build-logs
- name: Build all binaries
run: nix build --print-build-logs .#all-haskell-language-server
- name: Push binaries
if: ${{ env.HAS_TOKEN == 'true' }}
run: nix path-info --json | jq -r '.[].path' | cachix push haskell-language-server
nix_post_job:
if: always()
runs-on: ubuntu-latest
needs: [pre_job, develop, build]
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