Skip to content

Commit

Permalink
Use cabal to build binary release
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervdj committed Jan 14, 2025
1 parent 940e848 commit 9478fb9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 83 deletions.
33 changes: 12 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,27 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
stack: ["2.15.7"]
ghc: ["9.6.2"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: haskell-actions/setup@v2
name: Setup Haskell Stack
id: setup
with:
enable-stack: true
stack-version: ${{ matrix.stack }}
stack-no-global: true
ghc-version: ${{ matrix.ghc }}

- uses: actions/cache@v2
name: Cache ~/.stack
- uses: actions/cache@v3
with:
path: ~/.stack
key: "${{ runner.os }}-v9-${{ hashFiles('stylish-haskell.cabal', 'stack.yaml', 'stack.yaml.lock') }}"
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-v1-${{ hashFiles('*.cabal') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-v1-
- name: Add ~/.local/bin to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- run: make build
- run: make test

- name: Build
run: make build
id: build

- name: Test
run: make test

- name: Build artifact
if: startsWith(github.ref, 'refs/tags')
- if: startsWith(github.ref, 'refs/tags')
run: make artifact

- uses: actions/upload-artifact@v4
Expand Down
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ COMPRESS_BIN_DEPS=$(UPX_BINARY)
COMPRESS_BIN=upx
endif

STACK=stack

# Default target.
.PHONY: build
build: $(STYLISH_BINARY)
Expand All @@ -49,7 +47,7 @@ $(STYLISH_PACKAGE).$(ARCHIVE): $(STYLISH_BINARY) $(COMPRESS_BIN_DEPS)
$(ARCHIVE_CREATE) $(STYLISH_PACKAGE).$(ARCHIVE) $(STYLISH_PACKAGE)

$(STYLISH_BINARY):
$(STACK) build --copy-bins
cabal install --installdir="$(dir $(STYLISH_BINARY))"

# UPX is used to compress the resulting binary. We currently don't use this on
# Mac OS.
Expand All @@ -62,4 +60,4 @@ $(UPX_BINARY):

.PHONY: test
test:
stack build --test
cabal test
11 changes: 0 additions & 11 deletions stack.yaml

This file was deleted.

47 changes: 0 additions & 47 deletions stack.yaml.lock

This file was deleted.

0 comments on commit 9478fb9

Please sign in to comment.