Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 42 additions & 11 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
pull_request:
branches:
- '**'
push:
branches:
- master

jobs:
pre_job:
Expand All @@ -17,11 +20,10 @@ jobs:
cancel_others: true
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**"]'

nix:
# Enter the development shell and run `cabal build`
develop:
needs: pre_job
runs-on: ${{ matrix.os }}
env:
HAS_TOKEN: ${{ secrets.HLS_CACHIX_AUTH_TOKEN != '' }}

strategy:
fail-fast: false
Expand All @@ -41,14 +43,43 @@ jobs:
extra_nix_config: |
experimental-features = nix-command flakes
nix_path: nixpkgs=channel:nixos-unstable
- if: ${{ needs.pre_job.outputs.should_skip != 'true' && env.HAS_TOKEN == 'true' }}
uses: cachix/cachix-action@v8
- if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: cachix/cachix-action@v10
with:
name: haskell-language-server
authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }}
# Disable pushing, we will do that in job `build`
skipPush: true
- if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
run: nix build
- if: ${{ needs.pre_job.outputs.should_skip != 'true' && env.HAS_TOKEN == 'true' }}
run: nix develop --profile dev && cachix push haskell-language-server dev
- if: ${{ needs.pre_job.outputs.should_skip != 'true' && env.HAS_TOKEN == 'true' }}
run: nix path-info --json | jq -r '.[].path' | cachix push haskell-language-server
run: |
nix develop --command cabal update
nix develop --command cabal build

# Build and then push HLS binaries with developmet shell to cachix
# This job runs when PRs are merged to master, and should be excluded from branch protections
build:
runs-on: ${{ matrix.os }}
if: ${{ github.repository_owner == 'haskell' && github.ref == 'ref/heads/master' }}
Comment on lines +57 to +61
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]

steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: cachix/install-nix-action@v13
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/lb41az54kzk6j12p81br4bczary7m145/install
install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve'
extra_nix_config: |
experimental-features = nix-command flakes
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v10
with:
name: haskell-language-server
authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }}
- run: |
nix develop --profile dev && cachix push haskell-language-server dev
nix build
nix path-info --json | jq -r '.[].path' | cachix push haskell-language-server
11 changes: 11 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file is the compt layer of flakes: https://github.com/edolstra/flake-compat
# See flake.nix for details
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash; }
) {
src = ./.;
}).defaultNix