Skip to content

Create Github Workflows for compiling all versions of Gogol #12

Create Github Workflows for compiling all versions of Gogol

Create Github Workflows for compiling all versions of Gogol #12

Workflow file for this run

name: Haskell CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# INFO: The following configuration block ensures that only one build runs per branch,
# which may be desirable for projects with a costly build process.
# Remove this block from the CI workflow to let each CI job run to completion.
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
# INFO: The caching strategy was created following this post https://github.com/commercialhaskell/stack/issues/5754#issuecomment-1696156869
env:
#-- increment this if you think cache of GHC installation needs cold rebuild
MANUAL_CACHE_RESET_COMPILER: v0
#-- increment this if you think cache of .stack-work needs cold rebuild
MANUAL_CACHE_RESET_PRODUCTS: v0
#-- increment this to force-rebuild the cache of dependency packages
MANUAL_CACHE_RESET_TESTDEPS: v0
#-- should never be needed, as stackage snapshots are immutable
# MANUAL_CACHE_RESET_SNAPSHOT: v0
jobs:
build-haskell:
runs-on: ubuntu-latest
strategy:
matrix:
versions:
- { lts: "22.27", ghc: "9.6.5" }
steps:
- name: Cache GHC installation
uses: actions/cache@v4
id: ghcup
env:
MANUAL_RESET: ${{ env.MANUAL_CACHE_RESET_COMPILER }}
with:
path: |
~/.ghcup/bin/*
~/.ghcup/cache/*
~/.ghcup/config.yaml
~/.ghcup/ghc/${{ matrix.versions.ghc }}
key: CI-ghcup-${{ env.MANUAL_RESET }}--${{ matrix.versions.ghc }}
- uses: haskell-actions/setup@v2
if: steps.ghcup.outputs.cache-hit != 'true'
with:
ghc-version: ${{ matrix.versions.ghc }}
enable-stack: true
stack-version: 'latest'
cabal-update: false
- name: Cache Pantry (Stackage package index)
id: pantry
uses: actions/cache@v4
with:
path: ~/.stack/pantry
key: CI-pantry-${{ matrix.versions.lts }}
- name: Recompute Stackage package index
if: steps.pantry.outputs.cache-hit != 'true'
run: stack update # populates ~/.stack/pantry
- name: Cache Haskell dependencies
uses: actions/cache@v4
env:
MANUAL_RESET: ${{ env.MANUAL_CACHE_RESET_TESTDEPS }}
with:
#-- NOTE no, shouldn't cache the entire ~/.stack -- that'd be bad. just these 2:
path: |
~/.stack/stack.sqlite3
~/.stack/snapshots
#-- NOTE the caching key structure:
#-- * fixed ID string -- to indicate scope & purpose, descriptive;
#-- * manual reset -- on top level, stupid simple manual override;
#-- * resolver version -- helps maintain sleek size of the cache;
#-- * lockfile hashsum -- as invalidation trigger of the correct granularity.
#-- Since this cache only stores built *dependency packages* (not project code!),
#-- we should invalidate/reupload it on each change to the dependency forest (≈lockfile).
#--
#-- All this decides when cache gets REBUILT (invalidated & recreated):
key: CI-testdeps-${{ env.MANUAL_RESET }}--${{ matrix.versions.lts }}--${{ hashFiles('stack-${{ matrix.versions.ghc }}.yaml.lock') }}
#-- All this adds fallbacks to UNPACK stale cache copies, prefix-matched:
restore-keys: |
CI-testdeps-${{ env.MANUAL_RESET }}--${{ matrix.versions.lts }}--
CI-testdeps-${{ env.MANUAL_RESET }}--
- name: Clone project
uses: actions/checkout@v2
- name: Cache per-branch Haskell project buildstate
uses: actions/cache@v4
env:
MANUAL_RESET: ${{ env.MANUAL_CACHE_RESET_PRODUCTS }}
with:
#-- I wasn't able to find the non absolute path and I decided to set the full path. This is britle
#-- The list of .stack-work folders needs to be recreated periodically with: find . -name .stack-work
path: |
${{ github.workspace }}/.stack-work
${{ github.workspace }}/examples/.stack-work
${{ github.workspace }}/gen/.stack-work
${{ github.workspace }}/lib/gogol/.stack-work
${{ github.workspace }}/lib/services/gogol-abusiveexperiencereport/.stack-work
${{ github.workspace }}/lib/services/gogol-analytics/.stack-work
${{ github.workspace }}/lib/services/gogol-speech/.stack-work
${{ github.workspace }}/lib/services/gogol-videointelligence/.stack-work
${{ github.workspace }}/lib/services/gogol-androidmanagement/.stack-work
${{ github.workspace }}/lib/services/gogol-bigquerydatatransfer/.stack-work
${{ github.workspace }}/lib/services/gogol-slides/.stack-work
${{ github.workspace }}/lib/services/gogol-webmaster-tools/.stack-work
${{ github.workspace }}/lib/services/gogol-play-moviespartner/.stack-work
${{ github.workspace }}/lib/services/gogol-youtube-reporting/.stack-work
${{ github.workspace }}/lib/services/gogol-urlshortener/.stack-work
${{ github.workspace }}/lib/services/gogol-compute/.stack-work
${{ github.workspace }}/lib/services/gogol-replicapool-updater/.stack-work
${{ github.workspace }}/lib/services/gogol-storage-transfer/.stack-work
${{ github.workspace }}/lib/services/gogol-servicenetworking/.stack-work
${{ github.workspace }}/lib/services/gogol-deploymentmanager/.stack-work
${{ github.workspace }}/lib/services/gogol-groups-migration/.stack-work
${{ github.workspace }}/lib/services/gogol-streetviewpublish/.stack-work
${{ github.workspace }}/lib/services/gogol-adexchange-seller/.stack-work
${{ github.workspace }}/lib/services/gogol-serviceuser/.stack-work
${{ github.workspace }}/lib/services/gogol-poly/.stack-work
${{ github.workspace }}/lib/services/gogol-apps-calendar/.stack-work
${{ github.workspace }}/lib/services/gogol-adexchange-buyer/.stack-work
${{ github.workspace }}/lib/services/gogol-games-configuration/.stack-work
${{ github.workspace }}/lib/services/gogol-android-publisher/.stack-work
${{ github.workspace }}/lib/services/gogol-resourcemanager/.stack-work
${{ github.workspace }}/lib/services/gogol-analyticsreporting/.stack-work
${{ github.workspace }}/lib/services/gogol-file/.stack-work
${{ github.workspace }}/lib/services/gogol-dlp/.stack-work
${{ github.workspace }}/lib/services/gogol-storage/.stack-work
${{ github.workspace }}/lib/services/gogol-plus/.stack-work
${{ github.workspace }}/lib/services/gogol-fonts/.stack-work
${{ github.workspace }}/lib/services/gogol-vision/.stack-work
${{ github.workspace }}/lib/services/gogol-siteverification/.stack-work
${{ github.workspace }}/lib/services/gogol-firebase-rules/.stack-work
${{ github.workspace }}/lib/services/gogol-youtube-analytics/.stack-work
${{ github.workspace }}/lib/services/gogol-firebasehosting/.stack-work
${{ github.workspace }}/lib/services/gogol-ml/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudprofiler/.stack-work
${{ github.workspace }}/lib/services/gogol-clouderrorreporting/.stack-work
${{ github.workspace }}/lib/services/gogol-composer/.stack-work
${{ github.workspace }}/lib/services/gogol-replicapool/.stack-work
${{ github.workspace }}/lib/services/gogol-healthcare/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudasset/.stack-work
${{ github.workspace }}/lib/services/gogol-accessapproval/.stack-work
${{ github.workspace }}/lib/services/gogol-appstate/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudidentity/.stack-work
${{ github.workspace }}/lib/services/gogol-partners/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudsearch/.stack-work
${{ github.workspace }}/lib/services/gogol-qpxexpress/.stack-work
${{ github.workspace }}/lib/services/gogol-servicecontrol/.stack-work
${{ github.workspace }}/lib/services/gogol-indexing/.stack-work
${{ github.workspace }}/lib/services/gogol-spectrum/.stack-work
${{ github.workspace }}/lib/services/gogol-apps-tasks/.stack-work
${{ github.workspace }}/lib/services/gogol-doubleclick-bids/.stack-work
${{ github.workspace }}/lib/services/gogol-language/.stack-work
${{ github.workspace }}/lib/services/gogol-adexchangebuyer2/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudtrace/.stack-work
${{ github.workspace }}/lib/services/gogol-sourcerepo/.stack-work
${{ github.workspace }}/lib/services/gogol-tracing/.stack-work
${{ github.workspace }}/lib/services/gogol-discovery/.stack-work
${{ github.workspace }}/lib/services/gogol-servicemanagement/.stack-work
${{ github.workspace }}/lib/services/gogol-dataproc/.stack-work
${{ github.workspace }}/lib/services/gogol-firebaseremoteconfig/.stack-work
${{ github.workspace }}/lib/services/gogol-firebase-dynamiclinks/.stack-work
${{ github.workspace }}/lib/services/gogol-apps-licensing/.stack-work
${{ github.workspace }}/lib/services/gogol-admin-datatransfer/.stack-work
${{ github.workspace }}/lib/services/gogol-iamcredentials/.stack-work
${{ github.workspace }}/lib/services/gogol-billing/.stack-work
${{ github.workspace }}/lib/services/gogol-script/.stack-work
${{ github.workspace }}/lib/services/gogol-run/.stack-work
${{ github.workspace }}/lib/services/gogol-translate/.stack-work
${{ github.workspace }}/lib/services/gogol-datafusion/.stack-work
${{ github.workspace }}/lib/services/gogol-dfareporting/.stack-work
${{ github.workspace }}/lib/services/gogol-serviceconsumermanagement/.stack-work
${{ github.workspace }}/lib/services/gogol-bigquery/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudfunctions/.stack-work
${{ github.workspace }}/lib/services/gogol-searchconsole/.stack-work
${{ github.workspace }}/lib/services/gogol-monitoring/.stack-work
${{ github.workspace }}/lib/services/gogol-oslogin/.stack-work
${{ github.workspace }}/lib/services/gogol-testing/.stack-work
${{ github.workspace }}/lib/services/gogol-customsearch/.stack-work
${{ github.workspace }}/lib/services/gogol-binaryauthorization/.stack-work
${{ github.workspace }}/lib/services/gogol-drive/.stack-work
${{ github.workspace }}/lib/services/gogol-proximitybeacon/.stack-work
${{ github.workspace }}/lib/services/gogol-gmail/.stack-work
${{ github.workspace }}/lib/services/gogol-plus-domains/.stack-work
${{ github.workspace }}/lib/services/gogol-securitycenter/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudprivatecatalog/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudiot/.stack-work
${{ github.workspace }}/lib/services/gogol-android-enterprise/.stack-work
${{ github.workspace }}/lib/services/gogol-jobs/.stack-work
${{ github.workspace }}/lib/services/gogol-identity-toolkit/.stack-work
${{ github.workspace }}/lib/services/gogol-apps-activity/.stack-work
${{ github.workspace }}/lib/services/gogol-groups-settings/.stack-work
${{ github.workspace }}/lib/services/gogol-blogger/.stack-work
${{ github.workspace }}/lib/services/gogol-pubsub/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudprivatecatalogproducer/.stack-work
${{ github.workspace }}/lib/services/gogol-books/.stack-work
${{ github.workspace }}/lib/services/gogol-adsense-host/.stack-work
${{ github.workspace }}/lib/services/gogol-dialogflow/.stack-work
${{ github.workspace }}/lib/services/gogol-civicinfo/.stack-work
${{ github.workspace }}/lib/services/gogol-youtube/.stack-work
${{ github.workspace }}/lib/services/gogol-fitness/.stack-work
${{ github.workspace }}/lib/services/gogol-servicebroker/.stack-work
${{ github.workspace }}/lib/services/gogol-alertcenter/.stack-work
${{ github.workspace }}/lib/services/gogol-fusiontables/.stack-work
${{ github.workspace }}/lib/services/gogol-mirror/.stack-work
${{ github.workspace }}/lib/services/gogol-adsense/.stack-work
${{ github.workspace }}/lib/services/gogol-consumersurveys/.stack-work
${{ github.workspace }}/lib/services/gogol-acceleratedmobilepageurl/.stack-work
${{ github.workspace }}/lib/services/gogol-firestore/.stack-work
${{ github.workspace }}/lib/services/gogol-websecurityscanner/.stack-work
${{ github.workspace }}/lib/services/gogol-commentanalyzer/.stack-work
${{ github.workspace }}/lib/services/gogol-sheets/.stack-work
${{ github.workspace }}/lib/services/gogol-logging/.stack-work
${{ github.workspace }}/lib/services/gogol-safebrowsing/.stack-work
${{ github.workspace }}/lib/services/gogol-digitalassetlinks/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudkms/.stack-work
${{ github.workspace }}/lib/services/gogol-apps-reseller/.stack-work
${{ github.workspace }}/lib/services/gogol-adexperiencereport/.stack-work
${{ github.workspace }}/lib/services/gogol-oauth2/.stack-work
${{ github.workspace }}/lib/services/gogol-dns/.stack-work
${{ github.workspace }}/lib/services/gogol-docs/.stack-work
${{ github.workspace }}/lib/services/gogol-serviceusage/.stack-work
${{ github.workspace }}/lib/services/gogol-iap/.stack-work
${{ github.workspace }}/lib/services/gogol-doubleclick-search/.stack-work
${{ github.workspace }}/lib/services/gogol-admin-reports/.stack-work
${{ github.workspace }}/lib/services/gogol-toolresults/.stack-work
${{ github.workspace }}/lib/services/gogol-factchecktools/.stack-work
${{ github.workspace }}/lib/services/gogol-playcustomapp/.stack-work
${{ github.workspace }}/lib/services/gogol-driveactivity/.stack-work
${{ github.workspace }}/lib/services/gogol-containeranalysis/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudshell/.stack-work
${{ github.workspace }}/lib/services/gogol-manufacturers/.stack-work
${{ github.workspace }}/lib/services/gogol-people/.stack-work
${{ github.workspace }}/lib/services/gogol-texttospeech/.stack-work
${{ github.workspace }}/lib/services/gogol-admin-directory/.stack-work
${{ github.workspace }}/lib/services/gogol-games-management/.stack-work
${{ github.workspace }}/lib/services/gogol-bigtableadmin/.stack-work
${{ github.workspace }}/lib/services/gogol-debugger/.stack-work
${{ github.workspace }}/lib/services/gogol-libraryagent/.stack-work
${{ github.workspace }}/lib/services/gogol-redis/.stack-work
${{ github.workspace }}/lib/services/gogol-remotebuildexecution/.stack-work
${{ github.workspace }}/lib/services/gogol-container/.stack-work
${{ github.workspace }}/lib/services/gogol-pagespeed/.stack-work
${{ github.workspace }}/lib/services/gogol-shopping-content/.stack-work
${{ github.workspace }}/lib/services/gogol-datastore/.stack-work
${{ github.workspace }}/lib/services/gogol-iam/.stack-work
${{ github.workspace }}/lib/services/gogol-appengine/.stack-work
${{ github.workspace }}/lib/services/gogol-spanner/.stack-work
${{ github.workspace }}/lib/services/gogol-kgsearch/.stack-work
${{ github.workspace }}/lib/services/gogol-surveys/.stack-work
${{ github.workspace }}/lib/services/gogol-vault/.stack-work
${{ github.workspace }}/lib/services/gogol-runtimeconfig/.stack-work
${{ github.workspace }}/lib/services/gogol-sqladmin/.stack-work
${{ github.workspace }}/lib/services/gogol-androiddeviceprovisioning/.stack-work
${{ github.workspace }}/lib/services/gogol-containerbuilder/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudscheduler/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudtasks/.stack-work
${{ github.workspace }}/lib/services/gogol-accesscontextmanager/.stack-work
${{ github.workspace }}/lib/services/gogol-games/.stack-work
${{ github.workspace }}/lib/services/gogol-classroom/.stack-work
${{ github.workspace }}/lib/services/gogol-tpu/.stack-work
${{ github.workspace }}/lib/services/gogol-genomics/.stack-work
${{ github.workspace }}/lib/services/gogol-chat/.stack-work
${{ github.workspace }}/lib/services/gogol-dataflow/.stack-work
${{ github.workspace }}/lib/services/gogol-tagmanager/.stack-work
${{ github.workspace }}/lib/gogol-core/.stack-work
${{ github.workspace }}/.stack-work
key: CI-builddir-${{ env.MANUAL_RESET }}--${{ matrix.versions.ghc }}--${{ github.head_ref }}
- name: Debug cache contents pre compilation
run: du -sh ${{ github.workspace }}/.stack-work && ls -R ${{ github.workspace }}/.stack-work
- name: Install dependencies
run: stack build --system-ghc --stack-yaml stack-${{ matrix.versions.ghc }}.yaml --only-dependencies
- name: Run tests
run: stack test --system-ghc --stack-yaml stack-${{ matrix.versions.ghc }}.yaml
- name: Build
run: stack build --system-ghc --stack-yaml stack-${{ matrix.versions.ghc }}.yaml
- name: Debug cache contents post compilation
run: du -sh ${{ github.workspace }}/.stack-work && ls -R ${{ github.workspace }}/.stack-work