|
8 | 8 |
|
9 | 9 | jobs: |
10 | 10 | build: |
11 | | - |
| 11 | + name: main |
12 | 12 | runs-on: ubuntu-latest |
13 | | - |
14 | 13 | steps: |
15 | | - |
16 | | - - name: Set user input permissions |
17 | | - run: sudo usermod -a -G input $USER |
18 | | - |
19 | | - - uses: actions/checkout@v2 |
20 | | - - uses: actions/setup-haskell@v1 |
21 | | - with: |
22 | | - ghc-version: '9.4.5' |
23 | | - cabal-version: '3.6.2.0' |
24 | | - |
25 | | - - name: Install libevdev |
26 | | - run: sudo apt install -y libevdev-dev |
27 | | - |
28 | | - - name: Cache |
29 | | - uses: actions/cache@v1 |
30 | | - env: |
31 | | - cache-name: cache-cabal |
32 | | - with: |
33 | | - path: ~/.cabal |
34 | | - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }} |
35 | | - restore-keys: | |
36 | | - ${{ runner.os }}-build-${{ env.cache-name }}- |
37 | | - ${{ runner.os }}-build- |
38 | | - ${{ runner.os }}- |
39 | | -
|
40 | | - - name: Install dependencies |
41 | | - run: | |
42 | | - cabal update |
43 | | - cabal build --only-dependencies --enable-tests --enable-benchmarks all |
44 | | - - name: Build |
45 | | - run: cabal build --enable-tests --enable-benchmarks all |
46 | | - - name: Run tests |
47 | | - run: | |
48 | | - cabal build test |
49 | | - find . -name test -type f -executable -exec sudo {} \; |
| 14 | + - uses: actions/checkout@v3 |
| 15 | + |
| 16 | + - name: Set user input permissions |
| 17 | + run: sudo usermod -a -G input $USER |
| 18 | + |
| 19 | + - name: Set up GHC |
| 20 | + uses: haskell-actions/setup@v2 |
| 21 | + id: setup |
| 22 | + with: |
| 23 | + ghc-version: '9.4' |
| 24 | + cabal-version: '3.10' |
| 25 | + cabal-update: true |
| 26 | + |
| 27 | + - name: Install libevdev |
| 28 | + run: sudo apt install -y libevdev-dev |
| 29 | + |
| 30 | + - name: Configure the build |
| 31 | + run: | |
| 32 | + cabal configure --enable-tests --enable-benchmarks --disable-documentation |
| 33 | + cabal build all --dry-run |
| 34 | +
|
| 35 | + - name: Restore cached dependencies |
| 36 | + uses: actions/cache/restore@v3 |
| 37 | + id: cache |
| 38 | + env: |
| 39 | + key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} |
| 40 | + with: |
| 41 | + path: ${{ steps.setup.outputs.cabal-store }} |
| 42 | + key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} |
| 43 | + restore-keys: ${{ env.key }}- |
| 44 | + |
| 45 | + - name: Install dependencies |
| 46 | + run: cabal build all --only-dependencies |
| 47 | + |
| 48 | + - name: Save cached dependencies |
| 49 | + uses: actions/cache/save@v3 |
| 50 | + if: ${{ steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }} |
| 51 | + with: |
| 52 | + path: ${{ steps.setup.outputs.cabal-store }} |
| 53 | + key: ${{ steps.cache.outputs.cache-primary-key }} |
| 54 | + |
| 55 | + - name: Build |
| 56 | + run: cabal build all |
| 57 | + |
| 58 | + - name: Run tests |
| 59 | + run: | |
| 60 | + cabal build test |
| 61 | + sudo $(cabal list-bin test) |
0 commit comments