Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Style adjustments (#1864) #3894

Style adjustments (#1864)

Style adjustments (#1864) #3894

Workflow file for this run

name: Test and Deploy to Netlify
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
inputs:
reason:
description: 'Manual trigger'
required: true
default: 'Just because.'
jobs:
test-js:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install pnpm
run: npm install -g pnpm
- name: Install pnpm dependencies
run: pnpm install
- name: Start dwn-server container
run: docker compose up -d dwn-server
- name: Wait for dwn-server to be ready
run: until curl -sf http://localhost:3000/health; do echo -n .; sleep .1; done
- name: Run JS Tests
run: |
pnpm test:js
env:
VITE_APP_TEST_DWN_URL: http://localhost:3000
test-kotlin:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Setup Java 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Install pnpm
run: npm install -g pnpm
- name: Install pnpm dependencies
run: pnpm install
- name: Run Kotlin Tests
run: |
pnpm test:kotlin
test-swift:
runs-on: macOS-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Cache Swift dependencies
uses: actions/cache@v2
with:
path: ~/.swiftpm
key: ${{ runner.os }}-swift-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-swift-
- name: Setup Swift
uses: swift-actions/setup-swift@v1
with:
swift-version: "5.9.2"
- name: Get Swift version
run: swift --version # Log the Swift version in use
- name: Install pnpm
run: npm install -g pnpm
- name: Install pnpm dependencies
run: pnpm install
- name: Run Swift Tests
run: |
pnpm test:swift
test-apps:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
- name: Start dwn-server container
run: docker compose up -d dwn-server
- name: Wait for dwn-server to be ready
run: until curl -sf http://localhost:3000/health; do echo -n .; sleep .1; done
- name: Run apps tests
run: pnpm --filter feedback-server test run
deploy:
needs: [test-js, test-kotlin, test-swift, test-apps]
# Deploy the preview branch to Netlify only if it's a PR
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Trigger Netlify Build via Build Hook with Dynamic Params
run: |
BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}")
ENCODED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's|/|%2F|g')
TITLE="${BRANCH_NAME} Branch Deploy"
ENCODED_TITLE=$(echo "$TITLE" | sed 's| |%20|g')
curl -v -X POST -d "trigger_branch=$ENCODED_BRANCH_NAME&trigger_title=$ENCODED_TITLE&clear_cache=true" "https://api.netlify.com/build_hooks/${{ secrets.TEST_BUILDHOOK }}"