-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Trigger E2E Action | ||
description: Trigger E2E workflow for a specific version | ||
# this is used manually (workflow action) and automatically (merge to master) | ||
|
||
inputs: | ||
version: | ||
description: 'Version' | ||
required: true | ||
sha: | ||
description: 'Commit SHA' | ||
required: true | ||
bot_app_id: | ||
description: 'Bot App Id' | ||
required: true | ||
bot_app_key: | ||
description: 'Bot App Key' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- id: create_bot_token | ||
name: Create bot token | ||
uses: wow-actions/use-app-token@v2 | ||
with: | ||
app_id: ${{ inputs.bot_app_id }} | ||
private_key: ${{ inputs.bot_app_key }} | ||
- name: "Trigger E2E tests" | ||
uses: actions/github-script@v5 | ||
env: | ||
version: ${{ inputs.version }} | ||
sha: ${{ inputs.sha }} | ||
with: | ||
github-token: ${{ steps.create_bot_token.outputs.BOT_TOKEN }} | ||
script: | | ||
const {sha, version} = process.env; | ||
const repo = 'frontegg-angular' | ||
const owner = 'frontegg' | ||
const e2eRepo = 'e2e-system-tests' | ||
const workflow_id = 'frontegg-react-e2e-tests.yml' // should be renamed in a later phase | ||
const dispatch_id = `${repo}/${sha}` | ||
github.rest.actions.createWorkflowDispatch({ | ||
owner, | ||
repo: e2eRepo, | ||
workflow_id, | ||
ref: 'master', | ||
inputs: { | ||
version, | ||
dispatch_id, | ||
} | ||
}) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: "(▶) Trigger E2E tests Workflow" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version' | ||
required: true | ||
sha: | ||
description: 'Commit SHA' | ||
required: true | ||
|
||
jobs: | ||
trigger_e2e_tests: | ||
name: "Trigger E2E tests Workflow" | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: "Print inputs" | ||
run: | | ||
echo "Received test request for @frontegg/angular@${{ inputs.version }}" | ||
echo "From: ${{ inputs.sha }}" | ||
- name: "Call trigger-e2e-test action" | ||
uses: ./.github/actions/trigger-e2e-test | ||
with: | ||
version: ${{ inputs.version }} | ||
sha: ${{ inputs.sha }} | ||
bot_app_id: ${{ secrets.GH_FRONTEGG_BOT_APP_ID }} | ||
bot_app_key: ${{ secrets.GH_FRONTEGG_BOT_APP_SECRET }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* eslint-disable no-undef,@typescript-eslint/no-var-requires */ | ||
const { execSync } = require('child_process'); | ||
|
||
const delay = () => new Promise(resolve => setTimeout(() => resolve(), 1000)); | ||
|
||
module.exports = async (github, packages, version) => { | ||
let timeout = 60; | ||
|
||
|
||
const checkPackages = async () => { | ||
if (timeout === 0) { | ||
throw Error('TIMEOUT: Some packages does not appear in NPM registry'); | ||
} | ||
|
||
let allPackagesIndexed = true; | ||
|
||
for (let i in packages) { | ||
console.log(`Waiting for publish of version ${version} of ${packages[i]}`) | ||
try { | ||
const result = JSON.parse(execSync(`npm show ${packages[i]} --json dist-tags`).toString('utf8').trim()); | ||
console.log("Found versions: ", result) | ||
allPackagesIndexed = allPackagesIndexed && (result.alpha === version || result.next === version || result.latest === version); | ||
} catch (e) { | ||
console.error('Failed to check version for', packages[i], e); | ||
allPackagesIndexed = false; | ||
} | ||
} | ||
|
||
if (!allPackagesIndexed) { | ||
timeout--; | ||
await delay(); | ||
await checkPackages(); | ||
} | ||
}; | ||
|
||
await checkPackages(); | ||
}; |