Skip to content

Commit fcf7113

Browse files
Merge pull request #285 from gallais/actions
[ fix #284 ] github actions script
2 parents 04e1822 + 20e78c3 commit fcf7113

File tree

2 files changed

+167
-0
lines changed

2 files changed

+167
-0
lines changed

.github/workflows/ci-ubuntu.yml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: Ubuntu build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
10+
########################################################################
11+
## CONFIGURATION
12+
##
13+
## Key variables:
14+
##
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).
18+
##
19+
## STDLIB_VERSION picks the version of the stdlib to pull. The current
20+
## design requires that the number corresponds to a released version
21+
## but we could change that to a commit-based approach if you need to.
22+
##
23+
## The rest:
24+
##
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+
##
37+
## The AGDA variable specifies the command to use to build the library.
38+
## It currently passes the flag `-Werror` to ensure maximal compliance
39+
## with e.g. not relying on deprecated definitions.
40+
## The rest are some arbitrary runtime arguments that shape the way Agda
41+
## allocates and garbage collects memory. It should make things faster.
42+
## Limits can be bumped if the builds start erroring with out of memory
43+
## errors.
44+
##
45+
########################################################################
46+
47+
env:
48+
AGDA_COMMIT: 8eb0d01811a663cf2b27b482b3b18690adfa094b
49+
STDLIB_VERSION: 1.6
50+
51+
GHC_VERSION: 8.6.5
52+
CABAL_VERSION: 3.2.0.0
53+
CABAL_INSTALL: cabal install --overwrite-policy=always --ghc-options='-O1 +RTS -M6G -RTS'
54+
AGDA: agda -Werror +RTS -M3.5G -H3.5G -A128M -RTS -i. -i src/
55+
56+
jobs:
57+
test-categories:
58+
runs-on: ubuntu-latest
59+
steps:
60+
61+
########################################################################
62+
## SETTINGS
63+
########################################################################
64+
65+
- name: Initialise variables
66+
run: |
67+
# Only deploy if the build follows from pushing to master
68+
if [[ '${{ github.ref }}' == 'refs/heads/master' ]]; then
69+
echo "AGDA_DEPLOY=true" >> $GITHUB_ENV
70+
fi
71+
72+
# The script won't be able to find Agda if we don't tell it to look at the
73+
# content of ~/.cabal/bin
74+
- name: Put cabal programs in PATH
75+
run: echo "~/.cabal/bin" >> $GITHUB_PATH
76+
77+
########################################################################
78+
## CACHING
79+
########################################################################
80+
81+
# This caching step allows us to save a lot of building time by only
82+
# downloading ghc and cabal and rebuilding Agda if absolutely necessary
83+
# i.e. if we change either the version of Agda, ghc, or cabal that we want
84+
# to use for the build.
85+
- name: Cache cabal packages
86+
uses: actions/cache@v2
87+
id: cache-cabal
88+
with:
89+
path: |
90+
~/.cabal/packages
91+
~/.cabal/store
92+
~/.cabal/bin
93+
key: ${{ runner.os }}-${{ env.GHC_VERSION }}-${{ env.CABAL_VERSION }}-${{ env.AGDA_COMMIT }}
94+
95+
########################################################################
96+
## INSTALLATION STEPS
97+
########################################################################
98+
99+
- name: Install ghc and cabal
100+
if: steps.cache-cabal.outputs.cache-hit != 'true'
101+
uses: actions/setup-haskell@v1.1.3
102+
with:
103+
ghc-version: ${{ env.GHC_VERSION }}
104+
cabal-version: ${{ env.CABAL_VERSION }}
105+
106+
- name: Cabal update
107+
if: steps.cache-cabal.outputs.cache-hit != 'true'
108+
run: cabal update
109+
110+
- name: Download and install Agda from github
111+
if: steps.cache-cabal.outputs.cache-hit != 'true'
112+
run: |
113+
git clone https://github.com/agda/agda
114+
cd agda
115+
git checkout ${{ env.AGDA_COMMIT }}
116+
mkdir -p doc
117+
touch doc/user-manual.pdf
118+
${{ env.CABAL_INSTALL }}
119+
cd ..
120+
121+
- name: Install stdlib
122+
run: |
123+
mkdir -p $HOME/.agda
124+
cd $HOME/.agda
125+
wget https://github.com/agda/agda-stdlib/archive/v${{ env.STDLIB_VERSION }}.tar.gz
126+
tar -xzvf v${{ env.STDLIB_VERSION }}.tar.gz
127+
mv agda-stdlib-${{ env.STDLIB_VERSION }} agda-stdlib
128+
echo "~/.agda/agda-stdlib/standard-library.agda-lib" > libraries
129+
cd -
130+
131+
########################################################################
132+
## TESTING AND DEPLOYMENT
133+
########################################################################
134+
135+
# By default github actions do not pull the repo
136+
- name: Checkout agda-categories
137+
uses: actions/checkout@v2
138+
139+
# Generate a fresh Everything.agda & index.agda and start building!
140+
- name: Test agda-categories
141+
run: |
142+
cp travis/* .
143+
./everything.sh
144+
${{ env.AGDA }} Everything.agda
145+
${{ env.AGDA }} index.agda
146+
147+
# Note that if you want to deploy html for different versions like the
148+
# standard library does, you will need to be a bit more subtle in this
149+
# step.
150+
- name: Generate HTML
151+
run: |
152+
${{ env.AGDA }} --html --html-dir html index.agda
153+
154+
- name: Deploy HTML
155+
uses: JamesIves/github-pages-deploy-action@4.1.3
156+
if: ${{ success() && env.AGDA_DEPLOY }}
157+
158+
with:
159+
branch: gh-pages
160+
folder: html

travis/everything.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#/bin/sh
2+
3+
find src/ -name '[^\.]*.agda' \
4+
| sed -e 's|^src/[/]*|import |' -e 's|/|.|g' -e 's/.agda//' -e '/import Everything/d' \
5+
| LC_COLLATE='C' sort \
6+
> Everything.agda
7+
cat Everything.agda >> index.agda

0 commit comments

Comments
 (0)