fix: updates org name #33
This file contains 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: Build and Test | |
on: | |
push: {branches: ["main"]} | |
pull_request: | |
jobs: | |
ci-enumerate: | |
name: Enumerate GHC Versions | |
runs-on: ubuntu-latest | |
outputs: | |
plan: ${{steps.list-ci.outputs.plan}} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{github.event.pull_request.head.sha || github.sha}} | |
- name: Enumerate CI plans | |
id: list-ci | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const script = require('./ci/scripts/enumerate-ci.js') | |
await script({github, context, core, glob, io, require}) | |
build: | |
name: Build (${{matrix.plan.name}}) | |
needs: [ci-enumerate] | |
continue-on-error: true | |
strategy: | |
matrix: | |
## TODO: When OSS is ready, use the following line | |
# plan: ${{fromJSON(needs.ci-enumerate.outputs.plan)}} | |
## TODO: When OSS is ready, delete the following: | |
plan: | |
- path: "ci/configs/ghc-9.4.8.project" | |
name: "ghc-9.4.8" | |
ghc: "9.4.8" | |
is_head: false | |
fail-fast: false | |
env: | |
cabal-version: 3.10.2.0 | |
cabal: "cabal --project-file=${{matrix.plan.path}}" | |
ghc: ${{matrix.plan.ghc}} | |
project-file: ${{matrix.plan.path}} | |
plan: ${{matrix.plan.name}} | |
artifact-name: "artifact-${{matrix.plan.name}}" | |
runs-on: ubuntu-latest | |
outputs: | |
benchmarks: ${{steps.list-bins.outputs.benchs}} | |
tests: ${{steps.list-bins.outputs.tests}} | |
artifact: "artifact-${{matrix.plan.name}}" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{github.event.pull_request.head.sha || github.sha}} | |
- name: Calculate hash keys | |
uses: actions/github-script@v6 | |
id: cache-keys | |
with: | |
script: | | |
const script = require('./ci/scripts/calc-cache-keys.js') | |
await script({ os: "ubuntu", plan: ${{toJSON(env.plan)}}, path: ${{toJSON(env.project-file)}}, core, glob }) | |
- name: Setup Haskell | |
uses: haskell-actions/setup@v2 | |
with: | |
enable-stack: false | |
cabal-version: ${{env.cabal-version}} | |
ghc-version: ${{env.ghc}} | |
- name: Restore ~/.cabal/store | |
uses: actions/cache/restore@v3 | |
with: | |
path: ~/.cabal/store | |
key: ${{steps.cache-keys.outputs.store}} | |
restore-keys: ${{steps.cache-keys.outputs.store-restore}} | |
- name: Restore dist-newstyle | |
uses: actions/cache/restore@v3 | |
with: | |
path: dist-newstyle | |
key: ${{steps.cache-keys.outputs.dist}} | |
restore-keys: ${{steps.cache-keys.outputs.dist-restore}} | |
- name: cabal configure | |
run: | | |
${{env.cabal}} v2-configure --enable-tests --enable-benchmarks --enable-optimisation=2 | |
${{env.cabal}} update | |
- name: Build Dependencies | |
run: | | |
${{env.cabal}} build --only-dependencies all | |
- name: Save ~/.cabal/store Cache | |
uses: actions/cache/save@v3 | |
with: | |
path: ~/.cabal/store | |
key: ${{steps.cache-keys.outputs.store}} | |
- name: Build All | |
run: | | |
${{env.cabal}} build all | |
- name: Save dist-newstyle Cache | |
uses: actions/cache/save@v3 | |
with: | |
path: dist-newstyle | |
key: ${{steps.cache-keys.outputs.dist}} | |
- name: Collect binaries | |
continue-on-error: true | |
run: bash ./ci/scripts/collect-bins.sh "${{env.artifact-name}}" | |
- name: Upload Aritracts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{env.artifact-name}}.tar.zst | |
name: ${{env.artifact-name}} | |
retention-days: 1 | |
- name: List Binaries | |
id: list-bins | |
shell: bash | |
run: | | |
echo "benchs=$(jq -cMnR '[inputs]' <"${{env.artifact-name}}"/benchs.list)" >>"${GITHUB_OUTPUT}" | |
echo "tests=$(jq -cMnR '[inputs]' <"${{env.artifact-name}}"/tests.list)" >>"${GITHUB_OUTPUT}" | |
test: | |
name: Test (${{matrix.plan.name}}) | |
needs: [ci-enumerate, build] | |
continue-on-error: ${{matrix.plan.is_head}} | |
strategy: | |
matrix: | |
## TODO: When OSS is ready, use the following line | |
# plan: ${{fromJSON(needs.ci-enumerate.outputs.plan)}} | |
## TODO: When OSS is ready, delete the following: | |
plan: | |
- path: "ci/configs/ghc-9.4.8.project" | |
name: "ghc-9.4.8" | |
ghc: "9.4.8" | |
is_head: false | |
fail-fast: false | |
env: | |
cabal: 3.10.1.0 | |
ghc: ${{matrix.plan.ghc}} | |
project-file: ${{matrix.plan.path}} | |
plan: ${{matrix.plan.name}} | |
artifact: artifact-${{matrix.plan.name}} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fail when Corresponding Build didn't succeed | |
if: ${{needs.build.result != 'success' }} | |
run: echo "BUILD FAILED" >&2; exit 1 | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{github.event.pull_request.head.sha || github.sha}} | |
- name: Download artifacts | |
id: download | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{env.artifact}} | |
- name: Decompress | |
run: tar xaf ${{steps.download.outputs.download-path}}/${{env.artifact}}.tar.zst | |
- name: Run Tests | |
shell: bash | |
run: | | |
set -euo pipefail | |
TOTAL=0 | |
SUCCESS=0 | |
FAIL=0 | |
while read -r TEST; do | |
TOTAL=$((TOTAL + 1)) | |
echo "--------" | |
echo "Running: ${TEST}" | |
set +e | |
${{env.artifact}}/tests/"${TEST}" | |
RESL=$? | |
set -e | |
if [ ${RESL} -eq 0 ]; then | |
SUCCESS=$((SUCCESS + 1)) | |
echo "Result: Successed" | |
else | |
FAIL=$((FAIL + 1)) | |
echo 'Result: FAILED!' | |
fi | |
done <${{env.artifact}}/tests.list | |
echo "" | |
echo "----" | |
if [ "${FAIL}" -eq 0 ]; then | |
echo "All ${TOTAL} tests passed." | |
else | |
echo "${FAIL} out of ${TOTAL} tests FAILED"'!' | |
exit 1 | |
fi | |
fourmolu: | |
name: Fourmolu | |
runs-on: ubuntu-latest | |
steps: | |
# Note that you must checkout your code before running fourmolu/fourmolu-action | |
- uses: actions/checkout@v2 | |
- uses: fourmolu/fourmolu-action@v10 | |
with: | |
version: "0.15.0.0" | |
pattern: | | |
**/*.hs | |
!**/Setup.hs | |
!**/Setup.lhs | |
!dist-newstyle/** | |
cabal-check: | |
name: Cabal Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: haskell-actions/setup@v2 | |
with: | |
cabal-version: 3.10.2.0 | |
ghc-version: latest | |
- run: bash ./ci/scripts/cabal-check-packages.sh |