Github action for automating smart contracts testing with Hydra.
1.3K
Github action for smart contracts automated testing with Hydra.
This action will compile your contracts and execute hydra test on your project's root directory.
Run the following commands to initialize your repo, this github action expects the generated structure.
mkdir myproject && cd myproject
eosio init -project myproject
mv myproject contracts
hydra init
The contracts are automatically compiled using cmake v3.10, eosio.cdt v1.7.0 on ubuntu v18.04
Define a workflow in .github/workflows/my-workflow.yml (or add a job if you already have defined workflows).
:bulb: Read more about Configuring a workflow.
on:
pull_request:
push:
branches:
- master
tags:
- "**"
name: "Smart Contracts Tests"
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@master
- name: "Run hydra test"
uses: docker://blockmatic/eosio-hydra-action:latest
Running the interactive hydra login command is not an option on most CI servers. Instead, we recommend running hydra login locally and passing the resulting JSON authentication payload as a secure environment variable to the CI server.
The JSON authentication payload can be found in the ~/.hydra/auth.json file after login. It can then be passed as the HYDRA_AUTH environment variable to the CI server. The authentication info automatically renews expired authentication tokens as it includes a refresh token, therefore this setup only needs to be done once.
:bulb: Read more about Creating and storing encrypted secrets.
As Docker images are automatically built and pushed on a merge to master or when a new tag is created in this repository, the recommended way to use this GitHub action is to reference the pre-built Docker image directly, as seen above.
:bulb: The Docker image can also be executed directly by running
$ docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app -e HYDRA_AUTH=$(cat ~/.hydra/auth.json) blockmatic/eosio-hydra-action:latest
For more information, see the Docker Docs: Docker run reference.
Instead of using the latest pre-built Docker image, you can also specify a Docker image tag (which corresponds to the tags released on GitHub):
name: Hydra Tests
on:
pull_request:
push:
branches:
- master
tags:
- "**"
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@master
- name: "Run hydra test"
- uses: docker://blockmatic/eosio-hydra-action:latest
+ uses: docker://blockmatic/eosio-hydra-action:1.2.3
See LICENSE for copyright and license terms.
All repositories and other materials are provided subject to the terms of this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.
Blockmatic is building a robust ecosystem of people and tools for the development of blockchain applications.
Content type
Image
Digest
Size
519.4 MB
Last updated
about 6 years ago
docker pull blockmatic/eosio-hydra-action