-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cabfe6
commit 9badfe8
Showing
49 changed files
with
7,737 additions
and
1,321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Buld a release | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build-macos: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Get version | ||
id: get-version | ||
run: | | ||
echo "tag=v$(cat version.txt)" >> $GITHUB_OUTPUT | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
- name: Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: | | ||
pip install pyinstaller websockets bleak | ||
cd ui ; npm install ; cd .. | ||
- name: Build application | ||
run: | | ||
cd ui ; npm run build ; cd .. | ||
pyinstaller api/ws_serve.py | ||
pyinstaller --add-data ui/dist:ui ui/serve.py | ||
- name: Package application | ||
id: package-app | ||
run: | | ||
zipname=$(basename ${GITHUB_REPOSITORY})-MacOS-${{ steps.get-version.outputs.tag }}.zip | ||
cd dist && zip -r $zipname ws_serve/ serve/ | ||
cd .. | ||
zip -u dist/$zipname start.sh | ||
mv dist/$zipname ./ | ||
echo "dist_path=$zipname" >> $GITHUB_OUTPUT | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-artifact-macos | ||
path: ${{ steps.package-app.outputs.dist_path }} | ||
|
||
# build-win: | ||
# runs-on: windows-latest | ||
# build-linux: | ||
# runs-on: ubuntu-latest | ||
create-release: | ||
needs: | ||
# - build-linux | ||
# - build-win | ||
- build-macos | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Get version | ||
id: get-version | ||
run: | | ||
echo "tag=v$(cat version.txt)" >> $GITHUB_OUTPUT | ||
- name: Update changelog | ||
id: update-changelog | ||
run: | | ||
API_URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/commits" | ||
COMMITS=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "$API_URL" | jq -r 'map(select(.commit.message | startswith("chore:") | not)) | .[] | "* \(.commit.message) [\(.sha[:7])](\(.html_url))"') | ||
echo "# Changelog" > changelog.tmp | ||
echo "" >> changelog.tmp | ||
echo "## v$(cat version.txt)" >> changelog.tmp | ||
echo "" >> changelog.tmp | ||
echo "$COMMITS" >> changelog.tmp | ||
echo "$COMMITS" > release_msg.tmp | ||
tail -n +2 CHANGELOG.md >> changelog.tmp | ||
mv changelog.tmp CHANGELOG.md | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git add CHANGELOG.md | ||
git commit -m "chore: update changelog" | ||
git push | ||
echo "release_text_path=$(realpath release_msg.tmp)" >> $GITHUB_OUTPUT | ||
# - name: Download ubuntu artifact | ||
# uses: actions/download-artifact@v3 | ||
# with: | ||
# name: build-artifact-ubuntu | ||
# path: . | ||
- name: Download macos artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build-artifact-macos | ||
path: . | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ steps.get-version.outputs.tag }} | ||
body_path: ${{ steps.update-changelog.outputs.release_text_path }} | ||
files: | | ||
./*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Increment Version | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
increment-version: | ||
runs-on: ubuntu-latest | ||
if: "!startsWith(github.event.head_commit.message, 'chore:')" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Increment version | ||
id: increment-version | ||
run: | | ||
raw_commits=$(cat <<EOFF | ||
${{ toJSON(github.event.commits) }} | ||
EOFF) | ||
commits=$(echo "$raw_commits" | jq ".[].message" | tr -d '"') | ||
IFS='.' read -r major minor patch <<< "$(cat version.txt)" | ||
readarray -t commit_messages <<< "$commits" | ||
is_incremented=0 | ||
for COMMIT_MESSAGE in "${commit_messages[@]}"; do | ||
if [[ "$COMMIT_MESSAGE" == "fix:"* ]]; then | ||
is_incremented=1 | ||
patch=$((patch + 1)) | ||
elif [[ "$COMMIT_MESSAGE" == "feat:"* ]]; then | ||
is_incremented=1 | ||
minor=$((minor + 1)) | ||
patch=0 | ||
elif [[ "$COMMIT_MESSAGE" == "fix!"* ]] || [[ "$COMMIT_MESSAGE" == "feat!"* ]]; then | ||
is_incremented=1 | ||
major=$((major + 1)) | ||
minor=0 | ||
patch=0 | ||
fi | ||
done | ||
echo "$major.$minor.$patch" > version.txt | ||
echo "tag=v$major.$minor.$patch" >> $GITHUB_OUTPUT | ||
echo "is_incremented=$is_incremented" >> $GITHUB_OUTPUT | ||
- name: Commit version changes | ||
if: ${{ steps.increment-version.outputs.is_incremented != 0 }} | ||
run: | | ||
echo "checking version" | ||
cat version.txt | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git add version.txt | ||
git commit -m "chore: bump version to $(cat version.txt)" | ||
git tag ${{ steps.increment-version.outputs.tag }} | ||
- name: Push changes | ||
if: ${{ steps.increment-version.outputs.is_incremented != 0 }} | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.ref }} | ||
tags: true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
if ! command -v pipenv &> /dev/null | ||
then | ||
alias pipenv=$(python3 -m site --user-base)/bin/pipenv | ||
fi | ||
cd backend | ||
LOG_LEVEL=info pipenv run server & | ||
pid1=$! | ||
|
||
cd ../ui | ||
npm run dev & | ||
pid2=$! | ||
cd .. | ||
|
||
sleep 2 | ||
open http://localhost:8080/ | ||
|
||
trap "kill $pid1 $pid2" EXIT | ||
wait $pid1 $pid2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
cd backend | ||
# ensure python is version 3 | ||
if ! command -v python3 &> /dev/null | ||
then | ||
echo "python3 could not be found" | ||
cd .. | ||
exit | ||
fi | ||
python3 -m pip install --user pipenv | ||
if ! command -v pipenv &> /dev/null | ||
then | ||
alias pipenv=$(python3 -m site --user-base)/bin/pipenv | ||
fi | ||
# install dependencies | ||
pipenv install --dev | ||
|
||
cd ../ui | ||
# ensure npm is installed | ||
if ! command -v npm &> /dev/null | ||
then | ||
echo "npm could not be found" | ||
cd .. | ||
exit | ||
fi | ||
rm -rf node_modules | ||
# install dependencies | ||
npm install -D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
cd "$(dirname "$0")" | ||
# ensure ws_serve and serve are built | ||
if [ ! -f ./ws_serve/ws_serve ] || [ ! -f ./serve/serve ]; then | ||
echo "This file is used to run a built version of the project." | ||
echo "Please run setup-dev.sh and use run-dev.sh to run the project" | ||
exit | ||
fi | ||
|
||
if [ "$(uname)" == "Darwin" ]; then | ||
# for MacOS, remove the quarantine attributes | ||
# this is needed because the mac will not execute binaries that are downloaded from the internet | ||
# see https://developer.apple.com/library/archive/technotes/tn2459/_index.html | ||
if xattr -p com.apple.quarantine ./ws_serve/ws_serve >/dev/null 2>&1; then | ||
find ./ -type file | xargs xattr -rd com.apple.quarantine | ||
fi | ||
fi | ||
|
||
./ws_serve/ws_serve & | ||
pid1=$! | ||
|
||
./serve/serve & | ||
pid2=$! | ||
|
||
sleep 5 | ||
open http://localhost:8080/ | ||
|
||
trap "kill $pid1 $pid2" EXIT | ||
wait $pid1 $pid2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-env node */ | ||
require('@rushstack/eslint-patch/modern-module-resolution') | ||
|
||
module.exports = { | ||
root: true, | ||
'extends': [ | ||
'plugin:vue/vue3-essential', | ||
'eslint:recommended', | ||
'@vue/eslint-config-prettier/skip-formatting' | ||
], | ||
parserOptions: { | ||
ecmaVersion: 'latest' | ||
} | ||
} |
Oops, something went wrong.