Skip to content
This repository has been archived by the owner on Oct 29, 2022. It is now read-only.

Github action for automating EOSIO smart contracts testing with Hydra.

License

Notifications You must be signed in to change notification settings

blockmatic-icebox/eosio-hydra-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hydra Tests Github Action

Github action for smart contracts automated testing with Hydra.

What does this action do?

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

Usage

Define a workflow in .github/workflows/my-workflow.yml (or add a job if you already have defined workflows).

💡 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
        env:
          HYDRA_AUTH: ${{ secrets.HYDRA_AUTH }}

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.

💡 Read more about Creating and storing encrypted secrets.

Docker image

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.

💡 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
         env:
           HYDRA_AUTH: ${{ secrets.HYDRA_AUTH }}

Contributing

Read the contributing guidelines for details.

Blockmatic

Blockmatic is building a robust ecosystem of people and tools for the development of blockchain applications.

blockmatic.io

Blockmatic Twitter Blockmatic Facebook Blockmatic Github

About

Github action for automating EOSIO smart contracts testing with Hydra.

Resources

License

Stars

Watchers

Forks

Packages

No packages published