-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
6 changed files
with
219 additions
and
162 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 |
---|---|---|
@@ -1,56 +1,56 @@ | ||
name: E2E Tests - Playwright | ||
name: E2E Tests | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [main] | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [main] | ||
env: | ||
CI: true | ||
E2E_URL: ${{ github.event_name == 'workflow_dispatch' && 'https://biancafiore.me' || 'http://localhost:4321' }} | ||
CI: true | ||
E2E_URL: ${{ github.event_name == 'workflow_dispatch' && 'https://biancafiore.me' || 'http://localhost:4321' }} | ||
jobs: | ||
e2e-tests: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js version from .nvmrc | ||
id: nvmrc | ||
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Install Playwright Browsers | ||
run: yarn playwright install --with-deps | ||
- name: Start application (for PRs only) | ||
if: github.event_name != 'workflow_dispatch' | ||
run: | | ||
yarn start & | ||
echo $! > .pidfile | ||
- name: Wait for application to be ready (for PRs only) | ||
if: github.event_name != 'workflow_dispatch' | ||
run: | | ||
echo "Waiting for application to start..." | ||
npx wait-on ${{ env.E2E_URL }} | ||
- name: Run E2E Tests - Playwright for PRs | ||
if: github.event_name == 'pull_request' | ||
run: yarn test:e2e:changed | ||
env: | ||
CI: ${{ env.CI }} | ||
E2E_URL: ${{ env.E2E_URL }} | ||
- name: Run E2E Tests - Playwright for Workflow Dispatch event | ||
if: github.event_dispatch == 'workflow_dispatch' | ||
run: yarn test:e2e | ||
env: | ||
CI: ${{ env.CI }} | ||
E2E_URL: ${{ env.E2E_URL }} | ||
- name: Stop application (for PRs only) | ||
if: always() && github.event_name != 'workflow_dispatch' | ||
run: | | ||
kill $(cat .pidfile) | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 | ||
e2e-tests: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js version from .nvmrc | ||
id: nvmrc | ||
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Install Playwright Browsers | ||
run: yarn playwright install --with-deps | ||
- name: Start application (for PRs only) | ||
if: github.event_name != 'workflow_dispatch' | ||
run: | | ||
yarn start & | ||
echo $! > .pidfile | ||
- name: Wait for application to be ready (for PRs only) | ||
if: github.event_name != 'workflow_dispatch' | ||
run: | | ||
echo "Waiting for application to start..." | ||
npx wait-on ${{ env.E2E_URL }} | ||
- name: Run E2E Tests - Playwright for PRs | ||
if: github.event_name == 'pull_request' | ||
run: yarn test:e2e:changed | ||
env: | ||
CI: ${{ env.CI }} | ||
E2E_URL: ${{ env.E2E_URL }} | ||
- name: Run E2E Tests - Playwright for Workflow Dispatch event | ||
if: github.event_dispatch == 'workflow_dispatch' | ||
run: yarn test:e2e | ||
env: | ||
CI: ${{ env.CI }} | ||
E2E_URL: ${{ env.E2E_URL }} | ||
- name: Stop application (for PRs only) | ||
if: always() && github.event_name != 'workflow_dispatch' | ||
run: | | ||
kill $(cat .pidfile) | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
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,53 @@ | ||
name: Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag_name: | ||
description: 'Tag name for the release' | ||
required: true | ||
push: | ||
tags: | ||
- '*' | ||
workflow_run: | ||
workflows: ["E2E Tests", "Unit Tests"] | ||
types: [completed] | ||
env: | ||
TAG_NAME: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name || github.ref_name }} | ||
jobs: | ||
check-tag: | ||
name: Check Tag | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
- name: Check if tag exists | ||
id: check_tag | ||
run: | | ||
git fetch --tags | ||
if git rev-parse "${{ env.tag_name }}" >/dev/null 2>&1; then | ||
echo "Tag already exists. Cancelling the release." | ||
exit 1 | ||
create-release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
needs: check-tag | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
- name: Create Tag (only for workflow_dispatch) | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
run: | | ||
git config user.name "github-actions" | ||
git config user.email "[email protected]" | ||
git tag ${{ env.TAG_NAME }} | ||
git push origin ${{ env.TAG_NAME }} | ||
- name: Set up GitHub CLI | ||
run: | | ||
sudo apt-get install -y gh | ||
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | ||
- name: Create Release with GitHub CLI | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh release create ${{ env.TAG_NAME }} --title "Release ${{ env.TAG_NAME }}" --notes "Release notes generated automatically." --generate-notes |
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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
name: Unit Tests - Vitest | ||
name: Unit Tests | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [main] | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [main] | ||
jobs: | ||
ut-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js version from .nvmrc | ||
id: nvmrc | ||
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Execute Unit tests | ||
run: yarn test:ut | ||
ut-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js version from .nvmrc | ||
id: nvmrc | ||
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Execute Unit tests | ||
run: yarn test:ut |
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
Oops, something went wrong.