Skip to content

Add PR review policy #1615

Add PR review policy

Add PR review policy #1615

Workflow file for this run

name: "CI"
# Limit concurrent runs of this workflow within a single PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
- release
pull_request:
schedule:
# Everyday at 4:00 AM
- cron: "0 4 * * *"
jobs:
build-test:
name: "Build & test"
runs-on: ubuntu-latest
strategy:
matrix:
include:
- package: plutus-cbor
- package: plutus-merkle-tree
- package: hydra-plutus
- package: hydra-tui
- package: hydra-node
- package: hydra-cluster
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
- name: ❄ Prepare nix
uses: cachix/install-nix-action@v23
with:
extra_nix_config: |
accept-flake-config = true
log-lines = 1000
- name: ❄ Cachix cache of nix derivations
uses: cachix/cachix-action@v13
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
- name: ❓ Test
if: ${{ matrix.package != 'hydra-tui' }}
run: |
cd ${{ matrix.package }}
nix develop .#tests.${{ matrix.package }} --command tests
- name: ❓ Test (TUI)
id: test_tui
if: ${{ matrix.package == 'hydra-tui' }}
# https://giters.com/gfx/example-github-actions-with-tty
# The default shell does not allocate a TTY which breaks some tests
shell: 'script -q -e -c "bash {0}"'
env:
TERM: "xterm"
run: |
cd ${{ matrix.package }}
nix develop .#tests.${{ matrix.package }} --build
- name: πŸ’Ύ Upload build & test artifacts
uses: actions/upload-artifact@v3
with:
name: test-results
path: |
./**/test-results.xml
./**/hspec-results.md
# NOTE: This depends on the path used in hydra-cluster e2e tests
- name: πŸ’Ύ Upload logs
if: always()
uses: actions/upload-artifact@v3
with:
name: hydra-cluster-e2e-test-logs
path: /tmp/nix-shell.*/hydra-cluster-e2e-*/logs/*
publish-test-results:
name: Publish test results
needs: [build-test]
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Download test results
uses: actions/download-artifact@v3
with:
name: test-results
- name: ✏ Publish test results to PR
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: ./**/test-results.xml
haddock:
name: "Build haddock using nix"
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
- name: ❄ Prepare nix
uses: cachix/install-nix-action@v23
with:
extra_nix_config: |
accept-flake-config = true
log-lines = 1000
- name: ❄ Cachix cache of nix derivations
uses: cachix/cachix-action@v13
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
- name: πŸ“š Documentation (Haddock)
run: |
nix build .#haddocks
mkdir -p haddocks
cp -aL result/* haddocks/
- name: πŸ’Ύ Upload haddock artifact
uses: actions/upload-artifact@v3
with:
name: haddocks
path: haddocks
benchmarks:
name: "Benchmarks"
runs-on: ubuntu-latest
strategy:
matrix:
include:
- package: hydra-node
bench: tx-cost
options: '--output-directory $(pwd)/../benchmarks'
- package: hydra-node
bench: micro
options: '-o $(pwd)/../benchmarks/ledger-bench.html'
- package: hydra-cluster
bench: bench-e2e
options: 'datasets datasets/3-nodes.json datasets/1-node.json --output-directory $(pwd)/../benchmarks --timeout 1000s'
- package: plutus-merkle-tree
bench: on-chain-cost
options: '$(pwd)/../benchmarks'
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
- name: ❄ Prepare nix
uses: cachix/install-nix-action@v23
with:
extra_nix_config: |
accept-flake-config = true
log-lines = 1000
- name: ❄ Cachix cache of nix derivations
uses: cachix/cachix-action@v13
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
- name: πŸ“ˆ Benchmark
run: |
mkdir -p benchmarks
cd ${{ matrix.package }}
nix develop .#benchs.${{ matrix.package }} --command ${{ matrix.bench }} ${{ matrix.options }}
- name: πŸ’Ύ Upload build & test artifacts
uses: actions/upload-artifact@v3
with:
name: benchmarks
path: benchmarks
publish-benchmark-results:
name: Publish benchmark results
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
# TODO: this is actually only requires the tx-cost benchmark results
needs: [benchmarks]
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Download generated documentation
uses: actions/download-artifact@v3
with:
name: benchmarks
path: artifact
- name: βš™ Prepare comment body
id: comment-body
run: |
# Drop first 5 header lines and demote headlines one level
body="$(cat <(cat artifact/transaction-cost.md | sed '1,5d;s/^#/##/') <(cat artifact/end-to-end-benchmarks.md | sed '1,5d;s/^#/##/') | grep -v '^:::')"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=body::$body"
- name: πŸ”Ž Find Comment
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Transactions Costs
- name: ✏ Create or update comment
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.comment-body.outputs.body }}
reactions: rocket
build-specification:
name: "Build specification using nix"
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
- name: ❄ Prepare nix
uses: cachix/install-nix-action@v23
with:
extra_nix_config: |
accept-flake-config = true
log-lines = 1000
- name: ❄ Cachix cache of nix derivations
uses: cachix/cachix-action@v13
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
- name: ❄ Build specification PDF
run: |
nix build .#spec && cp result/*.pdf spec/
- name: πŸ’Ύ Upload specification
uses: actions/upload-artifact@v3
with:
name: hydra-spec
path: |
./spec/*.pdf
documentation:
name: Documentation
needs: [haddock,benchmarks,build-test,build-specification]
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
# For the cardanonical json schemas
submodules: true
# Ensure we have all history with all commits
fetch-depth: 0
- name: 🚧 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16
cache: 'yarn'
cache-dependency-path: docs/yarn.lock
- name: ❓ Test API reference
working-directory: docs
run: |
yarn
yarn validate
- name: πŸ“₯ Download benchmark results
uses: actions/download-artifact@v3
with:
name: benchmarks
path: docs/benchmarks
- name: πŸ“₯ Download haddock documentation
uses: actions/download-artifact@v3
with:
name: haddocks
path: docs/static/haddock
- name: πŸ“₯ Download test results
uses: actions/download-artifact@v3
with:
name: test-results
path: docs/benchmarks/tests
- name: πŸ“₯ Download specification PDF
uses: actions/download-artifact@v3
with:
name: hydra-spec
path: docs/static/
- name: πŸ“š Documentation sanity check
working-directory: docs
run: |
yarn
yarn build-dev