Merge pull request #775 from input-output-hk/play_with_runners
Play with runners
Play with runners
This explains how to install a cardano runner for the Hydra project.
This runner is used by our smoke-tests and allows us to keep on disk
an, as up to date as possible, cardano-node database.
# prepare pre-requisites
Install the following pre-requisites:
* git
For instance on Debian:
```bash
sudo apt install git
```
Prepare the common directory for cardano database:
```bash
sudo mkdir -p /srv/var/cardano
sudo chown "$(whoami)" /srv/var/cardano
```
# Add the server as a github runner
In the project settings, go to Actions/Runners and click on [New self-hosted runner](https://github.com/input-output-hk/hydra/settings/actions/runners/new) and follow the procedure.
:warning: When asked, add the following label to this runner: `cardano`
# Customize github runner for nix
So that the jobs can find nix later, you should customize the runner settings by adding some
variables to the `.env` file:
```bash
cat <<EOF >>$HOME/actions-runner/.env
PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin
NIX_PROFILES="/nix/var/nix/profiles/default $HOME/.nix-profile"
NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
EOF
```
# Install github runner as a systemd unit
So that github runner runs as a daemon on the machine, [install it](https://docs.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service):
```bash
sudo ./svc.sh install
```
You can now start the service:
```bash
sudo ./svc.sh start
```
options:
- preview
- preprod
# Uncomment the following line when we feel ready to run smoke tests on mainnet
# - mainnet
- mainnet
hydra-scripts-tx-id:
description: "TxId of already published scripts (leave empty to publish)"
required: false
jobs:
smoke-test:
name: "Smoke test on ${{inputs.network}}"
runs-on: ubuntu-latest
runs-on: [self-hosted, cardano]
concurrency: cardano-${{inputs.network}}
env:
state_dir: /srv/var/cardano/state-${{inputs.network}}
steps:
- uses: actions/[email protected]
with:
extra_nix_config: |
accept-flake-config = true
- name: ❄ Cachix cache of nix derivations
uses: cachix/[email protected]
with:
name: hydra-node
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: 🔁 Github cache of state-directory
uses: actions/[email protected]
with:
path: state-${{inputs.network}}
key: state-${{inputs.network}}
- name: 🚬 Cleanup hydra-node state
run: |
rm -rf state-${{inputs.network}}/state-*
rm -rf ${state_dir}/state-*
- name: 🤐 Setup secret faucet key
if: ${{ inputs.network == 'mainnet' }}
- name: 🚬 Run hydra-cluster smoke test
run: |
if [ -n "${{inputs.hydra-scripts-tx-id}}" ]; then
nix develop ".?submodules=1#exes" --command bash -c "hydra-cluster --${{inputs.network}} --hydra-scripts-tx-id ${{inputs.hydra-scripts-tx-id}} --state-directory state-${{inputs.network}}"
nix develop ".?submodules=1#exes" --command bash -c "hydra-cluster --${{inputs.network}} --hydra-scripts-tx-id ${{inputs.hydra-scripts-tx-id}} --state-directory ${state_dir}"
else
nix develop ".?submodules=1#exes" --command bash -c "hydra-cluster --${{inputs.network}} --publish-hydra-scripts --state-directory state-${{inputs.network}}"
nix develop ".?submodules=1#exes" --command bash -c "hydra-cluster --${{inputs.network}} --publish-hydra-scripts --state-directory ${state_dir}"
fi
- name: 💾 Upload logs
if: always()
uses: actions/[email protected]
with:
name: hydra-cluster-logs
path: state-${{inputs.network}}/logs/**/*
path: ${state_dir}/logs/**/*
extra-source-files: README.md
data-files:
config/cardano-configurations/network/mainnet/cardano-node/config.json
config/cardano-configurations/network/mainnet/cardano-node/topology.json
config/cardano-configurations/network/mainnet/genesis/alonzo.json
config/cardano-configurations/network/mainnet/genesis/byron.json
config/cardano-configurations/network/mainnet/genesis/shelley.json
config/cardano-configurations/network/preprod/cardano-node/config.json
config/cardano-configurations/network/preprod/cardano-node/topology.json
config/cardano-configurations/network/preprod/genesis/alonzo.json
Includes direct 1:1 wrappers for misc builders (#197) and tx_builder (#210)
Wrappers around custom-written code written earlier for the rust crate.
Previous work on the builders/etc updates rust but introduced things caused the WASM to no longer compile. This updates the WASM bindings as well. Includes genesis module that wasn't pushed before.