Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix nix build for #1858 #1870

Merged
merged 4 commits into from
May 27, 2021
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
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: fkirc/skip-duplicate-actions@v3.4.0
with:
cancel_others: true
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "nix/**", "**/test/**"]'
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "**.nix", "**/test/**", "flake.lock"]'

bench-init:
needs: pre_job
Expand Down
39 changes: 27 additions & 12 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
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/skip-duplicate-actions@master
with:
cancel_others: true
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**"]'
- id: skip_check_no_nix
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: false
paths: '["**.nix"]'

# Enter the development shell and run `cabal build`
develop:
Expand All @@ -31,34 +37,39 @@ jobs:
os: [ubuntu-latest, macOS-latest]

steps:
- if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
- if: ${{ needs.pre_job.outputs.should_skip_develop != 'true' }}
uses: actions/checkout@v2
with:
submodules: true
- if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
- if: ${{ needs.pre_job.outputs.should_skip_develop != '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
- if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
- if: ${{ needs.pre_job.outputs.should_skip_develop != 'true' }}
uses: cachix/cachix-action@v10
with:
name: haskell-language-server
# Disable pushing, we will do that in job `build`
skipPush: true
- if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
- if: ${{ needs.pre_job.outputs.should_skip_develop != 'true' }}
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
# 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 }}
if: ${{ github.repository_owner == 'haskell' && github.ref == 'refs/heads/master' }}
env:
HAS_TOKEN: ${{ secrets.HLS_CACHIX_AUTH_TOKEN != '' }}
if: ${{ needs.pre_job.outputs.should_skip_build != 'true' || (github.repository_owner == 'haskell' && github.ref == 'refs/heads/master') }}
strategy:
fail-fast: false
matrix:
Expand All @@ -79,9 +90,13 @@ jobs:
with:
name: haskell-language-server
authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }}
- name: Build development shell
run: nix develop --profile dev
- name: Push development shell
run: nix develop --profile dev && cachix push haskell-language-server dev
- name: Build and push binaries
run: |
nix build
nix path-info --json | jq -r '.[].path' | cachix push haskell-language-server
if: ${{ env.HAS_TOKEN == 'true' }}
run: cachix push haskell-language-server dev
- name: Build binaries
run: nix build
- name: Push binaries
if: ${{ env.HAS_TOKEN == 'true' }}
run: nix path-info --json | jq -r '.[].path' | cachix push haskell-language-server
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: fkirc/skip-duplicate-actions@v3.4.0
with:
cancel_others: true
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "nix/**"]'
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "**.nix", "flake.lock"]'
# If we only change ghcide downstream packages we have not test ghcide itself
- id: skip_ghcide_check
uses: fkirc/skip-duplicate-actions@v3.4.0
Expand Down
20 changes: 18 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,29 @@
} // pluginSourceDirs;

# Tweak our packages
# Don't use `callHackage`, it requires us to override `all-cabal-hashes`
tweaks = hself: hsuper:
with haskell.lib; {
hls-hlint-plugin =
hsuper.hls-hlint-plugin.override { hlint = hself.hlint_3_2_7; };

# https://github.com/haskell/haskell-language-server/pull/1858
# Remove this override when nixpkgs has this package
apply-refact_0_9_3_0 = hself.callCabal2nix "apply-refact"
(builtins.fetchTarball {
url =
"https://hackage.haskell.org/package/apply-refact-0.9.3.0/apply-refact-0.9.3.0.tar.gz";
sha256 =
"1jfq1aw91finlpq5nn7a96za4c8j13jk6jmx2867fildxwrik2qj";
}) { };

hls-hlint-plugin = hsuper.hls-hlint-plugin.override {
hlint = hself.hlint_3_2_7;
apply-refact = hself.apply-refact_0_9_3_0;
};

hls-tactics-plugin = hsuper.hls-tactics-plugin.override {
refinery = hself.refinery_0_3_0_0;
};

};

hlsSources =
Expand Down