diff --git a/.github/workflows/deploy-on-push-to-main.yml b/.github/workflows/deploy-on-push-to-main.yml new file mode 100644 index 0000000..1152443 --- /dev/null +++ b/.github/workflows/deploy-on-push-to-main.yml @@ -0,0 +1,47 @@ +name: Deploy + +on: + push: + branches: + - 'main' + +permissions: + id-token: write + pages: write + deployments: write + +jobs: + docs: + name: '🌍 Deploy' + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: '☁️ Checkout repository' + uses: actions/checkout@v3 + + - name: '⚙️ Use Node.js' + uses: actions/setup-node@v3 + with: + check-latest: true + cache: 'npm' + + - name: '⛓️ Install dependencies' + run: npm ci --no-optional --no-audit --prefer-offline --progress=false + - name: '🛠️ Build' + run: npm run build --prod + + - name: Setup Pages + uses: actions/configure-pages@v2 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + # dist directory of the application + path: './dist/github-actions-tutorial/' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 \ No newline at end of file diff --git a/.github/workflows/test-on-pullrequest.yml b/.github/workflows/test-on-pullrequest.yml new file mode 100644 index 0000000..3b12e81 --- /dev/null +++ b/.github/workflows/test-on-pullrequest.yml @@ -0,0 +1,35 @@ +name: Run Angular tests + +on: + pull_request_target: + types: [opened, synchronize, reopened] + +jobs: + docs: + name: 'Run Angular tests' + runs-on: ubuntu-latest + + steps: + + - name: '☁️ Checkout repository' + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: '⚙️ Use Node.js' + uses: actions/setup-node@v3 + with: + check-latest: true + cache: 'npm' + + - name: '⚙️ Use Node.js' + uses: actions/setup-node@v3 + with: + check-latest: true + cache: 'npm' + + - name: '⛓️ Install dependencies' + run: npm ci --no-optional --no-audit --prefer-offline --progress=false + + - name: 'Test' + run: npm test \ No newline at end of file diff --git a/src/app/app.component.html b/src/app/app.component.html index 698fdbb..4c6946f 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -341,7 +341,7 @@ - {{ title }} app is running! + {{ title }} Hello World! Rocket Ship Smoke diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index aa0484b..3b81398 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -26,6 +26,6 @@ describe('AppComponent', () => { const fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); const compiled = fixture.nativeElement as HTMLElement; - expect(compiled.querySelector('.content span')?.textContent).toContain('github-actions-tutorial app is running!'); + expect(compiled.querySelector('.content span')?.textContent).toContain('github-actions-tutorial Hello World!'); }); });