Update project configurations and enhance workflows #2
This file contains hidden or 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: 11 Artifacts and Caching | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'node-example/**' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'node-example/**' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: node-example | |
| steps: | |
| - uses: actions/checkout@v6.0.2 | |
| - name: Setup Node.js with caching | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| cache-dependency-path: node-example/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-results | |
| path: node-example/ | |
| retention-days: 5 | |
| download: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download test results | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: test-results | |
| path: results | |
| - name: Display retrieved artifact | |
| run: ls -la results/ |