-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (72 loc) · 2.85 KB
/
coverage.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Main
on: [push]
jobs:
check_coverage:
permissions:
contents: write
runs-on: ${{ github.repository_owner == 'EpitechPromo2027' && 'self-hosted' || 'ubuntu-latest' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache GHCup
uses: actions/cache@v4
id: ghcup-cache
with:
path: /home/runner/.ghcup
key: ${{ runner.os }}-ghcup-${{ hashFiles('**/*.cabal') }}
restore-keys: |
${{ runner.os }}-ghcup-
- name: Cache Cabal
uses: actions/cache@v4
id: cabal-cache
with:
path: /home/runner/.cabal
key: ${{ runner.os }}-cabal-${{ hashFiles('**/*.cabal') }}
restore-keys: |
${{ runner.os }}-cabal-
- name: Install required packages
run: sudo apt update && sudo apt install -y build-essential libffi-dev libgmp-dev zlib1g-dev
- name: Setup Haskell
if: ${{ steps.cabal-cache.outputs.cache-hit != 'true' && steps.ghcup-cache.outputs.cache-hit != 'true' }}
uses: ./external/haskell-setup
with:
ghc-version: 9.4.8
cabal-version: 3.10.3.0
- name: Install dependencies
if: ${{ steps.cabal-cache.outputs.cache-hit != 'true' }}
run: |
cabal update
cabal install hspec-discover hpc-codecov --overwrite-policy=always
- name: Setup environment
if: ${{ steps.cabal-cache.outputs.cache-hit == 'true' && steps.ghcup-cache.outputs.cache-hit == 'true' }}
run: |
echo "/home/runner/.cabal/bin" >> $GITHUB_PATH
echo "/home/runner/.ghcup/bin" >> $GITHUB_PATH
# This is disabled for the moment since EPITECH CI runners are not powerful enough to build the project
- name: Build project
run: cabal build --jobs=1
- name: Test project
run: |
cabal configure --enable-coverage --disable-library-coverage
cabal test --jobs=1
- name: Generate coverage report
run: |
hpc-codecov cabal:glados-test --exclude Main,Paths_glados --out codecov.json --format codecov --verbose
- name: Send coverage report
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: ${{ github.repository }}
- name: Generate Haddock documentation
if: github.ref == 'refs/heads/main'
run: |
cabal haddock --haddock-html --haddock-hyperlink-source
echo "DOCS_DIR=$(find dist-newstyle/build -type d -path '*/doc/html/*' | head -n 1)" >> $GITHUB_ENV
- name: Deploy Haddock to GitHub Pages
uses: ./external/actions-gh-pages
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.DOCS_DIR }}