From 3669078563891fade61dd0d844e5e1771401e601 Mon Sep 17 00:00:00 2001 From: Florian BOUILLON Date: Tue, 4 Jul 2023 15:32:35 +0200 Subject: [PATCH] feat: Add basic full tests with actions Signed-off-by: Florian BOUILLON --- .editorconfig | 5 +++ .github/workflows/build_and_check.yml | 47 +++++++++++++++++++++++++++ Dockerfile | 1 + cypress/.gitignore | 1 + package.json | 8 +++-- 5 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build_and_check.yml diff --git a/.editorconfig b/.editorconfig index 1bde451..300dc04 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,3 +7,8 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true max_line_length = 120 + +# Yaml Standard +[*.{yaml,yml}] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/build_and_check.yml b/.github/workflows/build_and_check.yml new file mode 100644 index 0000000..f45993f --- /dev/null +++ b/.github/workflows/build_and_check.yml @@ -0,0 +1,47 @@ +name: Build, check & Test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + install: + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Node.js 20.x + uses: actions/setup-node@v3 + with: + node-version: 20.x + + - name: Install dependencies + run: npm ci + + build: + - name: Build + run: npm run build + + check: + needs: 'install' + steps: + - name: Check + run: | + npm run start & + wait 10 + npm run check + + + test: + needs: 'build' + steps: + - name: Test + run : | + npm run start & + sleep 10 + npm run test diff --git a/Dockerfile b/Dockerfile index 4c426b0..1590f1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,7 @@ FROM node:20-slim as PROD_IMAGE # inform software to be in production ENV NODE_ENV=production ENV HOST=0.0.0.0 +ENV ASTRO_TELEMETRY_DISABLED=true # Download & Install Slic3r # RUN apt-get update \ diff --git a/cypress/.gitignore b/cypress/.gitignore index 4094344..adaba54 100644 --- a/cypress/.gitignore +++ b/cypress/.gitignore @@ -1 +1,2 @@ videos +screenshots diff --git a/package.json b/package.json index 0a17abb..ddbd9fc 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,13 @@ "dev": "astro dev", "start": "node ./dist/server/entry.mjs", "build": "astro build", - "preview": "astro preview", "astro": "astro", - "test": "vitest --coverage" + "check": "npm run check:astro && npm run check:typescript", + "check:astro": "astro check", + "check:typescript": "tsc --noEmit", + "test": "npm run test:unit && npm run test:integ", + "test:unit": "vitest --coverage", + "test:integ": "cypress run" }, "dependencies": { "@astrojs/node": "^5",