Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/TailUFPB/LinguifAI into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
BertrandLira committed Jun 17, 2024
2 parents 08d18c8 + a3bcd22 commit fbbff43
Show file tree
Hide file tree
Showing 50 changed files with 16,866 additions and 3,007 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/create-release.yml

This file was deleted.

211 changes: 100 additions & 111 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -1,169 +1,158 @@
name: CI
# Controls when the workflow will run
on:
push:
branches: ["develop"]

# 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
version-bump:
name: 🔢 Version Bump
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: ⎔ Setup Node
uses: actions/setup-node@v3
fetch-depth: 0

- name: Automated Version Bump
uses: phips28/gh-action-bump-version@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
cache: "npm"
commit-message: 'CI: bumps version to {{version}} [skip ci]'
skip-tag: 'true'

- 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
build-linux:
name: 🏗️ Build Linux
runs-on: ubuntu-latest
needs: version-bump
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 2
fetch-depth: 0

- name: ⎔ Setup Node
uses: actions/setup-node@v3
with:
cache: "npm"
- name: Install dependencies
run: npm install

- name: 🟨 Setup Python
uses: actions/setup-python@v3
- name: 📦 Electron Builder Linux
run: npm run electron:package:linux
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 📦 Install dependencies
run: npm install
- name: Upload Linux artifact
uses: actions/upload-artifact@v2
with:
name: LinguifAI-Linux
path: dist/*.AppImage

- 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
build-windows:
name: 🏗️ Build Windows
runs-on: windows-latest
needs: version-bump
strategy:
fail-fast: false
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 2
fetch-depth: 0

- name: ⎔ Setup Node
uses: actions/setup-node@v3
with:
cache: "npm"

- name: Set up conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: default
environment-file: api/environment.yml

- name: 🟨 Setup Python
uses: actions/setup-python@v3
with:
python-version: 3.12.3

- name: Install pip dependencies
run: pip install -r api/requirements.txt pyinstaller==6.6.0

- name: 📦 Install dependencies
- name: Build flask exe
run: pyinstaller api/app.spec

- name: Install dependencies
run: npm install

# - name: 🐳 Docker compose
# run:
# docker-compose up -d && sleep 3 && pnpm prisma migrate reset --force
# --skip-seed
- name: 📦 Electron Builder Windows
run: npm run electron:package:win
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 🚦 Run integration tests
run: npm test
- name: Upload Windows artifact
uses: actions/upload-artifact@v2
with:
name: LinguifAI-Windows
path: dist/*.exe

# Create Build
build:
needs: [static-test, unit-test, integration-test]
name: 🏗️ Build
publish-release:
name: 🚀 Publish Release
runs-on: ubuntu-latest
needs: [build-linux, build-windows]
steps:
- name: Set up Wine
uses: actions/setup-node@v2
with:
node-version: "14"

- name: Install Wine64
run: sudo apt update && sudo apt install wine64

- name: Install Wine32
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install wine32
- 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
fetch-depth: 0

- name: 🏗️ Build
run: npm run build
- name: Get version of the project
id: project-version
uses: euberdeveloper/ga-project-version@main

#- name: 📦 Electron Package
# run: npx electron-packager . LinguifAI --platform=win32 --arch=x64 --out=dist

- name: 📦 Electron Builder
run: npm run electron:package:win
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download Linux artifact
uses: actions/download-artifact@v2
with:
name: LinguifAI-Linux
path: dist/

- name: Get latest release number
id: get_latest_release
uses: actions/github-script@v4
- name: Download Windows artifact
uses: actions/download-artifact@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const response = await github.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 10
});
const latestPreRelease = response.data[0];
const preReleaseTag = latestPreRelease.name;
const versionParts = preReleaseTag.replace(/^v/, '').split('.');
const newVersion = `${parseInt(versionParts[0])}.${parseInt(versionParts[1])}.${parseInt(versionParts[2]) + 1}`;
console.log(`::set-output name=new_version::${newVersion}`);
- name: Rename file
run: mv -f dist/LinguifAI\ Setup\ 0.1.0.exe dist/LinguifAI\ Setup\ ${{ steps.get_latest_release.outputs.new_version }}.exe
name: LinguifAI-Windows
path: dist/

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
./dist/LinguifAI\ Setup\ ${{ steps.get_latest_release.outputs.new_version }}.exe
tag_name: v${{ steps.get_latest_release.outputs.new_version }}
name: v${{ steps.get_latest_release.outputs.new_version }}
tag_name: v${{ steps.project-version.outputs.version }}
release_name: v${{ steps.project-version.outputs.version }}
draft: false
prerelease: true
body: |
Descrição do release aqui

- name: Upload Linux artifact
id: upload-linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/LinguifAI-${{ steps.project-version.outputs.version }}.AppImage
asset_name: LinguifAI-${{ steps.project-version.outputs.version }}.AppImage
asset_content_type: application/octet-stream

- name: Upload Windows artifact
id: upload-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/LinguifAI Setup ${{ steps.project-version.outputs.version }}.exe
asset_name: LinguifAI-Setup-${{ steps.project-version.outputs.version }}.exe
asset_content_type: application/octet-stream
Loading

0 comments on commit fbbff43

Please sign in to comment.