Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5aba8b9
Split workflow into multiple jobs
silas-hw Jul 2, 2026
0951074
Split init into composible action
silas-hw Jul 2, 2026
0ac360d
Fix init
silas-hw Jul 2, 2026
ae3cdd7
Run checkout before composite action
silas-hw Jul 2, 2026
2095827
Fix checkout step
silas-hw Jul 2, 2026
613db50
Add shell property to steps
silas-hw Jul 2, 2026
f0afeb0
Remove composible action
silas-hw Jul 2, 2026
f6d620b
Move init back into main workflow
silas-hw Jul 2, 2026
fe98636
Use upload-artificacts to share binaries between jobs
silas-hw Jul 2, 2026
fd9e589
Split outputting PATH onto separate step
silas-hw Jul 2, 2026
52cc1b4
Fix GITHUB_PATH
silas-hw Jul 2, 2026
8ba924c
Fix output PATH step
silas-hw Jul 2, 2026
e880ba4
Fix typo
silas-hw Jul 2, 2026
e20f023
Fix GITHUB_PATH read
silas-hw Jul 2, 2026
48e0096
Fix output PATH
silas-hw Jul 2, 2026
530251f
Fix setting PATH
silas-hw Jul 2, 2026
9c4a730
Add id to output PATH step
silas-hw Jul 2, 2026
73dbb64
Add step to add executable bit to downloaded artifacts
silas-hw Jul 2, 2026
ecf12eb
Fix chmod
silas-hw Jul 2, 2026
3bb2f9f
Add sudo to chmod
silas-hw Jul 2, 2026
030ca82
Add hidden files to upload agdai step
silas-hw Jul 2, 2026
e6443f1
Set agdai upload path to _build/
silas-hw Jul 3, 2026
7cdc556
Split html deployment in separate job
silas-hw Jul 3, 2026
475091b
Remove wildcard from agdai upload step
silas-hw Jul 3, 2026
d92f186
Run cabal update before golden testing
silas-hw Jul 3, 2026
3a08185
Relax base versioning constraints
silas-hw Jul 3, 2026
ebfe423
Fix version constraint
silas-hw Jul 3, 2026
7f3e41a
Fix typo
silas-hw Jul 3, 2026
d2f2491
Remove upload/download agdai steps
silas-hw Jul 6, 2026
6519456
Cache golden testing builds
silas-hw Jul 6, 2026
ef795d1
Add cleanup job to remove artifacts
silas-hw Jul 7, 2026
ea47a1f
Fix formatting
silas-hw Jul 7, 2026
6c867b8
Add persistence of agdai files between test-stdlib and test-stdlib-go…
silas-hw Jul 7, 2026
200a1dc
Update caching to only be invoked if dist-newstyle changes
silas-hw Jul 7, 2026
9b20043
Fix restore cache step in test-stdlib-golden
silas-hw Jul 7, 2026
a7684e9
Add comments
silas-hw Jul 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
272 changes: 233 additions & 39 deletions .github/workflows/ci-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ env:
CABAL_INSTALL: cabal install --overwrite-policy=always --ghc-options='-O1 +RTS -M6G -RTS'
AGDA: agda -Werror +RTS -M5G -H3.5G -A128M -RTS -i. -isrc -idoc

jobs:
test-stdlib:
runs-on: ubuntu-latest
steps:

########################################################################
## SETTINGS
##
Expand All @@ -71,27 +66,41 @@ jobs:
## master version at the root and the experimental in a subdirectory.
########################################################################

jobs:
########################################################################
## INITIALISATION
########################################################################
init:
runs-on: ubuntu-latest
outputs:
AGDA_COMMIT: ${{ steps.init_vars.outputs.AGDA_COMMIT }}
AGDA_HTML_DIR: ${{ steps.init_vars.outputs.AGDA_HTML_DIR }}
AGDA_DEPLOY: ${{ steps.init_vars.outputs.AGDA_DEPLOY }}
BIN_PATH: ${{ steps.path.outputs.BIN_PATH }}
GHC_PATH: ${{ steps.install-ghc-cabal.outputs.ghc-path }}
steps:
- name: Initialise variables
id: init_vars
run: |
if [[ '${{ github.ref }}' == 'refs/heads/experimental' \
|| '${{ github.base_ref }}' == 'experimental' ]]; then
|| '${{ github.base_ref }}' == 'experimental' ]]; then
# Pick Agda version for experimental
echo "AGDA_COMMIT=tags/v2.8.0" >> "${GITHUB_ENV}";
echo "AGDA_HTML_DIR=html/experimental" >> "${GITHUB_ENV}"
echo "AGDA_COMMIT=tags/v2.8.0" >> "${GITHUB_OUTPUT}";
echo "AGDA_HTML_DIR=html/experimental" >> "${GITHUB_OUTPUT}"
else
# Pick Agda version for master
echo "AGDA_COMMIT=tags/v2.8.0" >> "${GITHUB_ENV}";
echo "AGDA_HTML_DIR=html/master" >> "${GITHUB_ENV}"
echo "AGDA_COMMIT=tags/v2.8.0" >> "${GITHUB_OUTPUT}";
echo "AGDA_HTML_DIR=html/master" >> "${GITHUB_OUTPUT}"
fi

