From 7c513483fff58965c02906a1dcac6929af59e7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thau=C3=A3=20Magalh=C3=A3es?= Date: Thu, 28 Mar 2024 11:43:50 -0300 Subject: [PATCH] chore: create build work added --- .github/workflows/main.yml | 190 ++++++++++++++++++++++--------------- 1 file changed, 112 insertions(+), 78 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e168243..e044436f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,7 +2,7 @@ name: CI # Controls when the workflow will run on: push: - branches: [ "main" ] + branches: ["main"] pull_request: types: [opened, synchronize] @@ -12,80 +12,114 @@ concurrency: cancel-in-progress: true jobs: - # Static tests don't involve any logic or context. - # They are just a set of tests that can detect if we are not introducing any faulty code. - static-test: - name: 🔬 Static tests - runs-on: ubuntu-latest - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: ⎔ Setup Node - uses: actions/setup-node@v3 - with: - cache: 'npm' - - - name: 🟨 Setup Python - uses: actions/setup-python@v3 - - - name: 📦 Install Node dependencies - run: npm install - - # Unit tests are tests that are not dependent on any external service. - # Usually, they are tests that are testing the logic of a specific function or component. - unit-test: - needs: [static-test] - name: 🚦 Unit tests - runs-on: ubuntu-latest - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: ⎔ Setup Node - uses: actions/setup-node@v3 - with: - cache: 'npm' - - - name: 🟨 Setup Python - uses: actions/setup-python@v3 - - - name: 📦 Install dependencies - run: npm install - - - name: 🚦 Run unit tests - run: npm test - - # Integration tests are tests that are dependent on external services. - integration-test: - needs: [static-test] - name: 🚥 Integration tests - runs-on: ubuntu-latest - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: ⎔ Setup Node - uses: actions/setup-node@v3 - with: - cache: 'npm' - - - name: 🟨 Setup Python - uses: actions/setup-python@v3 - - - name: 📦 Install dependencies - run: npm install - - # - name: 🐳 Docker compose - # run: - # docker-compose up -d && sleep 3 && pnpm prisma migrate reset --force - # --skip-seed - - - name: 🚦 Run integration tests - run: npm test + # Static tests don't involve any logic or context. + # They are just a set of tests that can detect if we are not introducing any faulty code. + static-test: + name: 🔬 Static tests + runs-on: ubuntu-latest + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: ⎔ Setup Node + uses: actions/setup-node@v3 + with: + cache: "npm" + + - name: 🟨 Setup Python + uses: actions/setup-python@v3 + + - name: 📦 Install Node dependencies + run: npm install + + # Unit tests are tests that are not dependent on any external service. + # Usually, they are tests that are testing the logic of a specific function or component. + unit-test: + needs: [static-test] + name: 🚦 Unit tests + runs-on: ubuntu-latest + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: ⎔ Setup Node + uses: actions/setup-node@v3 + with: + cache: "npm" + + - name: 🟨 Setup Python + uses: actions/setup-python@v3 + + - name: 📦 Install dependencies + run: npm install + + - name: 🚦 Run unit tests + run: npm test + + # Integration tests are tests that are dependent on external services. + integration-test: + needs: [static-test] + name: 🚥 Integration tests + runs-on: ubuntu-latest + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: ⎔ Setup Node + uses: actions/setup-node@v3 + with: + cache: "npm" + + - name: 🟨 Setup Python + uses: actions/setup-python@v3 + + - name: 📦 Install dependencies + run: npm install + + # - name: 🐳 Docker compose + # run: + # docker-compose up -d && sleep 3 && pnpm prisma migrate reset --force + # --skip-seed + + - name: 🚦 Run integration tests + run: npm test + + # Create Build + build: + needs: [static-test] + name: 🏗️ Build + runs-on: ubuntu-latest + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: ⎔ Setup Node + uses: actions/setup-node@v3 + with: + cache: "npm" + + - name: 🟨 Setup Python + uses: actions/setup-python@v3 + + - name: 📦 Install dependencies + run: npm install + + - name: 🏗️ Build + run: npm run build + + - name: 📦 Electron Package + run: npx electron-packager . LinguifAI --platform=win32 --arch=x64 --out=dist + + - name: 📦 Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: LinguifAI + path: dist