Skip to content

Commit 12ab16e

Browse files
committed
Selfhosted GHA runner test
1 parent 7bffb71 commit 12ab16e

File tree

1 file changed

+45
-98
lines changed

1 file changed

+45
-98
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ name: CI
44
on:
55
pull_request:
66
push:
7-
branches: [main]
8-
workflow_dispatch:
7+
# branches: [main]
8+
# workflow_dispatch:
99

1010

1111
concurrency:
@@ -15,7 +15,7 @@ concurrency:
1515
jobs:
1616
stack:
1717
name: Stack tests
18-
runs-on: ubuntu-latest
18+
runs-on: self-hosted
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v4
@@ -62,99 +62,8 @@ jobs:
6262
run: |
6363
.ci/test_stack.sh
6464
65-
cabal:
66-
name: Cabal tests - ghc ${{ matrix.ghc }} / clash ${{ matrix.clash }} / doc ${{ matrix.check_haddock }}
67-
runs-on: ${{ matrix.os }}
68-
strategy:
69-
fail-fast: false
70-
matrix:
71-
os: [ubuntu-latest]
72-
clash:
73-
- "1.8.2"
74-
cabal:
75-
- "3.14.1.1"
76-
ghc:
77-
- "9.2.8"
78-
- "9.4.8"
79-
- "9.8.4"
80-
- "9.10.1"
81-
include:
82-
- check_haddock: "False"
83-
- ghc: "9.6.6"
84-
check_haddock: "True"
85-
os: "ubuntu-latest"
86-
clash: "1.8.2"
87-
cabal: "3.14.1.1"
88-
89-
env:
90-
check_haddock: ${{ matrix.check_haddock }}
91-
clash_version: ${{ matrix.clash }}
92-
93-
steps:
94-
- name: Checkout
95-
uses: actions/checkout@v4
96-
97-
- name: Setup Haskell
98-
uses: haskell-actions/setup@v2
99-
id: setup-haskell-cabal
100-
with:
101-
ghc-version: ${{ matrix.ghc }}
102-
cabal-version: ${{ matrix.cabal }}
103-
104-
- name: Use CI specific settings
105-
run: |
106-
.ci/apply_settings.sh
107-
108-
- name: Setup CI
109-
run: |
110-
cabal v2-freeze
111-
mv cabal.project.freeze frozen
112-
113-
- name: Restore cached dependencies
114-
uses: actions/cache/restore@v4
115-
id: cache
116-
env:
117-
key:
118-
${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{
119-
steps.setup-haskell.outputs.cabal-version }}${{
120-
matrix.project-variant }}
121-
with:
122-
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
123-
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
124-
restore-keys: |
125-
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
126-
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-
127-
${{ runner.os }}-ghc-${{ matrix.ghc }}-
128-
129-
- name: Install dependencies
130-
run: cabal v2-build all --enable-tests --only-dependencies
131-
132-
# Cache dependencies already at this point, so that we do not have to
133-
# rebuild them should the subsequent steps fail
134-
- name: Save cached dependencies
135-
uses: actions/cache/save@v4
136-
# Trying to save over an existing cache gives distracting
137-
# "Warning: Cache save failed." since they are immutable
138-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
139-
with:
140-
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
141-
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
142-
143-
- name: Build
144-
run: |
145-
cabal v2-build all --enable-tests
146-
147-
- name: Test
148-
run: |
149-
.ci/test_cabal.sh
150-
151-
- name: Documentation
152-
if: ${{ matrix.check_haddock == 'True' }}
153-
run: |
154-
.ci/build_docs.sh
155-
15665
fourmolu:
157-
runs-on: ubuntu-latest
66+
runs-on: self-hosted
15867
steps:
15968
# Note that you must checkout your code before running haskell-actions/run-fourmolu
16069
- uses: actions/checkout@v3
@@ -167,7 +76,7 @@ jobs:
16776
16877
linting:
16978
name: Source code linting
170-
runs-on: ubuntu-latest
79+
runs-on: self-hosted
17180
steps:
17281
- name: Checkout
17382
uses: actions/checkout@v4
@@ -176,17 +85,54 @@ jobs:
17685
run: |
17786
.ci/test_whitespace.sh
17887
88+
nix:
89+
name: Nix/Cabal Tests
90+
runs-on: self-hosted
91+
steps:
92+
- name: Checkout
93+
uses: actions/checkout@v4
94+
95+
# There's no need to configure Nix, the dockerfile handling the GHA has it done for us!
96+
# If a dependencies are already cached, we can simply re-use them!
97+
98+
- name: Nix Build & Test GHC 9.10.1
99+
run: |
100+
nix build .#ghc9101.clash-protocols-base
101+
nix build .#ghc9101.clash-protocols
102+
103+
- name: Nix Build & Test GHC 9.8.2
104+
run: |
105+
nix build .#ghc982.clash-protocols-base
106+
nix build .#ghc982.clash-protocols
107+
108+
- name: Nix Build & Test GHC 9.6.4
109+
run: |
110+
nix build .#ghc964.clash-protocols-base
111+
nix build .#ghc964.clash-protocols
112+
113+
- name: Push results to cache
114+
env:
115+
ATTIC_TOKEN: ${{ secrets.ATTIC_SECRET }}
116+
run: |
117+
attic login --set-default public http://192.168.102.136:9200/ "$ATTIC_TOKEN"
118+
attic push public $(nix path-info .#ghc9101.clash-protocols-base)
119+
attic push public $(nix path-info .#ghc9101.clash-protocols)
120+
attic push public $(nix path-info .#ghc982.clash-protocols-base)
121+
attic push public $(nix path-info .#ghc982.clash-protocols)
122+
attic push public $(nix path-info .#ghc964.clash-protocols-base)
123+
attic push public $(nix path-info .#ghc964.clash-protocols)
124+
179125
# Mandatory check on GitHub
180126
all:
181127
name: All jobs finished
182128
if: always()
183129
needs: [
184-
cabal,
130+
nix,
185131
fourmolu,
186132
linting,
187133
stack,
188134
]
189-
runs-on: ubuntu-22.04
135+
runs-on: self-hosted
190136
steps:
191137
- name: Checkout
192138
uses: actions/checkout@v4
@@ -218,3 +164,4 @@ jobs:
218164
- name: Check that the 'all' job depends on all other jobs
219165
run: |
220166
.github/scripts/all_check.py
167+

0 commit comments

Comments
 (0)