Skip to content

Commit 989e4f2

Browse files
committed
Use setup-agda action in CI; simplify caching of _build
1 parent 21da184 commit 989e4f2

File tree

1 file changed

+9
-87
lines changed

1 file changed

+9
-87
lines changed

.github/workflows/ci-ubuntu.yml

Lines changed: 9 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,14 @@ on:
1212
##
1313
## Key variables:
1414
##
15-
## AGDA_COMMIT picks the version of Agda to use to build the library.
16-
## It can either be a hash of a specific commit (to target a bugfix for
17-
## instance) or a tag e.g. tags/v2.6.1.3 (to target a released version).
15+
## AGDA_VERSION picks the version of Agda to use to build the library.
1816
##
1917
## STDLIB_VERSION picks the version of the stdlib to pull. The current
2018
## design requires that the number corresponds to a released version
2119
## but we could change that to a commit-based approach if you need to.
2220
##
2321
## The rest:
2422
##
25-
## Basically do not touch GHC_VERSION and CABAL_VERSION as long as
26-
## they aren't a problem in the build. If you have time to waste, it
27-
## could be worth investigating whether newer versions of ghc produce
28-
## more efficient Agda executable and could cut down the build time.
29-
## Just be aware that actions are flaky and small variations are to be
30-
## expected.
31-
##
32-
## The CABAL_INSTALL variable only passes `-O1` optimisations to ghc
33-
## because github actions cannot currently handle a build using `-O2`.
34-
## To be experimented with again in the future to see if things have
35-
## gotten better.
36-
##
3723
## The AGDA variable specifies the command to use to build the library.
3824
## It currently passes the flag `-Werror` to ensure maximal compliance
3925
## with e.g. not relying on deprecated definitions.
@@ -45,12 +31,9 @@ on:
4531
########################################################################
4632

4733
env:
48-
AGDA_COMMIT: tags/v2.6.4
34+
AGDA_VERSION: "2.7.0.1"
4935
STDLIB_VERSION: "2.1"
5036

51-
GHC_VERSION: 8.10.7
52-
CABAL_VERSION: 3.6.2.0
53-
CABAL_INSTALL: cabal install --overwrite-policy=always --ghc-options='-O1 +RTS -M6G -RTS' --installdir $HOME/.cabal/bin
5437
AGDA: agda --auto-inline -Werror +RTS -M6G -H3.5G -A128M -RTS -i . -i src/
5538

5639
jobs:
@@ -73,11 +56,6 @@ jobs:
7356
echo "AGDA_DEPLOY=true" >> $GITHUB_ENV
7457
fi
7558
76-
# The script won't be able to find Agda if we don't tell it to look at the
77-
# content of ~/.cabal/bin
78-
- name: Put cabal programs in PATH
79-
run: echo "$HOME/.cabal/bin" >> $GITHUB_PATH
80-
8159
########################################################################
8260
## CACHING
8361
########################################################################
@@ -91,64 +69,20 @@ jobs:
9169
id: cache-everything
9270
with:
9371
path: |
94-
~/.cabal/packages
95-
~/.cabal/store
96-
~/.cabal/bin
97-
~/.cabal/share
98-
~/.agda-build-cache
99-
key: agda-categories-${{ runner.os }}-${{ env.GHC_VERSION }}-${{ env.CABAL_VERSION }}-${{ env.AGDA_COMMIT }}-cache
100-
101-
# If a build cache exists for agda-categories, use it, but don't fail if
102-
# there isn't.
103-
- name: Unpack agda-categories build cache
104-
if: steps.cache-everything.outputs.cache-hit == 'true'
105-
run: |
106-
cp -rpv ~/.agda-build-cache/agda-categories ./_build/ || exit 0
72+
~/.agda
73+
~/_build
74+
key: ${{ runner.os }}-agda-${{ env.AGDA_VERSION }}
10775

10876
########################################################################
10977
## INSTALLATION STEPS
11078
########################################################################
11179

112-
- name: Install ghc and cabal
80+
- name: Install Agda
11381
if: steps.cache-everything.outputs.cache-hit != 'true'
114-
uses: haskell-actions/setup@v2
82+
uses: wenkokke/setup-agda@main
11583
with:
116-
ghc-version: ${{ env.GHC_VERSION }}
117-
cabal-version: ${{ env.CABAL_VERSION }}
118-
119-
- name: Cabal update
120-
if: steps.cache-everything.outputs.cache-hit != 'true'
121-
run: cabal update
122-
123-
- name: Download and install Agda from github
124-
if: steps.cache-everything.outputs.cache-hit != 'true'
125-
run: |
126-
git clone https://github.com/agda/agda
127-
cd agda
128-
git checkout ${{ env.AGDA_COMMIT }}
129-
mkdir -p doc
130-
touch doc/user-manual.pdf
131-
# make sure it exists
132-
mkdir -p $HOME/.cabal/bin
133-
${{ env.CABAL_INSTALL }}
134-
cd ..
135-
136-
- name: Install stdlib
137-
run: |
138-
mkdir -p $HOME/.agda
139-
cd $HOME/.agda
140-
wget https://github.com/agda/agda-stdlib/archive/v${{ env.STDLIB_VERSION }}.tar.gz
141-
tar -xzvf v${{ env.STDLIB_VERSION }}.tar.gz
142-
mv agda-stdlib-${{ env.STDLIB_VERSION }} agda-stdlib
143-
echo "~/.agda/agda-stdlib/standard-library.agda-lib" > libraries
144-
cd -
145-
146-
# If a build cache exists for agda-stdlib, use it, but don't fail if there
147-
# isn't.
148-
- name: Unpack agda-stdlib build cache
149-
if: steps.cache-everything.outputs.cache-hit == 'true'
150-
run: |
151-
cp -rpv ~/.agda-build-cache/agda-stdlib ~/.agda/agda-stdlib/_build/ || exit 0
84+
agda-version: ${{ env.AGDA_VERSION }}
85+
agda-stdlib-version: ${{ env.STDLIB_VERSION }}
15286

15387
########################################################################
15488
## TESTING
@@ -169,18 +103,6 @@ jobs:
169103
run: |
170104
${{ env.AGDA }} --html --html-dir html index.agda
171105
172-
########################################################################
173-
## PACKAGE BUILD CACHING
174-
########################################################################
175-
176-
# Package type-checked agda-stdlib and agda-categories libraries for
177-
# future CI runs.
178-
- name: "Pack Agda build cache"
179-
run: |
180-
mkdir -p ~/.agda-build-cache/
181-
cp -rpv ./_build/ ~/.agda-build-cache/agda-categories/ || exit 0
182-
cp -rpv ~/.agda/agda-stdlib/_build/ ~/.agda-build-cache/agda-stdlib/ || exit 0
183-
184106
########################################################################
185107
## DEPLOYMENT
186108
########################################################################

0 commit comments

Comments
 (0)