if [[ '${{ github.ref }}' == 'refs/heads/master' \
|| '${{ github.ref }}' == 'refs/heads/experimental' ]]; then
echo "AGDA_DEPLOY=true" >> "${GITHUB_ENV}"
|| '${{ github.ref }}' == 'refs/heads/experimental' ]]; then
echo "AGDA_DEPLOY=true" >> "${GITHUB_OUTPUT}"
fi

########################################################################
## CACHING
########################################################################
########################################################################
## CACHING
########################################################################


# This caching step allows us to save a lot of building time by only
Expand All @@ -107,21 +116,28 @@ jobs:
~/.cabal/store
~/.cabal/bin
~/.cabal/share
key: ${{ runner.os }}-${{ env.GHC_VERSION }}-${{ env.CABAL_VERSION }}-${{ env.AGDA_COMMIT }}-cache
key: ${{ runner.os }}-${{ env.GHC_VERSION }}-${{ env.CABAL_VERSION }}-${{ steps.init_vars.outputs.AGDA_COMMIT }}-cache

########################################################################
## INSTALLATION STEPS
########################################################################
########################################################################
## INSTALLATION STEPS
########################################################################

- name: Install ghc & cabal
id: install-ghc-cabal
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ env.GHC_VERSION }}
cabal-version: ${{ env.CABAL_VERSION }}
cabal-update: true

- name: Put cabal programs in PATH
run: echo ~/.cabal/bin >> "${GITHUB_PATH}"
run: |
echo ~/.cabal/bin >> "${GITHUB_PATH}"
echo ${{ steps.install-ghc-cabal.outputs.ghc-path }} >> "${GITHUB_PATH}"

- name: Output PATH
id: path
run: echo "BIN_PATH=$PATH" >> "${GITHUB_OUTPUT}"

- name: Install alex & happy
if: steps.cache-cabal.outputs.cache-hit != 'true'
Expand All @@ -136,26 +152,176 @@ jobs:
run: |
git clone https://github.com/agda/agda
cd agda
git checkout ${{ env.AGDA_COMMIT }}
git checkout ${{ steps.init_vars.outputs.AGDA_COMMIT }}
mkdir -p doc
touch doc/user-manual.pdf
${{ env.CABAL_V1_INSTALL }}
cd ..

########################################################################
## TESTING
########################################################################
- name: Upload Cabal directory
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: ubuntu-cabal-dir
path: ~/.cabal/

- name: Upload GHC directory
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: ubuntu-ghc-dir
path: ${{ steps.install-ghc-cabal.outputs.ghc-path }}


# By default github actions do not pull the repo
- name: Checkout stdlib
########################################################################
## TESTING
########################################################################
test-stdlib:
needs: init
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Download Cabal directory
uses: actions/download-artifact@v4
with:
name: ubuntu-cabal-dir
path: ~/.cabal/

- name: Download GHC directory
uses: actions/download-artifact@v4
with:
name: ubuntu-ghc-dir
path: ${{ needs.init.outputs.GHC_PATH }}

- name: Set permissions
run: |
sudo chmod -R 777 ~/.cabal/bin/
sudo chmod -R 777 ${{ needs.init.outputs.GHC_PATH }}

- name: Set PATH
run: echo "${{ needs.init.outputs.BIN_PATH }}" >> ${GITHUB_PATH}

- name: Test stdlib
run: |
# Including deprecated modules purely for testing
cabal run GenerateEverything -- --include-deprecated
${{ env.AGDA }} -WnoUserWarning --safe EverythingSafe.agda
${{ env.AGDA }} -WnoUserWarning Everything.agda

# upload agdai files so they can be re-used by test-stdlib-golden
- name: Upload agdai files
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: ubuntu-agdai
path: _build/

########################################################################
## GOLDEN TESTING
########################################################################
test-stdlib-golden:
needs: [init, test-stdlib]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Download Cabal directory
uses: actions/download-artifact@v4
with:
name: ubuntu-cabal-dir
path: ~/.cabal/

- name: Download GHC directory
uses: actions/download-artifact@v4
with:
name: ubuntu-ghc-dir
path: ${{ needs.init.outputs.GHC_PATH }}

- name: Download agdai files
uses: actions/download-artifact@v4
with:
name: ubuntu-agdai
path: _build/

- name: Set permissions
run: |
sudo chmod -R 777 ~/.cabal/bin/
sudo chmod -R 777 ${{ needs.init.outputs.GHC_PATH }}

- name: Cabal update
run: cabal update

- name: Set PATH
run: echo "${{ needs.init.outputs.BIN_PATH }}" >> ${GITHUB_PATH}

