Fix haddock for threadDelay
#327
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Haskell CI | |
on: | |
pull_request: | |
push: | |
# we need this to populate cache for `main` branch to make it available to the child branches, see | |
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache | |
branches: | |
- 'main' | |
tags: | |
- "v*" | |
# GH caches are removed when not accessed within 7 days - this schedule runs the job every 6 days making | |
# sure that we always have some caches on master | |
schedule: | |
- cron: '0 0 */6 * *' | |
jobs: | |
build: | |
runs-on: ${{ matrix.sys.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc: ["9.6", "9.10", "9.12"] | |
cabal: ["3.14"] | |
sys: | |
- { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' } | |
- { os: ubuntu-latest, shell: bash } | |
defaults: | |
run: | |
shell: ${{ matrix.sys.shell }} | |
env: | |
# Modify this value to "invalidate" the cabal cache. | |
CABAL_CACHE_VERSION: "2024-05-01-1" | |
# these two are msys2 env vars, they have no effect on non-msys2 installs. | |
MSYS2_PATH_TYPE: inherit | |
MSYSTEM: MINGW64 | |
concurrency: | |
group: > | |
a+${{ github.event_name }} | |
b+${{ github.workflow_ref }} | |
c+${{ github.job }} | |
d+${{ matrix.ghc }} | |
e+${{ matrix.cabal }} | |
f+${{ matrix.sys.os }} | |
g+${{ (startsWith(github.ref, 'refs/heads/gh-readonly-queue/') && github.run_id) || github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Concurrency group | |
run: > | |
echo | |
a+${{ github.event_name }} | |
b+${{ github.workflow_ref }} | |
c+${{ github.job }} | |
d+${{ matrix.ghc }} | |
e+${{ matrix.cabal }} | |
f+${{ matrix.sys.os }} | |
g+${{ (startsWith(github.ref, 'refs/heads/gh-readonly-queue/') && github.run_id) || github.event.pull_request.number || github.ref }} | |
- name: Install Haskell | |
uses: input-output-hk/actions/haskell@latest | |
id: setup-haskell | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
- name: Install system dependencies | |
uses: input-output-hk/actions/base@latest | |
with: | |
use-sodium-vrf: true # default is true | |
- uses: actions/checkout@v4 | |
- name: Cabal update | |
run: cabal update | |
# A dry run `build all` operation does *NOT* download anything, it just looks at the package | |
# indices to generate an install plan. | |
- name: Build dry run | |
run: cabal build all --enable-tests --dry-run --minimize-conflict-set | |
# From the install plan we generate a dependency list. | |
- name: Record dependencies | |
id: record-deps | |
run: | | |
cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[] | select(.style != "local") | .id' | sort | uniq > dependencies.txt | |
# Use a fresh cache each month | |
- name: Store month number as environment variable used in cache version | |
run: echo "MONTHNUM=$(date -u '+%m')" >> "$GITHUB_ENV" | |
# From the dependency list we restore the cached dependencies. | |
# We use the hash of `dependencies.txt` as part of the cache key because that will be stable | |
# until the `index-state` values in the `cabal.project` file changes. | |
- name: Restore cached dependencies | |
uses: actions/cache/restore@v4 | |
id: cache | |
with: | |
path: | | |
${{ steps.setup-haskell.outputs.cabal-store }} | |
dist-newstyle | |
key: | |
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.MONTHNUM }}-${{ hashFiles('dependencies.txt') }} | |
# try to restore previous cache from this month if there's no cache for the dependencies set | |
restore-keys: | | |
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.MONTHNUM }}- | |
# Now we install the dependencies. If the cache was found and restored in the previous step, | |
# this should be a no-op, but if the cache key was not found we need to build stuff so we can | |
# cache it for the next step. | |
- name: Install dependencies | |
run: cabal build all --enable-tests --only-dependencies | |
# Always store the cabal cache. | |
# This can fail (benign failure) if there is already a hash at that key. | |
- name: Cache Cabal store | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
${{ steps.setup-haskell.outputs.cabal-store }} | |
dist-newstyle | |
key: | |
${{ steps.cache.outputs.cache-primary-key }} | |
# Now we build. | |
- name: Build all | |
run: cabal build all --enable-tests | |
- name: Run tests | |
env: | |
TMPDIR: ${{ runner.temp }} | |
TMP: ${{ runner.temp }} | |
KEEP_WORKSPACE: 1 | |
run: cabal test all --enable-tests --test-show-details=direct | |
check: | |
needs: build | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.tag.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check if cabal project is sane | |
run: | | |
PROJECT_DIR="$PWD" | |
mkdir -p "$PROJECT_DIR/build/sdist" | |
for i in $(git ls-files | grep '\.cabal'); do | |
cd "$PROJECT_DIR" && cd "$(dirname $i)" | |
cabal check | |
done | |
- name: Tag new version | |
id: tag | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
package_version="$(cat *.cabal | grep '^version:' | cut -d : -f 2 | xargs)" | |
echo "Package version is v$package_version" | |
git fetch --unshallow origin | |
if git tag "v$package_version"; then | |
echo "Tagging with new version "v$package_version"" | |
if git push origin "v$package_version"; then | |
echo "Tagged with new version "v$package_version"" | |
echo "::set-output name=tag::v$package_version" | |
fi | |
fi | |
- name: Show tag | |
run: | | |
echo "Ref: ${{ github.ref }}" | |
echo "Tag: ${{ steps.tag.outputs.tag }}" | |
release: | |
needs: [build, check] | |
runs-on: ubuntu-latest | |
if: ${{ needs.check.outputs.tag != '' }} | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create source distribution | |
run: | | |
PROJECT_DIR="$PWD" | |
mkdir -p "$PROJECT_DIR/build/sdist" | |
for i in $(git ls-files | grep '\.cabal'); do | |
cd "$PROJECT_DIR" && cd "$(dirname $i)" | |
cabal v2-sdist -o $PROJECT_DIR/build/sdist | |
done; | |
- name: Generate Changelog | |
run: | | |
git fetch --unshallow | |
if git describe --tags 'HEAD^' --abbrev=0 > last-tag; then | |
git log --no-merges --format="%C(auto) %h %s" "$(cat last-tag)..HEAD" | |
else | |
git log --no-merges --format="%C(auto) %h %s" | |
fi > changelog.txt | |
cat changelog.txt | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ needs.check.outputs.tag }} | |
release_name: Release ${{ needs.check.outputs.tag }} | |
draft: false | |
prerelease: false | |
body_path: changelog.txt | |
publish: | |
needs: [build, release] | |
runs-on: ${{ matrix.os }} | |
if: ${{ needs.check.outputs.tag != '' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc: ["8.10.4"] | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/download-artifact@v4 | |
id: download_artifact | |
with: | |
name: artifacts-${{ runner.OS }}-${{ matrix.ghc }}.tar.gz | |
path: . | |
- name: Compute axes | |
id: axes | |
run: | | |
case ${{ matrix.os }} in | |
ubuntu-*) os="linux" ;; | |
macos-*) os="darwin" ;; | |
windows-*) os="windows" ;; | |
*) exit 1 ;; # error | |
esac | |
arch_os="$(uname -m)-$os" | |
echo "::set-output name=arch_os::$arch_os" | |
- name: Upload Artifacts to Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: artifacts-${{ runner.OS }}-${{ matrix.ghc }}.tar.gz | |
- name: Upload Artifacts to Release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: artifacts-${{ runner.OS }}-${{ matrix.ghc }}.tar.gz | |
asset_name: artifacts-${{ runner.OS }}-${{ matrix.ghc }}.tar.gz | |
asset_content_type: application/tar+gzip |