Skip to content

Commit

Permalink
Update CI (#47)
Browse files Browse the repository at this point in the history
- Add custom names for jobs
- Use multiple LLVM versions in the matrix
- Fix cache
- Update README
- Clean up the code
  • Loading branch information
AzimMuradov authored Oct 5, 2024
1 parent 0e30e15 commit 12e38e3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,38 @@ on:

jobs:
build:
name: "build (os: ${{ matrix.os }}, ghc: ${{ matrix.ghc }}, cabal: ${{ matrix.cabal }}, llvm: ${{ matrix.llvm }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
ghc: ["9.4.8"]
cabal: ["3.8"]
llvm: ["16", "17", "18"]

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Haskell
uses: haskell-actions/setup@v2
id: setup-hs
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Configure the build
# The last step generates "dist-newstyle/cache/plan.json" for the cache key
run: |
cabal configure --enable-tests --enable-benchmarks --disable-documentation
cabal build all --dry-run
- name: Cache Cabal
uses: actions/cache@v4
env:
cache-name: cache-cabal
key-prefix: build-cache-cabal-os-${{ runner.os }}-ghc-${{ steps.setup-hs.outputs.ghc-version }}-cabal-${{ steps.setup-hs.outputs.cabal-version }}-llvm-${{ matrix.llvm }}
with:
path: ~/.cabal
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-
path: ${{ steps.setup-hs.outputs.cabal-store }}
key: ${{ env.key-prefix }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key-prefix }}-
- name: Set up HLint
uses: haskell-actions/hlint-setup@v2
- name: Run HLint
Expand All @@ -46,11 +54,11 @@ jobs:
lib/**/*.hs
test/**/*.hs
- name: Install LLVM
run: sudo apt install -y llvm-17 llvm-17-dev
run: sudo apt install -y llvm-${{ matrix.llvm }} llvm-${{ matrix.llvm }}-dev
- name: Build project
run: cabal build
- name: Run tests
run: >
cabal test
--test-show-details=direct
--test-options "--color=always"
cabal test
--test-show-details=direct
--test-options "--color=always"
20 changes: 13 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,43 @@ on:

jobs:
docs:
name: "docs (os: ${{ matrix.os }}, ghc: ${{ matrix.ghc }}, cabal: ${{ matrix.cabal }}, llvm: ${{ matrix.llvm }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
ghc: ["9.4.8"]
cabal: ["3.8"]
llvm: ["18"]

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Haskell
uses: haskell-actions/setup@v2
id: setup-hs
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Configure the build
# The last step generates "dist-newstyle/cache/plan.json" for the cache key
run: |
cabal configure --disable-tests --disable-benchmarks --enable-documentation
cabal build all --dry-run
- name: Cache Cabal
uses: actions/cache@v4
env:
cache-name: cache-cabal
key-prefix: docs-cache-cabal-os-${{ runner.os }}-ghc-${{ steps.setup-hs.outputs.ghc-version }}-cabal-${{ steps.setup-hs.outputs.cabal-version }}-llvm-${{ matrix.llvm }}
with:
path: ~/.cabal
key: ${{ runner.os }}-docs-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: ${{ runner.os }}-docs-${{ env.cache-name }}-
path: ${{ steps.setup-hs.outputs.cabal-store }}
key: ${{ env.key-prefix }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key-prefix }}-
- name: Install LLVM
run: sudo apt install -y llvm-17 llvm-17-dev
run: sudo apt install -y llvm-${{ matrix.llvm }} llvm-${{ matrix.llvm }}-dev
- name: Build docs
run: >
cabal haddock
--haddock-options="--ignore-all-exports"
--enable-documentation
--haddock-html-location='https://hackage.haskell.org/package/$pkg-$version/docs'
--haddock-hyperlink-source
--haddock-options=--quickjump
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ Global options:

- **GHC**: 9.4.8
- **Cabal**: 3.8
- **LLVM**: >=16
- **LLVM**: 16-18

[Implementation details](docs/dev/impl.md)
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source-repository-package
type: git
location: https://github.com/AzimMuradov/llvm-codegen.git
tag: f77d7cd82b40004d7eadc6fcc1ff536db599206e
tag: a0fc18fad8471def82eea59eb383d3defbb49efe

packages: .

0 comments on commit 12e38e3

Please sign in to comment.