| 1 |
name: Ubuntu build |
| 2 |
on: |
| 3 |
push: |
| 4 |
branches: |
| 5 |
- master |
| 6 |
- experimental |
| 7 |
- 'v*-release' |
| 8 |
pull_request: |
| 9 |
branches: |
| 10 |
- master |
| 11 |
- experimental |
| 12 |
merge_group: |
| 13 |
|
| 14 |
######################################################################## |
| 15 |
## CONFIGURATION |
| 16 |
## |
| 17 |
## See SETTINGS for the most important configuration variable: AGDA_COMMIT. |
| 18 |
## It has to be defined as a build step because it is potentially branch |
| 19 |
## dependent. |
| 20 |
## |
| 21 |
## As for the rest: |
| 22 |
## |
| 23 |
## Basically do not touch GHC_VERSION and CABAL_VERSION as long as |
| 24 |
## they aren't a problem in the build. If you have time to waste, it |
| 25 |
## could be worth investigating whether newer versions of ghc produce |
| 26 |
## more efficient Agda executable and could cut down the build time. |
| 27 |
## Just be aware that actions are flaky and small variations are to be |
| 28 |
## expected. |
| 29 |
## |
| 30 |
## The CABAL_INSTALL variable only passes `-O1` optimisations to ghc |
| 31 |
## because github actions cannot currently handle a build using `-O2`. |
| 32 |
## To be experimented with again in the future to see if things have |
| 33 |
## gotten better. |
| 34 |
## |
| 35 |
## We mostly use `v1-install` rather than `install` as Agda as a community |
| 36 |
## hasn't figured out how to manage dependencies with the new local |
| 37 |
## style builds (see agda/agda#4627 for details). Once this is resolved |
| 38 |
## we should upgrade to `install`. |
| 39 |
## |
| 40 |
## The AGDA variable specifies the command to use to build the library. |
| 41 |
## It currently passes the flag `-Werror` to ensure maximal compliance |
| 42 |
## with e.g. not relying on deprecated definitions. |
| 43 |
## The rest are some arbitrary runtime arguments that shape the way Agda |
| 44 |
## allocates and garbage collects memory. It should make things faster. |
| 45 |
## Limits can be bumped if the builds start erroring with out of memory |
| 46 |
## errors. |
| 47 |
## |
| 48 |
######################################################################## |
| 49 |
|
| 50 |
env: |
| 51 |
GHC_VERSION: 9.10.1 |
| 52 |
CABAL_VERSION: 3.12.1.0 |
| 53 |
CABAL_V1_INSTALL: cabal v1-install --ghc-options='-O1 +RTS -M6G -RTS' |
| 54 |
CABAL_INSTALL: cabal install --overwrite-policy=always --ghc-options='-O1 +RTS -M6G -RTS' |
| 55 |
AGDA: agda -Werror +RTS -M5G -H3.5G -A128M -RTS -i. -isrc -idoc |
| 56 |
|
| 57 |
jobs: |
| 58 |
test-stdlib: |
| 59 |
runs-on: ubuntu-latest |
| 60 |
steps: |
| 61 |
|
| 62 |
######################################################################## |
| 63 |
## SETTINGS |
| 64 |
## |
| 65 |
## AGDA_COMMIT picks the version of Agda to use to build the library. |
| 66 |
## It can either be a hash of a specific commit (to target a bugfix for |
| 67 |
## instance) or a tag e.g. tags/v2.6.1.3 (to target a released version). |
| 68 |
## |
| 69 |
## AGDA_HTML_DIR picks the html/ subdir in which to publish the docs. |
| 70 |
## The content of the html/ directory will be deployed so we put the |
| 71 |
## master version at the root and the experimental in a subdirectory. |
| 72 |
######################################################################## |
| 73 |
|
| 74 |
- name: Initialise variables |
| 75 |
run: | |
| 76 |
if [[ '${{ github.ref }}' == 'refs/heads/experimental' \ |
| 77 |
|| '${{ github.base_ref }}' == 'experimental' ]]; then |
| 78 |
# Pick Agda version for experimental |
| 79 |
echo "AGDA_COMMIT=ef912c68fd329ad3046d156e3c1a70a7fec19ba1" >> "${GITHUB_ENV}"; |
| 80 |
echo "AGDA_HTML_DIR=html/experimental" >> "${GITHUB_ENV}" |
| 81 |
else |
| 82 |
# Pick Agda version for master |
| 83 |
echo "AGDA_COMMIT=tags/v2.8.0-rc3" >> "${GITHUB_ENV}"; |
| 84 |
echo "AGDA_HTML_DIR=html/master" >> "${GITHUB_ENV}" |
| 85 |
fi |
| 86 |
|
| 87 |
if [[ '${{ github.ref }}' == 'refs/heads/master' \ |
| 88 |
|| '${{ github.ref }}' == 'refs/heads/experimental' ]]; then |
| 89 |
echo "AGDA_DEPLOY=true" >> "${GITHUB_ENV}" |
| 90 |
fi |
| 91 |
|
| 92 |
######################################################################## |
| 93 |
## CACHING |
| 94 |
######################################################################## |
| 95 |
|
| 96 |
|
| 97 |
# This caching step allows us to save a lot of building time by only |
| 98 |
# downloading ghc and cabal and rebuilding Agda if absolutely necessary |
| 99 |
# i.e. if we change either the version of Agda, ghc, or cabal that we want |
| 100 |
# to use for the build. |
| 101 |
- name: Cache ~/.cabal directories |
| 102 |
uses: actions/cache@v4 |
| 103 |
id: cache-cabal |
| 104 |
with: |
| 105 |
path: | |
| 106 |
~/.cabal/packages |
| 107 |
~/.cabal/store |
| 108 |
~/.cabal/bin |
| 109 |
~/.cabal/share |
| 110 |
key: ${{ runner.os }}-${{ env.GHC_VERSION }}-${{ env.CABAL_VERSION }}-${{ env.AGDA_COMMIT }}-cache |
| 111 |
|
| 112 |
######################################################################## |
| 113 |
## INSTALLATION STEPS |
| 114 |
######################################################################## |
| 115 |
|
| 116 |
- name: Install ghc & cabal |
| 117 |
uses: haskell-actions/setup@v2 |
| 118 |
with: |
| 119 |
ghc-version: ${{ env.GHC_VERSION }} |
| 120 |
cabal-version: ${{ env.CABAL_VERSION }} |
| 121 |
cabal-update: true |
| 122 |
|
| 123 |
- name: Put cabal programs in PATH |
| 124 |
run: echo ~/.cabal/bin >> "${GITHUB_PATH}" |
| 125 |
|
| 126 |
- name: Install alex & happy |
| 127 |
if: steps.cache-cabal.outputs.cache-hit != 'true' |
| 128 |
run: | |
| 129 |
${{ env.CABAL_INSTALL }} alex |
| 130 |
${{ env.CABAL_INSTALL }} happy |
| 131 |
# happy>=2.0 cannot be v1-installed: https://github.com/haskell/happy/issues/315 |
| 132 |
# Since we only need the executable, it is fine to use v2-install here. |
| 133 |
|
| 134 |
- name: Download and install Agda from github |
| 135 |
if: steps.cache-cabal.outputs.cache-hit != 'true' |
| 136 |
run: | |
| 137 |
git clone https://github.com/agda/agda |
| 138 |
cd agda |
| 139 |
git checkout ${{ env.AGDA_COMMIT }} |
| 140 |
mkdir -p doc |
| 141 |
touch doc/user-manual.pdf |
| 142 |
${{ env.CABAL_V1_INSTALL }} |
| 143 |
cd .. |
| 144 |
|
| 145 |
######################################################################## |
| 146 |
## TESTING |
| 147 |
######################################################################## |
| 148 |
|
| 149 |
# By default github actions do not pull the repo |
| 150 |
- name: Checkout stdlib |
| 151 |
uses: actions/checkout@v4 |
| 152 |
|
| 153 |
- name: Test stdlib |
| 154 |
run: | |
| 155 |
# Including deprecated modules purely for testing |
| 156 |
cabal run GenerateEverything -- --include-deprecated |
| 157 |
${{ env.AGDA }} -WnoUserWarning --safe EverythingSafe.agda |
| 158 |
${{ env.AGDA }} -WnoUserWarning Everything.agda |
| 159 |
|
| 160 |
- name: Prepare HTML index |
| 161 |
run: | |
| 162 |
# Regenerating the Everything files without the deprecated modules |
| 163 |
cabal run GenerateEverything |
| 164 |
cp .github/tooling/* . |
| 165 |
./index.sh |
| 166 |
${{ env.AGDA }} --safe EverythingSafe.agda |
| 167 |
${{ env.AGDA }} Everything.agda |
| 168 |
${{ env.AGDA }} index.agda |
| 169 |
|
| 170 |
- name: Golden testing |
| 171 |
run: | |
| 172 |
${{ env.CABAL_V1_INSTALL }} clock |
| 173 |
make testsuite INTERACTIVE='' AGDA_EXEC='~/.cabal/bin/agda' |
| 174 |
|
| 175 |
|
| 176 |
######################################################################## |
| 177 |
## DOC DEPLOYMENT |
| 178 |
######################################################################## |
| 179 |
|
| 180 |
# We start by retrieving the currently deployed docs |
| 181 |
# We remove the content that is in the directory we are going to populate |
| 182 |
# so that stale files corresponding to deleted modules do not accumulate. |
| 183 |
# We then generate the docs in the AGDA_HTML_DIR subdirectory |
| 184 |
- name: Generate HTML |
| 185 |
run: | |
| 186 |
git clone --depth 1 --single-branch --branch gh-pages https://github.com/agda/agda-stdlib html |
| 187 |
rm -f '${{ env.AGDA_HTML_DIR }}'/*.html |
| 188 |
rm -f '${{ env.AGDA_HTML_DIR }}'/*.css |
| 189 |
${{ env.AGDA }} --html --html-dir ${{ env.AGDA_HTML_DIR }} index.agda |
| 190 |
cp .github/tooling/* . |
| 191 |
./landing.sh |
| 192 |
|
| 193 |
- name: Deploy HTML |
| 194 |
uses: JamesIves/github-pages-deploy-action@v4 |
| 195 |
if: success() && env.AGDA_DEPLOY |
| 196 |
|
| 197 |
with: |
| 198 |
branch: gh-pages |
| 199 |
folder: html |
| 200 |
git-config-name: Github Actions |