Chore: Add CI to check FP tests for every pull request (#40) #47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: docker_publish | |
on: | |
push: | |
branches: | |
- 'chore/ci-publish-docker' | |
- 'main' | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
lint_test: | |
uses: babylonlabs-io/.github/.github/workflows/[email protected] | |
with: | |
run-build: true | |
run-lint: true | |
run-unit-tests: true | |
run-check-mock-gen: true | |
run-gosec: true | |
gosec-args: "-exclude-generated -exclude-dir=testutil ./..." | |
docker_pipeline: | |
needs: ["lint_test"] | |
uses: babylonlabs-io/.github/.github/workflows/[email protected] | |
secrets: inherit | |
with: | |
publish: true | |
repoName: finality-gadget | |
test_finality_provider: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Clone finality-provider repository | |
run: | | |
current_hash=$(git rev-parse HEAD) | |
remote_url=$(git remote get-url origin) | |
if [[ $remote_url == https://* ]]; then | |
# For HTTPS URLs | |
repo_path=$(echo $remote_url | sed -E 's|https://github.com/(.+)(\.git)*|\1|') | |
else | |
# For SSH URLs | |
repo_path=$(echo $remote_url | sed -E 's/.*:(.+)\.git/\1/') | |
fi | |
fp_version=$(go list -m github.com/$repo_path@$current_hash) | |
git clone https://github.com/babylonlabs-io/finality-provider | |
cd finality-provider | |
git checkout base/consumer-chain-support | |
sed -i "s|github\.com\/babylonlabs-io\/finality-gadget.*|$fp_version|g" go.mod | |
go mod tidy | |
- name: Run op e2e tests | |
run: | | |
export PATH=${PATH}:$(go env GOPATH)/bin | |
cd finality-provider | |
make op-e2e-devnet | |
make test-e2e-op |