Skip to content

Commit 5622d5d

Browse files
authored
Merge pull request #665 from IntersectMBO/wenkokke/fix-ci
ci: refactor workflows
2 parents 441f194 + 6e2ee1e commit 5622d5d

File tree

15 files changed

+613
-455
lines changed

15 files changed

+613
-455
lines changed
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "Print CPU info"
2+
description: "Prints CPU info"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- if: ${{ runner.os == 'macOS' }}
7+
run: sysctl -a machdep.cpu
8+
shell: sh
9+
10+
- if: ${{ runner.os == 'Linux' }}
11+
run: cat /proc/cpuinfo
12+
shell: sh
13+
14+
- if: ${{ runner.os == 'Windows' }}
15+
run: wmic cpu get caption, deviceid, name, numberofcores, maxclockspeed, status
16+
shell: cmd
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "Setup actionlint"
2+
description: "Install a specific actionlint version"
3+
inputs:
4+
actionlint-version:
5+
required: true
6+
description: "Version of actionlint"
7+
runs:
8+
using: composite
9+
steps:
10+
- name: 🛠️ Install actionlint
11+
if: ${{ env.ACT || steps.cache-actionlint.outputs.cache-hit != 'true' }}
12+
run: |
13+
mkdir --parents "${{ github.workspace }}/.actionlint/bin"
14+
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) ${{ inputs.actionlint-version }} "${{ github.workspace }}/.actionlint/bin"
15+
shell: bash
16+
17+
- name: 🛠️ Add actionlint to PATH
18+
run: echo "${{ github.workspace }}/.actionlint/bin" >> "$GITHUB_PATH"
19+
shell: sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Setup cabal-docspec"
2+
description: "Setup cabal-docspec"
3+
runs:
4+
using: composite
5+
steps:
6+
- name: 🛠️ Install cabal-docspec (Linux)
7+
if: ${{ runner.os == 'Linux' }}
8+
run: |
9+
mkdir -p "${{ github.workspace }}/.cabal-docspec/bin"
10+
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20240414/cabal-docspec-0.0.0.20240414-x86_64-linux.xz > "${{ runner.temp }}/cabal-docspec.xz"
11+
echo '2d18a3f79619e8ec5f11870f926f6dc2616e02a6c889315b7f82044b95a1adb9 ${{ runner.temp }}/cabal-docspec.xz' | sha256sum -c -
12+
xz -d < "${{ runner.temp }}/cabal-docspec.xz" > "${{ github.workspace }}/.cabal-docspec/bin/cabal-docspec"
13+
chmod a+x "${{ github.workspace }}/.cabal-docspec/bin/cabal-docspec"
14+
shell: sh
15+
16+
- name: 🛠️ Add cabal-docspec to PATH
17+
run: echo "${{ github.workspace }}/.cabal-docspec/bin" >> "$GITHUB_PATH"
18+
shell: sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "Setup cabal-fmt"
2+
description: "Install a specific cabal-fmt version"
3+
inputs:
4+
cabal-fmt-version:
5+
required: true
6+
description: "Version of cabal-fmt"
7+
ghc-version:
8+
required: true
9+
description: "Version of GHC"
10+
cabal-version:
11+
required: true
12+
description: "Version of cabal"
13+
hackage-index-state:
14+
required: false
15+
description: "Timestamp for Hackage index"
16+
runs:
17+
using: composite
18+
steps:
19+
- name: 💾 Restore cache
20+
uses: actions/cache/restore@v4
21+
if: ${{ !env.ACT }}
22+
id: cache-cabal-fmt
23+
with:
24+
path: "${{ github.workspace }}/.cabal-fmt/bin"
25+
key: ${{ runner.os }}-cabal-fmt-${{ inputs.cabal-fmt-version }}-input-state-${{ inputs.hackage-index-state }}
26+
27+
- name: 🛠️ Install Haskell
28+
if: ${{ env.ACT || steps.cache-cabal-fmt.outputs.cache-hit != 'true' }}
29+
uses: haskell-actions/setup@v2
30+
id: setup-haskell
31+
with:
32+
ghc-version: ${{ inputs.ghc-version }}
33+
cabal-version: ${{ inputs.cabal-version }}
34+
35+
- name: 🛠️ Install cabal-fmt
36+
if: ${{ env.ACT || steps.cache-cabal-fmt.outputs.cache-hit != 'true' }}
37+
run: |
38+
mkdir --parents "${{ github.workspace }}/.cabal-fmt/bin"
39+
cabal install cabal-fmt-${{ inputs.cabal-fmt-version }} \
40+
${{ inputs.hackage-index-state && format('--index-state={0}', inputs.hackage-index-state) }} \
41+
--overwrite-policy=always \
42+
--install-method=copy \
43+
--installdir="${{ github.workspace }}/.cabal-fmt/bin"
44+
shell: sh
45+
46+
- name: 🛠️ Add cabal-fmt to PATH
47+
run: echo "${{ github.workspace }}/.cabal-fmt/bin" >> "$GITHUB_PATH"
48+
shell: sh
49+
50+
- name: 💾 Save cache
51+
uses: actions/cache/save@v4
52+
if: ${{ !env.ACT && steps.cache-cabal-fmt.outputs.cache-hit != 'true' }}
53+
with:
54+
path: "${{ github.workspace }}/.cabal-fmt/bin"
55+
key: ${{ steps.cache-cabal-fmt.outputs.cache-primary-key }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
name: "Setup stylish-haskell"
3+
description: "Install a specific stylish-haskell version"
4+
inputs:
5+
stylish-haskell-version:
6+
required: true
7+
description: "Version of stylish-haskell"
8+
ghc-version:
9+
required: true
10+
description: "Version of GHC"
11+
cabal-version:
12+
required: true
13+
description: "Version of cabal"
14+
hackage-index-state:
15+
required: false
16+
description: "Timestamp for Hackage index"
17+
default: ""
18+
runs:
19+
using: composite
20+
steps:
21+
- name: 💾 Restore cache
22+
uses: actions/cache/restore@v4
23+
if: ${{ !env.ACT }}
24+
id: cache-stylish-haskell
25+
with:
26+
path: "${{ github.workspace }}/.stylish-haskell/bin"
27+
key: ${{ runner.os }}-stylish-haskell-${{ inputs.stylish-haskell-version }}-input-state-${{ inputs.hackage-index-state }}
28+
29+
- name: 🛠️ Install Haskell
30+
if: ${{ env.ACT || steps.cache-stylish-haskell.outputs.cache-hit != 'true' }}
31+
uses: haskell-actions/setup@v2
32+
id: setup-haskell
33+
with:
34+
ghc-version: ${{ inputs.ghc-version }}
35+
cabal-version: ${{ inputs.cabal-version }}
36+
37+
- name: 🛠️ Install stylish-haskell
38+
if: ${{ env.ACT || steps.cache-stylish-haskell.outputs.cache-hit != 'true' }}
39+
run: |
40+
mkdir --parents "${{ github.workspace }}/.stylish-haskell/bin"
41+
cabal install stylish-haskell-${{ inputs.stylish-haskell-version }} \
42+
${{ inputs.hackage-index-state && format('--index-state={0}', inputs.hackage-index-state) }} \
43+
--overwrite-policy=always \
44+
--install-method=copy \
45+
--installdir="${{ github.workspace }}/.stylish-haskell/bin"
46+
shell: sh
47+
48+
- name: 🛠️ Add stylish-haskell to PATH
49+
run: echo "${{ github.workspace }}/.stylish-haskell/bin" >> "$GITHUB_PATH"
50+
shell: sh
51+
52+
- name: 💾 Save cache
53+
uses: actions/cache/save@v4
54+
if: ${{ !env.ACT && steps.cache-stylish-haskell.outputs.cache-hit != 'true' }}
55+
with:
56+
path: "${{ github.workspace }}/.stylish-haskell/bin"
57+
key: ${{ steps.cache-stylish-haskell.outputs.cache-primary-key }}

0 commit comments

Comments
 (0)