Merge pull request #231 from HootDunk/frontend/add-svelte-check-gh-ac… #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2023 Libre311 Authors | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Libre311 Frontend CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
Libre311-Frontend-CI: | |
runs-on: ubuntu-latest | |
steps: | |
# setup node | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
# install dependencies | |
- name: Install Dependencies | |
run: npm ci | |
working-directory: ./frontend | |
# run prettier | |
- name: Check formatting with Prettier | |
run: npx prettier . --check | |
working-directory: ./frontend | |
# run linter | |
- name: Lint project with Eslint | |
run: npx eslint . | |
working-directory: ./frontend | |
# run svelte check | |
- name: Run Svelte Check | |
run: npm run check | |
working-directory: ./frontend | |
# run unit tests | |
- name: Run unit tests | |
run: npm run test:unit | |
working-directory: ./frontend | |
# Todo uncomment once integration tests are written | |
# run integration tests | |
## step 1) setup java | |
# - name: Set up JDK 11 | |
# uses: actions/setup-java@v3 | |
# with: | |
# java-version: "11" | |
# distribution: "temurin" | |
# - name: Run the server with Gradle | |
# env: | |
# VITE_BACKEND_URL: /api | |
# MICRONAUT_ENVIRONMENTS: dev,dev-data | |
# run: | | |
# ./gradlew app:run & | |
# - name: Create and populate .env file | |
# working-directory: ./frontend | |
# env: | |
# VITE_BACKEND_URL: /api | |
# VITE_GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
# VITE_GOOGLE_RECAPTCHA_KEY: ${{ secrets.GOOGLE_RECAPTCHA_KEY }} | |
# run: | | |
# touch .env | |
# echo VITE_BACKEND_URL="$VITE_BACKEND_URL" >> .env | |
# echo VITE_GOOGLE_API_KEY="$VITE_GOOGLE_API_KEY" >> .env | |
# echo VITE_GOOGLE_RECAPTCHA_KEY="$VITE_GOOGLE_RECAPTCHA_KEY" >> .env | |
# | |
# echo "cat .env" | |
# cat .env | |
# shell: bash | |
# ## step 2) install playwright | |
# - name: Install Playwright Browsers | |
# run: npx playwright install --with-deps | |
# working-directory: ./frontend | |
# ## step 3) run the playwright test | |
# - name: Run Playwright tests | |
# run: npx playwright test --workers=2 | |
# working-directory: ./frontend | |
# - uses: actions/upload-artifact@v3 | |
# if: always() | |
# with: | |
# name: playwright-report | |
# path: frontend/playwright-report/ | |
# retention-days: 30 |