Skip to content

Commit

Permalink
Split unit tests and integration tests into different workflows
Browse files Browse the repository at this point in the history
This is needed to allow a new workflow present on master branch to
trigger these tests using a on:schedule trigger.

The previous workflow is preserved and still runs on each push.
  • Loading branch information
italo-sampaio committed Nov 27, 2023
1 parent 316b307 commit 6adb393
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 64 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Run integration tests

on:
workflow_call:
inputs:
powhsm-ref:
description: 'Branch or tag name to test for rsk-powhsm repo'
type: string
required: false
default: 'develop-2.3'
hsm-integration-test-ref:
description: 'Branch or tag name to test for hsm-integration-test repo'
type: string
required: false
default: '2.3.0.plus'

jobs:
run-integration-tests:
name: Integration tests
runs-on: ubuntu-20.04

steps:
- name: Checkout rsk-powhsm repo
uses: actions/checkout@v2
with:
path: rsk-powhsm
ref: ${{ inputs.powhsm-ref }}

- name: Build required software
working-directory: rsk-powhsm
run: |
docker/mware/build
docker/packer/build
middleware/build/manager-tcp
ledger/build/build-tcpsigner
shell: bash

- name: Checkout hsm-integration-test repo
uses: actions/checkout@v2
with:
repository: rootstock/hsm-integration-test
ref: ${{ inputs.hsm-integration-test-ref }}
path: hsm-integration-test
ssh-key: ${{ secrets.HSM_INTEGRATION_TEST_SSH_KEY }}

- name: Copy required files
run: |
mkdir hsm-integration-test/docker/manager/manager-tcp
tar -xzf rsk-powhsm/middleware/bin/manager-tcp.tgz \
-C hsm-integration-test/docker/manager/manager-tcp
cp rsk-powhsm/ledger/src/tcpsigner/tcpsigner \
hsm-integration-test/docker/tcpsigner/
shell: bash

- name: Run HSM integration tests
working-directory: hsm-integration-test
run: sh smoke-test.sh
shell: bash
68 changes: 4 additions & 64 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,13 @@
name: Run tests

on: [push]
on:
push:

jobs:
run-unit-tests:
name: Unit tests
runs-on: ubuntu-20.04

steps:
- name: Checkout this repo
uses: actions/checkout@v2

- name: Build the middleware docker image
run: docker/mware/build

- name: Middleware tests
run: middleware/test-all

- name: Ledger tests for TCPSigner
run: ledger/test/test-all

- name: Ledger Signer's tests
working-directory: ledger/src/signer/test/
run: |
for d in difficulty sha256 srlp; do
(cd "$d" && make clean test)
done
- name: Ledger common lib tests
working-directory: ledger/src/common/test/
run: |
for d in memutil; do
(cd "$d" && make clean test)
done
uses: rsksmart/rsk-powhsm/.github/workflows/unit-tests.yml

run-integration-tests:
name: Integration tests
runs-on: ubuntu-20.04

steps:
- name: Checkout rsk-powhsm repo
uses: actions/checkout@v2
with:
path: rsk-powhsm

- name: Build required software
working-directory: rsk-powhsm
run: |
docker/mware/build
docker/packer/build
middleware/build/manager-tcp
ledger/build/build-tcpsigner
- name: Checkout hsm-integration-test repo
uses: actions/checkout@v2
with:
repository: rootstock/hsm-integration-test
ref: 2.3.0.plus
path: hsm-integration-test
ssh-key: ${{ secrets.HSM_INTEGRATION_TEST_SSH_KEY }}

- name: Copy required files
run: |
mkdir hsm-integration-test/docker/manager/manager-tcp
tar -xzf rsk-powhsm/middleware/bin/manager-tcp.tgz \
-C hsm-integration-test/docker/manager/manager-tcp
cp rsk-powhsm/ledger/src/tcpsigner/tcpsigner \
hsm-integration-test/docker/tcpsigner/
- name: Run HSM integration tests
working-directory: hsm-integration-test
run: sh smoke-test.sh
uses: rsksmart/rsk-powhsm/.github/workflows/integration-tests.yml
49 changes: 49 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Run unit tests

on:
workflow_call:
inputs:
powhsm-ref:
description: 'Branch or tag name to test for rsk-powhsm repo'
type: string
required: false
default: 'develop-2.3'

jobs:
run-unit-tests:
name: Unit tests
runs-on: ubuntu-20.04

steps:
- name: Checkout this repo
uses: actions/checkout@v2
with:
ref: ${{ inputs.powhsm-ref }}

- name: Build the middleware docker image
run: docker/mware/build
shell: bash

- name: Middleware tests
run: middleware/test-all
shell: bash

- name: Ledger tests for TCPSigner
run: ledger/test/test-all
shell: bash

- name: Ledger Signer's tests
working-directory: ledger/src/signer/test/
run: |
for d in difficulty sha256 srlp; do
(cd "$d" && make clean test)
done
shell: bash

- name: Ledger common lib tests
working-directory: ledger/src/common/test/
run: |
for d in memutil; do
(cd "$d" && make clean test)
done
shell: bash

0 comments on commit 6adb393

Please sign in to comment.