Skip to content

Commit 1d6d77c

Browse files
committed
Improve workflow
1 parent ce6d0ae commit 1d6d77c

File tree

1 file changed

+32
-42
lines changed

1 file changed

+32
-42
lines changed

.github/workflows/test.yaml

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,64 +9,54 @@ on:
99
jobs:
1010
test:
1111
name: Test metadata
12-
runs-on: ${{ matrix.os }}
12+
runs-on: [self-hosted, Linux, X64]
1313
env:
1414
YAML_VER: 0.0.9
15-
strategy:
16-
matrix:
17-
ghc:
18-
- '9.8.4'
19-
cabal:
20-
- '3.12.1.0'
21-
os:
22-
- ubuntu-22.04
15+
GHC_VER: 9.8.4
16+
CABAL_VER: 3.12.1.0
17+
container:
18+
image: debian:12
2319
steps:
2420
- name: Checkout code
25-
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
21+
uses: actions/checkout@v4
2622

27-
- uses: haskell-actions/setup@ec49483bfc012387b227434aba94f59a6ecd0900 # v2.7.5
23+
- name: Disable cabal XDG
24+
run: |
25+
echo "CABAL_DIR=${GITHUB_WORKSPACE}/.cabal" >> "$GITHUB_ENV"
26+
27+
- name: Prerequisites
28+
run: |
29+
export DEBIAN_FRONTEND=noninteractive
30+
export TZ=Asia/Singapore
31+
apt update -y
32+
apt install -y libarchive-dev build-essential curl libffi-dev libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 libnuma-dev curl bash git pip python3
33+
mkdir -p "$HOME/.local/bin"
34+
echo "$HOME/.local/bin" >> $GITHUB_PATH
35+
pip install --break-system-packages yamllint
36+
shell: bash
37+
38+
- uses: haskell/ghcup-setup@v1
2839
with:
29-
ghc-version: ${{ matrix.ghc }}
30-
cabal-version: ${{ matrix.cabal }}
40+
ghc: ${{ env.GHC_VER }}
41+
cabal: ${{ env.CABAL_VER }}
3142

3243
- name: Cache Cabal
33-
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # v2.1.7
44+
uses: actions/cache@v4
3445
env:
3546
cache-name: cache-cabal
3647
with:
3748
path: |
38-
~/.cabal/store
39-
~/.cabal/packages
40-
key: v2-${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-build-${{ hashFiles('cabal.project') }}
49+
.cabal/store
50+
.cabal/packages
51+
key: v2-${{ runner.os }}-${{ env.GHC_VER }}-${{ env.CABAL_VER }}-build-${{ hashFiles('cabal.project') }}
4152
restore-keys: |
42-
v2-${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-build-${{ hashFiles('cabal.project') }}
43-
v2-${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-build-
44-
v2-${{ runner.os }}-${{ matrix.ghc }}
45-
46-
- name: create ~/.local/bin
47-
run: mkdir -p "$HOME/.local/bin"
48-
shell: bash
49-
50-
- name: Add ~/.local/bin to PATH
51-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
52-
shell: bash
53-
54-
- name: install yamllint
55-
run: pip install yamllint
56-
57-
- name: Update cabal cache
58-
run: cabal update
59-
shell: bash
60-
61-
- name: Install some deps
62-
run: |
63-
export DEBIAN_FRONTEND=noninteractive
64-
export TZ=Asia/Singapore
65-
sudo apt install -y libarchive-dev
66-
shell: bash
53+
v2-${{ runner.os }}-${{ env.GHC_VER }}-${{ env.CABAL_VER }}-build-${{ hashFiles('cabal.project') }}
54+
v2-${{ runner.os }}-${{ env.GHC_VER }}-${{ env.CABAL_VER }}-build-
55+
v2-${{ runner.os }}-${{ env.GHC_VER }}
6756
6857
- name: Install ghcup-gen
6958
run: |
59+
cabal update
7060
cabal install --installdir="$HOME/.local/bin" --overwrite-policy=always --install-method=copy ghcup-gen
7161
shell: bash
7262

0 commit comments

Comments
 (0)