Skip to content

Commit

Permalink
Resubmit version
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaloney111 committed Jun 17, 2024
1 parent 8f56f68 commit 5fa781b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 105 deletions.
135 changes: 31 additions & 104 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,122 +1,61 @@
name: CI
# Controls when the workflow will run
on:
push:
branches: ["main"]

# 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
fetch-depth: 0

- name: ⎔ Setup Node
uses: actions/setup-node@v3
- name: Get version of the project
id: project-version
uses: euberdeveloper/ga-project-version@main

- name: Automated Version Bump
uses: phips28/gh-action-bump-version@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
cache: "npm"

- name: 🟨 Setup Python
uses: actions/setup-python@v3
commit-message: 'feat: bumps minor version to {{version}} [skip ci]'
skip-tag: 'true'

- 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
build:
name: 🏗️ Build
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: 🟨 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: windows-latest
strategy:
fail-fast: false
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get version of the project
id: project-version
uses: euberdeveloper/ga-project-version@main

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

- 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
with:
Expand All @@ -136,9 +75,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Print directory tree
run: tree

- name: Get version of the project after bump
id: project-version-after
uses: euberdeveloper/ga-project-version@main

- name: Get latest release number
id: get_latest_release
uses: actions/github-script@v4
Expand All @@ -154,25 +94,12 @@ jobs:
const latestPreRelease = response.data[0];
const preReleaseTag = latestPreRelease.name;
const versionParts = preReleaseTag.replace(/^v/, '').split('.');
const newVersion = `${parseInt(versionParts[0])}.${parseInt(versionParts[1])+1}.0`;
console.log(`::set-output name=new_version::${newVersion}`);
const newV = `${parseInt(versionParts[0])}.${parseInt(versionParts[1])+1}.0`;
console.log(`::set-output name=new_version::${newV}`);
- name: Rename file
run: ren "dist\LinguifAI Setup 0.1.0.exe" "LinguifAI Setup ${{ steps.get_latest_release.outputs.new_version }}.exe"
run: ren "dist\LinguifAI Setup ${{ steps.project-version-after.outputs.version }}.exe" "LinguifAI Setup ${{ steps.get_latest_release.outputs.new_version }}.exe"

- name: Get latest commit message
id: get_latest_commit_message
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const response = await github.repos.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 1,
});
console.log(`::set-output name=commit_message::${response.data[0].commit.message}`);
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
Expand All @@ -182,4 +109,4 @@ jobs:
tag_name: v${{ steps.get_latest_release.outputs.new_version }}
name: v${{ steps.get_latest_release.outputs.new_version }}
prerelease: true
body: ${{ steps.get_latest_commit_message.outputs.commit_message }}
body: ${{ github.event.head_commit.message }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "TailLinguifAI",
"email": ""
},
"version": "0.3.11",
"version": "0.2.0",
"main": "./public/electron.js",
"homepage": "./",
"private": true,
Expand Down

0 comments on commit 5fa781b

Please sign in to comment.