Add deploy previews with Lighthouse tests (#159)

This commit is contained in:
Konrad Szwarc 2023-01-18 20:35:33 +01:00 committed by GitHub
parent 2c47a49260
commit 04dfc6e659
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 16 deletions

51
.github/workflows/check-app-quality.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: Check App Quality
on:
pull_request:
branches: [main]
jobs:
preview:
name: Create deploy preview
runs-on: ubuntu-latest
outputs:
deploy-url: ${{ steps.netlify.outputs.deploy-url }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: Install dependencies
run: npm ci
- name: Run Astro build command
run: npm run build
- name: Deploy to Netlify
id: netlify
uses: nwtgck/actions-netlify@v2
with:
publish-dir: dist
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
alias: deploy-preview-${{ github.event.number }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
lighthouse:
name: Run Lighthouse tests
needs: preview
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Lighthouse
uses: foo-software/lighthouse-check-action@master
with:
urls: ${{ needs.preview.outputs.deploy-url }}
gitAuthor: ${{ github.actor }}
gitBranch: ${{ github.ref }}
gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }}
device: all
prCommentEnabled: true
prCommentSaveOld: false

View file

@ -15,7 +15,7 @@ jobs:
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 16
cache: 'npm' cache: npm
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Run Prettier - name: Run Prettier
@ -29,22 +29,8 @@ jobs:
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 16
cache: 'npm' cache: npm
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Run TypeScript types check - name: Run TypeScript types check
run: npm run ts:check run: npm run ts:check
build:
name: Build project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run Astro build command
run: npm run build