Skip to content

Commit

Permalink
Merge pull request #18 from storyprotocol/update-ci
Browse files Browse the repository at this point in the history
Update CI run for sepolia & renaissance
AndyBoWu authored Apr 2, 2024
2 parents eddfdbc + 5284e86 commit ab87f2e
Showing 4 changed files with 33 additions and 8 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -44,14 +44,25 @@ jobs:
run: pnpm eslint .
# Ensure you have a lint script in your package.json

- name: Run Tests
- name: Run Tests On Seplia
continue-on-error: true
run: |
echo "Load environment variables"
export API_BASE_URL=${{ secrets.API_BASE_URL }}
export API_PREFIX=${{ secrets.API_PREFIX }}
export API_KEY=${{ secrets.API_KEY }}
pnpm exec playwright test
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: Push Slack Notification
uses: slackapi/slack-github-action@v1.25.0
@@ -88,4 +99,4 @@ jobs:
# if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
name: test-results
path: ./playwright-report/index.html
path: ./playwright-report-*/index.html
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -4,3 +4,6 @@ node_modules/
/blob-report/
/playwright/.cache/
.env
.env.renaissance
.env.sepolia
/playwright-report-*/
8 changes: 8 additions & 0 deletions global-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import dotevn from "dotenv";

async function globalSetup() {
if (process.env.test_env) {
dotevn.config({ path: `.env.${process.env.test_env}`, override: true });
}
}
export default globalSetup;
7 changes: 5 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -7,21 +7,24 @@ import { defineConfig } from '@playwright/test';
import dotenv from 'dotenv';
dotenv.config();

const EnvName = process.env.test_env || '';

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
/* Run tests in files in parallel */
globalSetup: require.resolve('./global-setup'),
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 0 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 4 : undefined,
workers: process.env.CI ? 6 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
reporter: [['html', { outputFolder: `playwright-report-${EnvName}` }]],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */

0 comments on commit ab87f2e

Please sign in to comment.