-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from currents-dev/feat/last-failed-example
Add examples for last failed tests
- Loading branch information
Showing
7 changed files
with
135 additions
and
62 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,65 @@ | ||
name: failed-only-reporter | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
test-reporter: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
shard: [1, 2, 3] | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
container: mcr.microsoft.com/playwright:latest | ||
env: | ||
CURRENTS_PROJECT_ID: bnsqNa | ||
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }} | ||
CURRENTS_CI_BUILD_ID: reporter-${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
CURRENTS_API_URL: ${{ secrets.CURRENTS_API_URL }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.ref }} | ||
|
||
# https://github.com/actions/runner-images/issues/6775 | ||
- run: | | ||
echo "$GITHUB_WORKSPACE" | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
npx playwright install chrome | ||
npm install -g @currents/cmd@beta | ||
- name: Load last run from cache | ||
# env: | ||
# DEBUG: "currents,currents:*" | ||
run: | | ||
npx currents cache get \ | ||
--preset last-run \ | ||
--preset-output .preset_output \ | ||
--matrix-index ${{ matrix.shard }} \ | ||
--matrix-total ${{ strategy.job-total }} | ||
echo "EXTRA_PW_FLAGS=$(cat .preset_output)" >> $GITHUB_ENV | ||
- name: Playwright Tests | ||
working-directory: ./basic | ||
run: | | ||
COMMAND="npx playwright test --config playwright.config.reporter.ts $EXTRA_PW_FLAGS" | ||
echo "Running command: $COMMAND" | ||
$COMMAND | ||
- name: Cache the last run results | ||
# env: | ||
# DEBUG: "currents,currents:*" | ||
if: ${{ always() }} | ||
run: | | ||
npx currents cache set \ | ||
--preset last-run \ | ||
--pw-output-dir basic/test-results \ | ||
--matrix-index ${{ matrix.shard }} \ | ||
--matrix-total ${{ strategy.job-total }} |
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,56 @@ | ||
name: failed-only-or8n | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
test-or8n: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
shard: [1, 2, 3] | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
container: mcr.microsoft.com/playwright:latest | ||
env: | ||
CURRENTS_PROJECT_ID: bnsqNa | ||
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }} | ||
CURRENTS_CI_BUILD_ID: ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
CURRENTS_API_KEY: ${{ secrets.CURRENTS_API_KEY }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.ref }} | ||
|
||
# https://github.com/actions/runner-images/issues/6775 | ||
- run: | | ||
echo "$GITHUB_WORKSPACE" | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
npx playwright install chrome | ||
npm install -g @currents/cmd@beta | ||
- name: Resolve Playwright options | ||
# --output basic/test-results/.last-run.json should point to the directory where the test results are stored | ||
run: | | ||
PREVIOUS_CI_BUILD_ID="${GITHUB_REPOSITORY}-${GITHUB_RUN_ID}-$((GITHUB_RUN_ATTEMPT - 1))" | ||
EXTRA_PW_FLAGS="" | ||
if [ ${{ github.run_attempt }} -gt 1 ]; then | ||
if npx currents api get-run --pw-last-run --ci-build-id | ||
$PREVIOUS_CI_BUILD_ID --output basic/test-results/.last-run.json; then | ||
EXTRA_PW_FLAGS="--last-failed" | ||
fi | ||
fi | ||
echo "EXTRA_PW_FLAGS=$EXTRA_PW_FLAGS" >> $GITHUB_ENV | ||
- name: Playwright Tests | ||
working-directory: ./basic | ||
run: | | ||
COMMAND="npx pwc-p ${{ env.EXTRA_PW_FLAGS }}" | ||
echo "Running command: $COMMAND" | ||
eval $COMMAND |
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
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