Skip to content

Commit

Permalink
Merge branch 'main' into fc/cleanup-wallet-module
Browse files Browse the repository at this point in the history
  • Loading branch information
florentc committed Feb 9, 2023
2 parents 6a3a5cc + ecb1dda commit e1babf8
Show file tree
Hide file tree
Showing 40 changed files with 440 additions and 739 deletions.
58 changes: 50 additions & 8 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,53 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }}
restore-keys: ${{ runner.os }}-

## Steps below run a certain program and creates two files:
## `${proj}-${step}.res` and `${proj}-${step}.out`. The former contains a
## string encoding the return code of the tool whereas the latter contains
## a human-readable description of what happened.
##
## The point of this is that we will execute these steps but we "succeed"
## iff the build is ok. Another job will then check the resulting files
## for their exit codes. This is ugly but it ensures that the `cabal
## build` gets cached even if tests fail, which means we save a lot of
## time (and CI runner money) in the long run.
##
- name: Build and run tests
run: |
nix develop .#ci --command cabal update
nix develop .#ci --command bash ci/run-tests.sh --ci
nix develop .#ci --command bash -c '
set -xuo
- name: Upload tests output
cabal update
cabal_builds_all_ok=true
for proj in examples cooked-validators; do
pushd "$proj" || exit
echo "Running `cabal build` on $proj"
cabal_res=0
cabal build | tee "../${proj}-cabal-build.out"
cabal_res=$?
echo "cabal_build:$cabal_res" > "../${proj}-cabal-build.res"
if [ $cabal_res -ne 0 ]; then
cabal_builds_all_ok=false
fi
echo "Running `cabal run tests` on $proj"
cabal_res=0
cabal run tests | tee "../${proj}-cabal-test.out"
cabal_res=$?
echo "run_cabal_test:$cabal_res" > "../${proj}-cabal-test.res"
popd || exit
done
if ! $cabal_builds_all_ok; then
exit 1
fi
'
- name: Upload build and test outputs
uses: actions/upload-artifact@v3
with:
name: plutus-libs-checks
Expand All @@ -128,20 +169,21 @@ jobs:
needs: build-and-test

steps:
- name: Accessing tests output
- name: Access build and test outputs
uses: actions/download-artifact@v3
with:
name: plutus-libs-checks

- name: Check tests output
run: |
is_ok=true
for proj in "examples" "cooked-validators"; do
for step in "cabal-build" "cabal-test"; do
for proj in examples cooked-validators; do
for step in cabal-build cabal-test; do
echo "!! [$proj]: output from $step"
cat $proj-$step.out
res=$(cat $proj-$step.res | cut -d':' -f2)
if [[ "$res" != "0" ]]; then
if [ "$res" -ne 0 ]; then
is_ok=false
fi
done
Expand All @@ -150,7 +192,7 @@ jobs:
## Because there will be a lot of tests, we print a summary of the
## results
echo "Summary of results (1 is failure)"
for proj in "examples" "cooked-validators"; do
for proj in examples cooked-validators; do
echo "Summary for: $proj"
cat ${proj}-*.res
done
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,19 @@ jobs:

- name: Build documentation
run: |
nix develop .#ci --command bash ci/build-haddock
nix develop .#ci --command bash -c '
set -o xtrace
cabal update
cabal haddock \
--haddock-hyperlink-source \
--haddock-html-location="http://hackage.haskell.org/packages/archive/\$pkg/latest/doc/html" \
cooked-validators
mkdir -p docs
cp --force --recursive dist-newstyle/build/*/ghc-*/cooked-validators-*/doc/html/cooked-validators/* docs
'
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
Expand Down
Loading

0 comments on commit e1babf8

Please sign in to comment.