Skip to content

Merge pull request #714 from axone-protocol/dependabot/github_actions… #1972

Merge pull request #714 from axone-protocol/dependabot/github_actions…

Merge pull request #714 from axone-protocol/dependabot/github_actions… #1972

Workflow file for this run

name: Test
on:
workflow_call:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
check-tests:
runs-on: ubuntu-22.04
outputs:
status: ${{ steps.changed-files.outputs.any_changed == 'true' }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Search for all modified files that involve the execution of tests
id: changed-files
uses: tj-actions/changed-files@v44.5.7
with:
files: |
**/*.go
go.mod
go.sum
Makefile
test-go:
runs-on: ubuntu-22.04
needs: check-tests
if: needs.check-tests.outputs.status
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup Go environment
uses: actions/setup-go@v5.0.2
with:
go-version: "1.21"
- name: Test go project
run: |
make test-go
- name: Upload coverage
uses: codecov/codecov-action@v4
if: github.actor != 'dependabot[bot]'
with:
files: ./target/coverage.txt
env_vars: OS,GOLANG
fail_ci_if_error: false
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
test-blockchain:
runs-on: ubuntu-22.04
timeout-minutes: 10
needs: check-tests
if: needs.check-tests.outputs.status
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get install jq
- name: Setup Go environment
uses: actions/setup-go@v5.0.2
with:
go-version: "1.21"
- name: Install AXONE blockchain
run: |
make build && make install
- name: Initialize blockchain
run: |
make chain-init
- name: Start the blockchain
run: |
make chain-start&
- name: Wait for blockchain to start
uses: ifaxity/wait-on-action@v1
with:
resource: http://0.0.0.0:26657/status
timeout: 10000 # ms
- name: Verify blockchain startup
run: |
STATUS=$(curl http://0.0.0.0:26657/status)
CHECK=$(echo $STATUS | jq '.result.validator_info | has("address")')
if [ $CHECK != "true" ]; then
echo "❌ Blockchain test failed"
echo "$STATUS"
exit -1
fi
- name: Stop the blockchain
run: |
make chain-stop