Skip to content

CI Workflow for API Integration Testing #37

CI Workflow for API Integration Testing

CI Workflow for API Integration Testing #37

Workflow file for this run

name: CI Workflow for API Integration Testing
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
# Add timestamp
print_timestamp:
runs-on: ubuntu-latest
steps:
- name: Generate timestamp
run: |
echo "TIMESTAMP=$(TZ='America/Los_Angeles' date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
- name: Print timestamp
run: |
echo "Execution time (Pacific Time Zone) $TIMESTAMP"
test-and-publish:
needs: print_timestamp
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
run: npm install -g pnpm
- name: Install Dependencies
run: pnpm install
- name: Lint
run: pnpm eslint .
# Ensure you have a lint script in your package.json
- name: Run Tests On Seplia
continue-on-error: true
run: |
echo "Load environment variables"
touch .env.sepolia
echo API_BASE_URL=${{ secrets.API_BASE_URL }} >> .env.sepolia
echo API_PREFIX=${{ secrets.API_PREFIX_SEPOLIA }} >> .env.sepolia
echo API_KEY=${{ secrets.API_KEY }} >> .env.sepolia
test_env=sepolia npx playwright test
- name: Run Tests On Renaissance
continue-on-error: true
run: |
echo "Load environment variables"
touch .env.renaissance
echo API_BASE_URL=${{ secrets.API_BASE_URL }} >> .env.renaissance
echo API_PREFIX=${{ secrets.API_PREFIX_RENAISSANCE }} >> .env.renaissance
echo API_KEY=${{ secrets.API_KEY }} >> .env.renaissance
test_env=renaissance npx playwright test
- name: Upload Test Results
uses: actions/upload-artifact@v2
# if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
name: test-results
path: ./playwright-report-*/index.html