# always restore the cache, cabal will then figure the rest out
- name: Restore cache
uses: actions/cache/restore@v5
id: restore-golden
with:
path: ./tests/_config/dist-newstyle/
key: ${{ runner.os }}-${{ env.GHC_VERSION }}-${{ env.CABAL_VERSION }}-golden-cache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.GHC_VERSION }}-${{ env.CABAL_VERSION }}-golden-cache

# compute a hash to be compared against after running golden tests
# if dist-newstyle changes, it means that the cache needs to be updated, so we use as hash to make that comparison
- name: Compute cache hash
id: cache-hash
run: |
{ printf "CACHE_HASH=" && find tests/_config/dist-newstyle/ -type f -print0 | sort -z | xargs -0 sha1sum | sha1sum ; } >> ${GITHUB_ENV}

- name: Golden testing
run: |
make testsuite INTERACTIVE='' AGDA_EXEC='agda' GHC_EXEC='ghc'

- name: Compute new cache hash
id: new-cache-hash
run: |
{ printf "NEW_CACHE_HASH=" && find tests/_config/dist-newstyle/ -type f -print0 | sort -z | xargs -0 sha1sum | sha1sum ; } >> ${GITHUB_ENV}

# cache the files built during golden testing, but only on master and if dist-newstyle has changed to prevent the cache overfilling too quickly
- name: Save cache
if: github.ref_name == 'master' && steps.cache-hash.outputs.CACHE_HASH != steps.new-cache-hash.outputs.NEW_CACHE_HASH
uses: actions/cache/save@v5
id: cache-golden
with:
path: ./tests/_config/dist-newstyle/
key: ${{ runner.os }}-${{ env.GHC_VERSION }}-${{ env.CABAL_VERSION }}-golden-cache-${{ github.sha }}


########################################################################
## DOC DEPLOYMENT
########################################################################
html-generate:
needs: init
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Download Cabal directory
uses: actions/download-artifact@v4
with:
name: ubuntu-cabal-dir
path: ~/.cabal/

- name: Download GHC directory
uses: actions/download-artifact@v4
with:
name: ubuntu-ghc-dir
path: ${{ needs.init.outputs.GHC_PATH }}

- name: Set permissions
run: |
sudo chmod -R 777 ~/.cabal/bin/
sudo chmod -R 777 ${{ needs.init.outputs.GHC_PATH }}

- name: Set PATH
run: echo "${{ needs.init.outputs.BIN_PATH }}" >> ${GITHUB_PATH}

- name: Prepare HTML index
run: |
Expand All @@ -167,33 +333,61 @@ jobs:
${{ env.AGDA }} Everything.agda
${{ env.AGDA }} index.agda

- name: Golden testing
run: |
make testsuite INTERACTIVE='' AGDA_EXEC='agda' GHC_EXEC='ghc'


########################################################################
## DOC DEPLOYMENT
########################################################################

# We start by retrieving the currently deployed docs
# We remove the content that is in the directory we are going to populate
# so that stale files corresponding to deleted modules do not accumulate.
# We then generate the docs in the AGDA_HTML_DIR subdirectory
- name: Generate HTML
run: |
git clone --depth 1 --single-branch --branch gh-pages https://github.com/agda/agda-stdlib html
rm -f '${{ env.AGDA_HTML_DIR }}'/*.html
rm -f '${{ env.AGDA_HTML_DIR }}'/*.css
${{ env.AGDA }} --html --html-dir ${{ env.AGDA_HTML_DIR }} index.agda
rm -f '${{ needs.init.outputs.AGDA_HTML_DIR }}'/*.html
rm -f '${{ needs.init.outputs.AGDA_HTML_DIR }}'/*.css
${{ env.AGDA }} --html --html-dir ${{ needs.init.outputs.AGDA_HTML_DIR }} index.agda
cp .github/tooling/* .
./landing.sh

- name: Upload HTML
uses: actions/upload-artifact@v4
with:
name: ubuntu-html
include-hidden-files: true
path: ${{ needs.init.outputs.AGDA_HTML_DIR }}

html-deploy:
needs: [init, html-generate, test-stdlib-golden]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Download HTML
uses: actions/download-artifact@v4
with:
name: ubuntu-html
path: ${{ needs.init.outputs.AGDA_HTML_DIR }}

- name: Deploy HTML
uses: JamesIves/github-pages-deploy-action@v4
if: success() && env.AGDA_DEPLOY
if: success() && needs.init.outputs.AGDA_DEPLOY

with:
branch: gh-pages
folder: html
git-config-name: Github Actions

########################################################################
## CLEANUP
########################################################################
cleanup:
needs: [html-deploy]
runs-on: ubuntu-latest
if: always()
steps:
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v6
with:
failOnError: false
name: |
ubuntu-cabal-dir
ubuntu-ghc-dir
ubuntu-html
2 changes: 1 addition & 1 deletion tests/_config/template.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ common common-build-parameters
PatternSynonyms

build-depends:
base >= 4.12 && < 4.22
base >= 4.12 && < 4.23
, bytestring >= 0.12 && <0.13
, clock >= 0.8 && <0.9
, directory >= 1.3.7 && < 1.4
Expand Down
Loading