Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
erikd committed Feb 25, 2024
1 parent 7858ae5 commit db1ece2
Showing 1 changed file with 95 additions and 22 deletions.
117 changes: 95 additions & 22 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,33 +80,97 @@ jobs:
- name: Cabal update
run: cabal update

- name: Configure build
shell: bash
run: |
cp .github/workflows/cabal.project.local.ci cabal.project.local
echo "# cabal.project.local"
cat cabal.project.local
- name: Build dry run
run: cabal build all --enable-tests --dry-run --minimize-conflict-set

- name: Record dependencies
id: record-deps
run: |
- name: Install dependencies
run: cabal build all --enable-tests # --only-dependencies -j --ghc-option=-j4
# For users who fork cardano-node and want to define a writable cache, then can set up their own
# S3 bucket then define in their forked repository settings the following secrets:
#
# AWS_ACCESS_KEY_ID
# AWS_SECRET_ACCESS_KEY
# BINARY_CACHE_URI
# BINARY_CACHE_REGION
- name: Cabal cache over S3
uses: action-works/cabal-cache-s3@v1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
with:
region: ${{ vars.BINARY_CACHE_REGION }}
dist-dir: dist-newstyle
store-path: ${{ steps.setup-haskell.outputs.cabal-store }}
threads: ${{ vars.BINARY_CACHE_THREADS }}
archive-uri: ${{ vars.BINARY_CACHE_URI }}/${{ env.CABAL_CACHE_VERSION }}/${{ runner.os }}/${{ matrix.cabal }}/${{ matrix.ghc }}
skip: "${{ vars.BINARY_CACHE_URI == '' }}"

- name: Cache Cabal store
uses: actions/cache@v3
# It's important to ensure that people who fork this repository can not only successfully build in
# CI by default, but also have meaning cabal store caching.
#
# Because syncing with S3 requires credentials, we cannot rely on S3 for this. For this reason a
# https fallback is used. The https server mirrors the content of the S3 bucket. The https cabal
# store archive is read-only for security reasons.
#
# Users who fork this repository who want to have a writable cabal store archive are encouraged
# to set up their own S3 bucket.
- name: Cabal cache over HTTPS
uses: action-works/cabal-cache-s3@v1
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
dist-dir: dist-newstyle
store-path: ${{ steps.setup-haskell.outputs.cabal-store }}
threads: ${{ vars.BINARY_CACHE_THREADS }}
archive-uri: https://iohk.cache.haskellworks.io/${{ env.CABAL_CACHE_VERSION }}/${{ runner.os }}/${{ matrix.cabal }}/${{ matrix.ghc }}
skip: "${{ vars.BINARY_CACHE_URI != '' }}"
enable-save: false

# The following seems like a duplicate but it is due to a bug in cabal which can sometimes
# cause build intermittent build failures on Windows, so we run the build twice.
#
# https://github.com/haskell/cabal/issues/9587
#
# TODO Remove the workaround when the cabal bug is fixed.
- name: Build core components
continue-on-error: true
run: |
cabal build cardano-node cardano-cli cardano-node-chairman cardano-submit-api -j1
- name: Build all
run: cabal build all --enable-tests
- name: Build core components
run: |
cabal build cardano-node cardano-cli cardano-node-chairman cardano-submit-api -j1
- name: Build remaining components
run: |
cabal build all
- name: Run tests
env:
TMPDIR: ${{ runner.temp }}
TMP: ${{ runner.temp }}
KEEP_WORKSPACE: 1
run: cabal test all --enable-tests --test-show-details=direct -j1
run: |
cabal test cardano-testnet cardano-node cardano-node-chairman cardano-submit-api
- name: Tar failed tests workspaces
if: ${{ failure() }}
env:
TMP: ${{ runner.temp }}
shell: bash
run: |
cd $TMP
find . -name 'module' -type f -exec dirname {} \; | xargs -L1 basename | sort -u | xargs tar -czvf workspaces.tgz
- name: Upload workspaces on tests failure
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: failed-test-workspaces-${{ matrix.os }}-ghc${{ matrix.ghc }}-cabal${{ matrix.cabal }}.tgz
path: ${{ runner.temp }}/workspaces.tgz

- name: "Tar artifacts"
shell: bash
Expand All @@ -125,11 +189,20 @@ jobs:
fi
done
- name: Save Artifact
uses: actions/upload-artifact@v3
- name: Delete socket files in chairman tests in preparation for uploading artifacts
if: ${{ always() }}
shell: bash
run: |
if [ -d "${{ runner.temp }}/chairman" ]; then
find "${{ runner.temp }}/chairman" -type s -exec rm -f {} \;
fi
- uses: actions/upload-artifact@v2
if: ${{ always() }}
continue-on-error: true
with:
name: artifacts-${{ matrix.os }}-${{ matrix.ghc }}
path: ./artifacts
name: chairman-test-artifacts-${{ matrix.os }}-${{ matrix.ghc }}
path: ${{ runner.temp }}/chairman/

# Uncomment the following back in for debugging. Remember to launch a `pwsh` from
# the tmux session to debug `pwsh` issues. And be reminded that the `/msys2` and
Expand All @@ -143,9 +216,9 @@ jobs:
# and will silently fail if msys2 is not in path. See the "Run tests" step.
#
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true

build-complete:
Expand Down

0 comments on commit db1ece2

Please sign in to comment.