Monitoring of nodes using prometheus #15
This file contains hidden or 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: API Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- '**/*.md' | |
- 'docs/**' | |
jobs: | |
api-tests: | |
name: Run API Tests | |
runs-on: ubuntu-latest | |
services: | |
mailhog: | |
image: mailhog/mailhog | |
ports: | |
- 1025:1025 | |
- 8025:8025 | |
env: | |
API_BASE_URL: http://localhost:8100/api/v1 | |
CHAINLAUNCH_USER: admin | |
CHAINLAUNCH_PASSWORD: admin123 | |
API_USERNAME: admin | |
API_PASSWORD: admin123 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23.4' | |
cache: true | |
- name: Check current user | |
run: whoami | |
- name: Install dependencies | |
run: | | |
go mod download | |
sudo apt-get update | |
sudo apt-get install -y build-essential | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v2 | |
- name: Build UI | |
run: | | |
cd web | |
bun install | |
bun run build | |
- name: Build the application | |
run: | | |
go build -v -o chainlaunch ./main.go | |
chmod +x chainlaunch | |
- name: Start the application and run tests | |
run: | | |
mkdir -p testdata | |
export CHAINLAUNCH_USER=admin | |
export CHAINLAUNCH_PASSWORD=admin123 | |
./chainlaunch serve --port=8100 --db data.db & | |
# Wait for port 8100 to be available (60 seconds timeout) | |
timeout=60 | |
while ! curl -s http://localhost:8100 > /dev/null; do | |
if [ $timeout -le 0 ]; then | |
echo "Timeout waiting for API to become available" | |
exit 1 | |
fi | |
echo "Waiting for API to become available... ($timeout seconds remaining)" | |
sleep 1 | |
timeout=$((timeout - 1)) | |
done | |
export API_USERNAME=${CHAINLAUNCH_USER} | |
export API_PASSWORD=${CHAINLAUNCH_PASSWORD} | |
export API_BASE_URL=http://localhost:8100/api/v1 | |
go test -v -tags=e2e ./e2e/... | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: api-test-results | |
path: test-results.xml |