Skip to content

Enhance CI configuration for ChromeHeadless testing with xvfb support #58

Enhance CI configuration for ChromeHeadless testing with xvfb support

Enhance CI configuration for ChromeHeadless testing with xvfb support #58

name: Deploy Angular Blog to Cloud Run
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
- run: npm ci
- uses: browser-actions/setup-chrome@v1
- run: echo "CHROME_BIN=$(which chrome)" >> $GITHUB_ENV
- run: sudo mount -t tmpfs tmpfs /dev/shm -o size=2G
- run: xvfb-run -a npm run test:all -- --browsers=ChromeHeadless --watch=false --no-progress
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
- run: npm ci
- run: npm run build -- --configuration production
- uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Install Google Cloud SDK
run: |
echo "Installing Google Cloud SDK"
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get install -y apt-transport-https ca-certificates
sudo apt-get update && sudo apt-get install -y google-cloud-sdk
gcloud version
- name: Deploy to Cloud Run using Buildpacks
uses: google-github-actions/deploy-cloudrun@v2
with:
service: angular-blog
region: europe-west4
source: .