Test 3 pipelines #4
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: angular-starter | |
| on: | |
| push: | |
| branches: [ master ] | |
| paths: | |
| - "angular/angular-starter/**" | |
| pull_request: | |
| branches: [ master ] | |
| paths: | |
| - "angular/angular-starter/**" | |
| jobs: | |
| install: | |
| runs-on: ubuntu-latest | |
| container: node:20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Angular CLI | |
| run: npm install -g @angular/cli | |
| - name: Install dependencies | |
| run: | | |
| cd angular/angular-starter | |
| npm ci | |
| - name: Cache node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: angular/angular-starter/node_modules | |
| key: ${{ runner.os }}-angular-starter-${{ hashFiles('angular/angular-starter/package-lock.json') }} | |
| test: | |
| runs-on: ubuntu-latest | |
| container: node:20 | |
| needs: install | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Angular CLI | |
| run: npm install -g @angular/cli | |
| - name: Install Chromium for headless tests | |
| run: | | |
| apt-get update | |
| apt-get install -y chromium | |
| - name: Set CHROME_BIN env variable | |
| run: echo "CHROME_BIN=$(which chromium)" >> $GITHUB_ENV | |
| - name: Install dependencies | |
| run: | | |
| cd angular/angular-starter | |
| npm ci | |
| - name: Run Angular unit tests in ChromeHeadless | |
| run: | | |
| cd angular/angular-starter | |
| npm run test:ci | |
| build: | |
| runs-on: ubuntu-latest | |
| container: node:20 | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Angular CLI | |
| run: npm install -g @angular/cli | |
| - name: Install dependencies | |
| run: | | |
| cd angular/angular-starter | |
| npm ci | |
| - name: Build Angular app for production | |
| run: | | |
| cd angular/angular-starter | |
| npm run build --configuration=production | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: angular-starter-dist | |
| path: angular/angular-starter/dist/ |