Skip to content

DepTyCheck

DepTyCheck #1604

Workflow file for this run

---
name: DepTyCheck
on:
push:
branches:
- main
- master
- 'debug-ci/**'
tags:
- '**'
pull_request:
branches:
- main
- master
schedule:
# We want to run in the beginning of the day, right after the `pack` collection is built at the end of the previous day.
- cron: '0 1 * * *'
permissions: read-all
concurrency:
group: ${{ github.workflow }}@${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
pack_dir_file: pack-dir.tar
# TODO to reduce duplication, e.g. by using https://docs.github.com/en/actions/using-workflows/reusing-workflows
jobs:
################
# Preparations #
################
prepare-pack:
name: Prepare `pack`
runs-on: ubuntu-latest
container: ghcr.io/stefan-hoeck/idris2-pack:latest
steps:
- uses: actions/checkout@v4
- run: pack update-db
- name: Switch to appropriate `pack` collection
run: pack switch "$( if [[ '${{ github.event_name }}' == 'schedule' ]]; then echo HEAD; else ./.pack-collection; fi )"
- run: ./.patch-chez-gc-handler idris2
- name: Tar the `pack` dir
run: .github/tar -cvf "${{ env.pack_dir_file }}" --exclude=".cache" "$PACK_DIR"
- name: Save state of `pack`
uses: actions/upload-artifact@v4
with:
name: pack-dir
path: ${{ env.pack_dir_file }}
thirdparties-build:
name: Build thirdparties
needs: prepare-pack
runs-on: ubuntu-latest
container: ghcr.io/stefan-hoeck/idris2-pack:latest
steps:
- uses: actions/checkout@v4
- name: Restore state of `pack`
uses: actions/download-artifact@v4
with:
name: pack-dir
- name: Untar the `pack` dir
run: .github/tar -xvf "${{ env.pack_dir_file }}" --one-top-level=/ --touch
- run: pack install-deps deptycheck
- run: pack install summary-stat # for distr tests
# TODO to compute test dependencies when we have special mini-test libs
- name: Tar the `pack` dir
run: .github/tar -uvf "${{ env.pack_dir_file }}" --exclude=".cache" "$PACK_DIR"
- name: Save built thirdparties
uses: actions/upload-artifact@v4
with:
name: built-thirdparties
path: ${{ env.pack_dir_file }}
############################
# Build DepTyCheck library #
############################
deptycheck-build-lib:
name: Build the lib
needs:
- prepare-pack
- thirdparties-build
runs-on: ubuntu-latest
container: ghcr.io/stefan-hoeck/idris2-pack:latest
steps:
- uses: actions/checkout@v4
- name: Restore built thirdparties
uses: actions/download-artifact@v4
with:
name: built-thirdparties
- name: Untar the `pack` dir
run: .github/tar -xvf "${{ env.pack_dir_file }}" --one-top-level=/ --touch
- run: pack build deptycheck
- run: pack install deptycheck
- name: Tar the `pack` dir
run: .github/tar -uvf "${{ env.pack_dir_file }}" --exclude=".cache" "$PACK_DIR"
- name: Tar built TTC files
run: find "$(pwd)" -name '*.tt[cm]' | .github/tar -uvf "${{ env.pack_dir_file }}" --files-from /dev/stdin
- name: Save built DepTyCheck
uses: actions/upload-artifact@v4
with:
name: built-deptycheck
path: ${{ env.pack_dir_file }}
#######$###################
# Build DepTyCheck's docs #
########$##################
deptycheck-build-docs:
name: Build the docs
runs-on: ubuntu-latest
container: sphinxdoc/sphinx:latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: pip3 install -r docs/requirements.txt
- run: alias sh=bash
# - run: pack build docs # `pack` is unaccessible here, thus:
- run: cd docs && eval "$(grep prebuild docs.ipkg | sed 's/.*"\(.*\)"/\1/')"
###################
# Test DepTyCheck #
###################
get-test-sets:
name: Acquire test sets
needs:
- deptycheck-build-lib
runs-on: ubuntu-latest
outputs:
test-sets: ${{ steps.get-test-sets.outputs.test-sets }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get test sets
id: get-test-sets
run: |
(
echo -n "test-sets=["
find tests/ -type f,l -name run | grep -v '/_' | \
sed -e 's|^tests/|"|' -e 's|\(.*\)distribution/\([^-]*\)-[^/]*/run|\1distribution/\2"|' -e 's|/[^/]*/run$|"|' | \
sort | uniq | awk 'ORS=", "' | head -c -2
echo "]"
) >> "$GITHUB_OUTPUT"
deptycheck-test:
name: Test the lib
needs:
- prepare-pack
- deptycheck-build-lib
- get-test-sets
runs-on: ubuntu-latest
container: ghcr.io/stefan-hoeck/idris2-pack:latest
strategy:
fail-fast: false # all test cases are more or less independent
matrix:
test_set: ${{ fromJSON(needs.get-test-sets.outputs.test-sets) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore built DepTyCheck
uses: actions/download-artifact@v4
with:
name: built-deptycheck
- name: Untar the `pack` dir
run: .github/tar -xvf "${{ env.pack_dir_file }}" --one-top-level=/ --touch
- run: pack test deptycheck "${{matrix.test_set}}"
#################
# Test examples #
#################
get-examples:
name: Acquire examples
needs:
- deptycheck-build-lib
runs-on: ubuntu-latest
outputs:
examples: ${{ steps.get-examples.outputs.examples }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get examples
id: get-examples
run: |
(
echo -n "examples=["
find examples/ -mindepth 1 -maxdepth 1 -type d | \
sed 's|^examples/|"|' | sed 's|$|"|' | \
sort | uniq | awk 'ORS=", "' | head -c -2
echo "]"
) >> "$GITHUB_OUTPUT"
examples-build:
name: Build and test examples
needs:
- prepare-pack
- deptycheck-build-lib
- get-examples
runs-on: ubuntu-latest
container: ghcr.io/stefan-hoeck/idris2-pack:latest
strategy:
fail-fast: false # all test cases are more or less independent
matrix:
example: ${{ fromJSON(needs.get-examples.outputs.examples) }}
steps:
- uses: actions/checkout@v4
- name: Restore built DepTyCheck
uses: actions/download-artifact@v4
with:
name: built-deptycheck
- name: Untar the `pack` dir
run: .github/tar -xvf "${{ env.pack_dir_file }}" --one-top-level=/ --touch
- run: pack build "${{matrix.example}}"
- run: pack test "${{matrix.example}}"