Nightly Build #7
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
name: Nightly Build | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Runs daily at midnight UTC | |
workflow_dispatch: # Allows manual triggering of the workflow | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
branch: | |
- main | |
- sample-code/start-here | |
- sample-code/module-3-my-first-playwright-test | |
- sample-code/module-4-interacting-with-elements | |
- sample-code/module-5-refactoring | |
- sample-code/module-6-browser-options | |
- sample-code/module-7-browser-contexts | |
- sample-code/module-8-live-coding-demo | |
- sample-code/module-8-locators | |
- sample-code/module-9-forms | |
- sample-code/module-10-assertions | |
- sample-code/module-11-waits | |
- sample-code/module-12-api-interactions | |
- sample-code/module-12-mocking-api-calls | |
- sample-code/module-13-page-objects | |
- sample-code/module-14-allure-reporting | |
- sample-code/module-14-organizing-your-tests | |
- sample-code/module-14-tracing | |
- sample-code/module-15-parallel-execution | |
- sample-code/module-15-parallel-execution-annotated | |
- sample-code/module-16-allure-reporting | |
- sample-code/module-17-cucumber | |
- sample-code/module-20-docker-start | |
- sample-code/module-20-docker | |
- sample-code/end-to-end | |
continue-on-error: true # Allow the job to continue even if one branch fails | |
steps: | |
# Clean workspace | |
- name: Clean up any existing files | |
run: | | |
echo "Cleaning up existing files" | |
rm -rf * | |
ls -a | |
# Check out the repository code for the specific branch | |
- name: Checkout branch ${{ matrix.branch }} | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ matrix.branch }} | |
clean: true | |
# Check out the branch | |
- name: Fetch specific branch | |
run: git fetch origin ${{ matrix.branch }} && git checkout ${{ matrix.branch }} | |
- name: Show current branch | |
run: | | |
echo "Current branch: ${{ matrix.branch }}" | |
# Step 3: Confirm the branch and files | |
- name: Confirm Branch and Files | |
run: | | |
echo "Current branch: ${{ matrix.branch }}" | |
git branch | |
ls -R . | |
# Set up Node.js | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
# Set up JDK 17 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
# Install Maven 3.9.9 | |
- name: Setup Maven Action | |
uses: s4u/setup-maven-action@v1.7.0 | |
with: | |
checkout-fetch-depth: 0 | |
java-version: 17 | |
java-distribution: temurin | |
maven-version: 3.9.9 | |
# Verify Maven installation | |
- name: Verify Maven version | |
run: mvn --version | |
# ache Maven dependencies | |
- name: Cache Maven dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-maven-${{ matrix.branch }}-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven | |
# Install Playwright dependencies | |
- name: Install Playwright dependencies | |
run: npx playwright install-deps | |
# Run Maven to execute Playwright tests | |
- name: Run Playwright Tests | |
run: | | |
echo "Running tests for branch ${{ matrix.branch }}" | |
echo "Project structure with .java files:" | |
find . -name "*.java" | sed 's|[^/]*/| |g' | |
mvn clean verify |