Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,44 @@ jobs:
name: coverage
path: |
cover.out
coverage.html
coverage.html

docker-integration:
runs-on: ubuntu-latest
needs: CI

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
fetch-depth: 1

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
cache: true

- name: Git auth for private sdk (read-only)
env:
GH_SDK_TOKEN: ${{ secrets.GH_SDK_TOKEN }}
run: |
test -n "$GH_SDK_TOKEN" || { echo "GH_SDK_TOKEN missing"; exit 1; }
git config --global url."https://x-access-token:${GH_SDK_TOKEN}@github.com/0xAtelerix/sdk".insteadOf "https://github.com/0xAtelerix/sdk"
git config --global url."https://x-access-token:${GH_SDK_TOKEN}@github.com/0xAtelerix/sdk/".insteadOf "https://github.com/0xAtelerix/sdk/"
go env -w GOPRIVATE=github.com/0xAtelerix/*

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run integration tests
run: make ci-test

- name: Show logs on failure
if: failure()
run: make logs

- name: Cleanup
if: always()
run: make down ci-clean
34 changes: 32 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ build:
down:
docker compose down

logs:
docker compose logs

restart: down up

clean:
rm -Rdf appchain multichain test_consensus_app test_consensus app_data pelacli_data

rm -Rdf data

tidy:
go mod tidy
Expand Down Expand Up @@ -62,3 +64,31 @@ lints:

lints-fix:
$$(go env GOPATH)/bin/golangci-lint run ./... -v --timeout 10m --fix

# CI targets (uses docker for cleanup to handle CI environment permissions)
ci-clean:
docker run --rm -v $(PWD):/work alpine rm -rf /work/data

ci-up: ci-clean
@echo "🔼 Starting CI containers with latest pelacli..."
docker compose pull pelacli
docker compose up -d --build

ci-wait-healthy:
@echo "⏳ Waiting for services to be healthy..."
@for i in $$(seq 1 60); do \
if curl -sf http://localhost:8080/health > /dev/null 2>&1; then \
echo "✅ Appchain is healthy"; \
exit 0; \
fi; \
echo "Waiting for appchain... ($$i/60)"; \
sleep 2; \
done; \
echo "❌ Timeout waiting for appchain"; \
$(MAKE) logs; \
exit 1

ci-test: ci-up ci-wait-healthy
@echo "🧪 Running integration tests..."
./test_txns.sh
@echo "✅ CI integration test passed!"
Loading