Skip to content

Feature/multi projection #10

Feature/multi projection

Feature/multi projection #10

Workflow file for this run

name: CI
on:
# Open any PR -> run tests
pull_request:
types: [opened, synchronize, reopened]
# Push to main branch -> run tests, build & deploy to test
push:
branches: [master]
env:
NODE_VERSION: 20
IMAGE_NAME: ${{ secrets.REGISTRY_ADDRESS }}/vuorovaikutusalusta
jobs:
test-client:
name: Test client
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
cache-dependency-path: ./client/package-lock.json
- name: Build & test
working-directory: client
run: npm i && npm test && npm run build
test-server:
name: Test server
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
cache-dependency-path: ./server/package-lock.json
- name: Build & test
working-directory: server
run: npm i && npm test && npm run build
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_ADDRESS }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
# Push only with 'latest' tag for caching
- name: Build
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.IMAGE_NAME }}:latest
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
cache-to: type=inline
push:
name: Push
# Run push only on pushes to master
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
needs: [test-client, test-server, build]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_ADDRESS }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
# Rebuild the image using the "latest" tag as cache
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.IMAGE_NAME }}:latest
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
cache-to: type=inline
deploy:
name: Deploy
needs: push
runs-on: ubuntu-latest
steps:
- name: Deploy
run: curl --fail -X POST '${{ secrets.DEPLOY_WEBHOOK_URL }}'