From c5c17ee27bfe09435264ddcad2d42b79f68b53f1 Mon Sep 17 00:00:00 2001 From: samantha-cashabbey23 Date: Thu, 6 Nov 2025 15:18:19 +0000 Subject: [PATCH 1/2] Add GitHub Actions workflow: Test Project --- .github/workflows/test-project.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/test-project.yml diff --git a/.github/workflows/test-project.yml b/.github/workflows/test-project.yml new file mode 100644 index 0000000..0221e2c --- /dev/null +++ b/.github/workflows/test-project.yml @@ -0,0 +1,36 @@ +name: Test Project + +on: + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + container: + image: node:20 + steps: + - uses: actions/checkout@v3 + with + +name: Test Project + +on: + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + container: + image: node:20 + steps: + - uses: actions/checkout@v3 + with: + node-version: 20 + - run: npm ci + - run: npm test + - run: npm run build + From 2e498421d84e850fee37c09c04f1f4e5d2d2ef28 Mon Sep 17 00:00:00 2001 From: samantha-cashabbey23 Date: Thu, 6 Nov 2025 15:41:04 +0000 Subject: [PATCH 2/2] Fix workflow: clean up and make steps resilient --- .github/workflows/test-project.yml | 32 +++++++++++------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test-project.yml b/.github/workflows/test-project.yml index 0221e2c..cbd3915 100644 --- a/.github/workflows/test-project.yml +++ b/.github/workflows/test-project.yml @@ -11,26 +11,18 @@ jobs: container: image: node:20 steps: - - uses: actions/checkout@v3 - with + - uses: actions/checkout@v4 -name: Test Project - -on: - pull_request: - branches: - - main + - name: Install dependencies + run: | + if [ -f package-lock.json ]; then + npm ci + else + npm install + fi -jobs: - test: - runs-on: ubuntu-latest - container: - image: node:20 - steps: - - uses: actions/checkout@v3 - with: - node-version: 20 - - run: npm ci - - run: npm test - - run: npm run build + - name: Run tests (if defined) + run: npm test --if-present + - name: Build (if defined) + run: npm run build --if-present