Skip to content

Merge pull request #856 from axone-protocol/dependabot/go_modules/goo… #2312

Merge pull request #856 from axone-protocol/dependabot/go_modules/goo…

Merge pull request #856 from axone-protocol/dependabot/go_modules/goo… #2312

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/[email protected]
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/[email protected]
with:
go-version: "1.23"
- name: Restore Cache for Tools
uses: actions/cache@v4
with:
path: ./target/tools
key: tools-cache-${{ runner.os }}-${{ hashFiles('Makefile') }}
- name: Test go project
run: |
make test-go
- name: Upload coverage
uses: codecov/codecov-action@v5
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/[email protected]
with:
go-version: "1.23"
- name: Install AXONE blockchain
run: |
make build-go && 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