diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml new file mode 100644 index 00000000..12697d88 --- /dev/null +++ b/.github/workflows/develop.yml @@ -0,0 +1,154 @@ +name: CI +# Controls when the workflow will run +on: + push: + branches: ["develop"] + pull_request: + types: [opened, synchronize] + +# Prevent duplicate workflows from running +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + 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 + + # Create Build + build: + # needs: [static-test, unit-test, integration-test] + name: πŸ—οΈ Build + runs-on: ubuntu-latest + steps: + - name: Set up Wine + uses: actions/setup-node@v2 + with: + node-version: "14" + + - name: Install Wine + run: sudo apt update && sudo apt install wine64 + + - 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: Get latest release number + id: get_latest_release + uses: actions/github-script@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const response = await github.repos.getLatestRelease({ + owner: context.repo.owner, + repo: context.repo.repo + }); + const latestRelease = response.data.tag_name; + const versionParts = latestRelease.replace(/^v/, '').split('.'); + const newVersion = `${parseInt(versionParts[0])}.${parseInt(versionParts[1])}.${parseInt(versionParts[2]) + 1}`; + console.log(`::set-output name=new_version::${newVersion}`); + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + with: + files: | + ./dist/LinguifAI-win32-x64/LinguifAI.exe + tag_name: v${{ steps.get_latest_release.outputs.new_version }} + name: Release v${{ steps.get_latest_release.outputs.new_version }} + prerelease: true + body: | + Descrição do release aqui diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7323e93f..6e70cc86 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,83 +14,81 @@ concurrency: 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. - # create block coment - - # static-test: - # name: πŸ”¬ Static tests - # runs-on: ubuntu-latest - # steps: - # - name: ⬇️ Checkout repo - # uses: actions/checkout@v4 - # with: - # fetch-depth: 2 + 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 Node + uses: actions/setup-node@v3 + with: + cache: "npm" - # - name: 🟨 Setup Python - # uses: actions/setup-python@v3 + - name: 🟨 Setup Python + uses: actions/setup-python@v3 - # - name: πŸ“¦ Install Node dependencies - # run: npm install + - 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 + 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 + 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: @@ -127,7 +125,7 @@ jobs: - name: πŸ“¦ Electron Package run: npx electron-packager . LinguifAI --platform=win32 --arch=x64 --out=dist - + - name: Get latest release number id: get_latest_release uses: actions/github-script@v4 @@ -142,7 +140,6 @@ jobs: const versionParts = latestRelease.replace(/^v/, '').split('.'); const newVersion = `${parseInt(versionParts[0])}.${parseInt(versionParts[1])}.${parseInt(versionParts[2]) + 1}`; console.log(`::set-output name=new_version::${newVersion}`); - - name: Create Release id: create_release @@ -152,5 +149,6 @@ jobs: ./dist/LinguifAI-win32-x64/LinguifAI.exe tag_name: v${{ steps.get_latest_release.outputs.new_version }} release_name: Release v${{ steps.get_latest_release.outputs.new_version }} + draft: true body: | Descrição do release aqui