Skip to content

Commit

Permalink
Merge pull request #84 from qlrd/main
Browse files Browse the repository at this point in the history
v0.0.20-alpha-2
  • Loading branch information
qlrd authored Sep 23, 2024
2 parents b75d8fd + 7eaf2ac commit 38acc3c
Show file tree
Hide file tree
Showing 75 changed files with 4,739 additions and 5,547 deletions.
2 changes: 1 addition & 1 deletion .ci/create-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Type=Application
Terminal=false
Exec=/usr/local/bin/${app_name}
Name=${app_name}
Icon=/usr/share/icons/highcolor/512x512/apps/${app_name}.png
Icon=/usr/share/icons/hicolor/512x512/apps/${app_name}.png
EOF

echo ""
Expand Down
10 changes: 5 additions & 5 deletions .ci/create-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,25 +161,25 @@ ${description}
%{_bindir}/%{name}
%{_datadir}/doc/%{name}/README
%{_datarootdir}/applications/%{name}.desktop
%{_datarootdir}/icons/highcolor/512x512/apps/%{name}.png
%{_datarootdir}/icons/hicolor/512x512/apps/%{name}.png
%install
mkdir -p %{buildroot}
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/doc/%{name}
mkdir -p %{buildroot}%{_datarootdir}/applications/%{name}
mkdir -p %{buildroot}%{_datarootdir}/icons/highcolor/512x512/apps
mkdir -p %{buildroot}%{_datarootdir}/icons/hicolor/512x512/apps
cp %{name} %{buildroot}%{_bindir}
cp README %{buildroot}%{_datadir}/doc/%{name}/README
cp %{name}.png %{buildroot}%{_datarootdir}/icons/highcolor/512x512/apps/%{name}.png
cp %{name}.png %{buildroot}%{_datarootdir}/icons/hicolor/512x512/apps/%{name}.png
echo "[Desktop Entry]" > %{buildroot}%{_datarootdir}/applications/%{name}.desktop
echo "Encoding=UTF-8" >> %{buildroot}%{_datarootdir}/applications/%{name}.desktop
echo "Version=%{version}" >> %{buildroot}%{_datarootdir}/applications/%{name}.desktop
echo "Type=Application" >> %{buildroot}%{_datarootdir}/applications/%{name}.desktop
echo "Terminal=false" >> %{buildroot}%{_datarootdir}/applications/%{name}.desktop
echo "Exec=%{_bindir}/%{name}" >> %{buildroot}%{_datarootdir}/applications/%{name}.desktop
echo "Name=%{name}" >> %{buildroot}%{_datarootdir}/applications/%{name}.desktop
echo "Icon=%{_datarootdir}/icons/highcolor/512x512/apps/%{name}.png" >> %{buildroot}%{_datarootdir}/applications/%{name}.desktop
echo "Icon=%{_datarootdir}/icons/hicolor/512x512/apps/%{name}.png" >> %{buildroot}%{_datarootdir}/applications/%{name}.desktop
%clean
rm -rf %{buildroot}
Expand Down Expand Up @@ -208,7 +208,7 @@ echo ""
%postun
rm -v %{_datarootdir}/applications/%{name}.desktop
rm -v %{_datarootdir}/icons/highcolor/512x512/apps/%{name}.png
rm -v %{_datarootdir}/icons/hicolor/512x512/apps/%{name}.png
echo ""
echo " -------------"
echo " !!!WARNING!!!"
Expand Down
14 changes: 11 additions & 3 deletions .ci/patch-pyinstaller-kivy-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ PYHOOK_PATH="site-packages/kivy/tools/packaging/pyinstaller_hooks/__init__.py"
FULL_PATH=$PYENV_PATH/lib/python$PYENV_VERSION/$PYHOOK_PATH
echo "env FULL_PATH=$FULL_PATH"

wget $PATCHURL -O pyinstaller_hook_patch.py
echo "RUN wget $PATCHURL -O pyinstaller_hook_patch.py"
if which curl >/dev/null ; then
echo "RUN curl --output pyinstaller_hook_patch.py $PATCHURL"
curl --output pyinstaller_hook_patch.py $PATCHURL
elif which wget >/dev/null ; then
echo "RUN wget $PATCHURL -O pyinstaller_hook_patch.py"
wget $PATCHURL -O pyinstaller_hook_patch.py
else
echo "Cannot download, neither wget nor curl is available."
fi


echo "RUN diff -u $FULL_PATH pyinstaller_hook_patch.py > pyinstaller_hook.patch"
diff -u $FULL_PATH pyinstaller_hook_patch.py > pyinstaller_hook.patch

# patch it
echo "RUN patch $FULL_PATH < pyinstaller_hook.patch"
patch $FULL_PATH < pyinstaller_hook.patch
patch --verbose $FULL_PATH < pyinstaller_hook.patch

# remove remaining files
rm pyinstaller_hook_patch.py
Expand Down
248 changes: 248 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
name: Build

on:
workflow_run:
workflows: Tests
types: completed
branches:
- main
- '!develop'

jobs:

build:

strategy:
matrix:
include:
- os: ubuntu-latest
arch: x64

- os: windows-latest
arch: x64

- os: macos-13
arch: x64

- os: macos-14
arch: arm64

runs-on: ${{ matrix.os }}
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' }}

steps:

- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install poetry
run: pipx install poetry

- uses: actions/setup-python@v5
if: ${{ matrix.arch != 'arm64' }}
with:
python-version: '3.12'
cache: 'poetry'
cache-dependency-path: './poetry.lock'
architecture: ${{ matrix.arch }}

- uses: actions/setup-python@v5
if: ${{ matrix.arch == 'arm64' }}
with:
python-version: '3.12'

- name: Setup (Linux)
if: ${{ runner.os == 'Linux' }}
id: setup-linux
run: |
sudo apt-get install tree rpm
mkdir -p ./release
NAME="$(poetry run python -c 'from src.utils.constants import get_name; print(get_name())')"
VERSION="$(poetry run python -c 'from src.utils.constants import get_version; print(get_version())')"
DESCRIPTION="$(poetry run python -c 'from src.utils.constants import get_description; print(get_description())')"
echo "name=${NAME}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "description=${DESCRIPTION}" >> $GITHUB_OUTPUT
- name: Setup (MacOS)
if: ${{ runner.os == 'macOS' }}
id: setup-macos
run: |
brew install create-dmg
brew reinstall openssl@3
brew unlink openssl@3 && brew link openssl@3
#OPENSSL_MAJOR_VERSION=`$(which openssl) -version | awk '{ print $2}' | cut -d . -f1`
OPENSSL_FULL_VERSION=`$(which openssl) -version | awk '{ print $2}'`
OPENSSL_PATH="/opt/homebrew/Cellar/openssl@3/${OPENSSL_FULL_VERSION}"
echo "dyld-path=${OPENSSL_PATH}/lib" >> $GITHUB_OUTPUT
- name: Install project and its dependencies
run: poetry install

- name: Build dist (Linux)
if: ${{ runner.os == 'Linux' }}
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
with:
run: |
poetry add pytest-xvfb
poetry run poe build-linux
- name: Build dist (MacOS)
if: ${{ runner.os == 'macOS' }}
env:
DYLD_LIBRARY_PATH: ${{ steps.setup-macos.outputs.dyld-path }}
run: poetry run poe build-macos

- name: Build dist (Windows)
if: ${{ runner.os == 'Windows' }}
env:
KIVY_GL_BACKEND: 'angle_sdl2'
run: poetry run poe build-win

- name: Build release deb (Linux)
if: ${{ runner.os == 'Linux' }}
id: release-deb
env:
NAME: ${{ steps.setup-linux.outputs.name }}
VERSION: ${{ steps.setup-linux.outputs.version }}
DESCRIPTION: ${{ steps.setup-linux.outputs.description }}
run: |
sh .ci/create-deb.sh \
-a "${NAME}" \
-o ./release \
-v $VERSION \
-A amd64 \
-m qlrd \
-e [email protected] \
-d "${DESCRIPTION}" \
-b "./dist/${NAME}" \
-i ./assets/icon.png
tree ./release
echo "build-path=$(pwd)/release" >> $GITHUB_OUTPUT
echo "pkg=${NAME}_${VERSION}_amd64.deb" >> $GITHUB_OUTPUT
- name: Build release rpm (Linux)
if: ${{ runner.os == 'Linux' }}
id: release-rpm
env:
NAME: ${{ steps.setup-linux.outputs.name }}
VERSION: ${{ steps.setup-linux.outputs.version }}
DESCRIPTION: ${{ steps.setup-linux.outputs.description }}
run: |
RPM_VERSION=$(sed -e 's/-/_/g' <<< $VERSION)
sh .ci/create-rpm.sh \
-a "${NAME}" \
-v $RPM_VERSION \
-m qlrd \
-e [email protected] \
-d "${DESCRIPTION}" \
-c ./CHANGELOG.md \
-r ./README.md \
-b "./dist/${NAME}" \
-i ./assets/icon.png
tree ./release
rpmbuild -vv -bb --define "_bindir /usr/local/bin" $HOME/rpmbuild/SPECS/$NAME.spec
cp $HOME/rpmbuild/RPMS/x86_64/${NAME}-${RPM_VERSION}-1.x86_64.rpm ./release/${NAME}-${RPM_VERSION}-1.x86_64.rpm4
echo "build-path=${HOME}/rpmbuild/RPMS/x86_64" >> $GITHUB_OUTPUT
echo "pkg=${NAME}-${RPM_VERSION}-1.x86_64.rpm" >> $GITHUB_OUTPUT
- name: Build release dmg (MacOS)
if: ${{ runner.os == 'macOS' }}
id: release-macos
run: |
NAME="$(poetry run python -c 'from src.utils.constants import get_name; print(get_name())')"
VER="$(poetry run python -c 'from src.utils.constants import get_version; print(get_version())')"
ARCH="$(uname -m)"
mkdir -p ./release
create-dmg --volname "${NAME}" --volicon ./assets/icon.icns --window-pos 200 120 --window-size 800 400 --icon-size 100 --icon "${NAME}.app" 200 190 --app-drop-link 600 185 "./release/${NAME}_${VER}_${ARCH}.dmg" "./dist/${NAME}.app"
echo "build-path=$(pwd)/release" >> $GITHUB_OUTPUT
echo "pkg=${NAME}_${VER}_${ARCH}.dmg" >> $GITHUB_OUTPUT
- name: Build release NSIS (Windows)
if: ${{ runner.os == 'Windows' }}
id: release-windows
shell: pwsh
run: |
choco --yes install nsis
New-Item ".\release" -Type Directory
$name = poetry run python -c 'from src.utils.constants import get_name; print(get_name())'
$version = poetry run python -c 'from src.utils.constants import get_version; print(get_version())'
$description = poetry run python -c 'from src.utils.constants import get_description; print(get_description())'
poetry run python .ci/create-nsis.py -a $name -b .\dist\krux-installer.exe -o selfcustody -V $version -d "$description" -l .\LICENSE -i .\assets\icon.ico -O .
makensis.exe .\krux-installer.nsi
Move-Item -Path ".\krux-installer Setup.exe" -Destination ".\release\krux-installer_v$version Setup.exe"
echo "build-path=$pwd\release" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "pkg=krux-installer_v$version Setup.exe" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Hash (Linux deb)
if: ${{ runner.os == 'Linux' }}
uses: qlrd/sha256sum-action@v3
id: hash-deb
with:
working-directory: ${{ steps.release-deb.outputs.build-path }}
file: ${{ steps.release-deb.outputs.pkg }}
ext: 'sha256.txt'

- name: Hash (Linux rpm)
if: ${{ runner.os == 'Linux' }}
uses: qlrd/sha256sum-action@v3
id: hash-rpm
with:
working-directory: ${{ steps.release-rpm.outputs.build-path }}
file: ${{ steps.release-rpm.outputs.pkg }}
ext: 'sha256.txt'

- name: Hash (MacOS)
if: ${{ runner.os == 'macOS' }}
uses: qlrd/sha256sum-action@v3
id: hash-macos
with:
working-directory: ${{ steps.release-macos.outputs.build-path }}
file: ${{ steps.release-macos.outputs.pkg }}
ext: 'sha256.txt'

- name: Hash (Windows)
if: ${{ runner.os == 'Windows' }}
uses: qlrd/sha256sum-action@v3
id: hash-win
with:
working-directory: ${{ steps.release-windows.outputs.build-path }}
file: ${{ steps.release-windows.outputs.pkg }}
ext: 'sha256.txt'

- name: Upload artifact deb (Linux)
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-deb.outputs.pkg }}
path: |
${{ steps.release-deb.outputs.build-path}}/${{ steps.release-deb.outputs.pkg }}
${{ steps.release-deb.outputs.build-path}}/${{ steps.release-deb.outputs.pkg }}.sha256.txt
- name: Upload artifact rpm (Linux)
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-rpm.outputs.pkg }}
path: |
${{ steps.release-rpm.outputs.build-path}}/${{ steps.release-rpm.outputs.pkg }}
${{ steps.release-rpm.outputs.build-path}}/${{ steps.release-rpm.outputs.pkg }}.sha256.txt
- name: Upload artifacts (MacOS)
if: ${{ runner.os == 'macOS' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-macos.outputs.pkg }}
path: |
${{ steps.release-macos.outputs.build-path}}/${{ steps.release-macos.outputs.pkg }}
${{ steps.release-macos.outputs.build-path}}/${{ steps.release-macos.outputs.pkg }}.sha256.txt
- name: Upload artifacts (Windows)
if: ${{ runner.os == 'Windows' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-windows.outputs.pkg }}
path: |
${{ steps.release-windows.outputs.build-path}}/${{ steps.release-windows.outputs.pkg }}
${{ steps.release-windows.outputs.build-path}}/${{ steps.release-windows.outputs.pkg }}.sha256.txt
10 changes: 2 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ jobs:
list-files: json
filters: |
change:
- '.gitignore'
- '.pylintrc'
- 'TODO.md'
- 'CHANGELOG.md'
- 'LICENSE'
Expand All @@ -39,14 +36,11 @@ jobs:
let workflowFailMessage = "It looks like you've modified some files that we can't accept as contributions."
try {
const badFilesArr = [
'.gitignore',
'.pylintrc',
'TODO.md',
'CHANGELOG.md',
'LICENSE'
]
const badFiles = badFilesArr.join('\n- ')
const reviewMessage = `👋 Hey there kruxer. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:\n- ${badFiles}\n\nYou'll need to revert all of the files you changed in that list using [GitHub Desktop](https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/managing-commits/reverting-a-commit) or \`git checkout origin/main <file name>\`. Once you get those files reverted, we can continue with the review process. :octocat:\n\nMore discussion:\n- https://github.com/electron-vite/electron-vite-vue/issues/192`
const reviewMessage = `👋 Hey there kruxer. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:\n- ${badFiles}\n\nYou'll need to revert all of the files you changed in that list using [GitHub Desktop](https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/managing-commits/reverting-a-commit) or \`git checkout origin/main <file name>\`. Once you get those files reverted, we can continue with the review process. :octocat:`
createdComment = await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down Expand Up @@ -82,4 +76,4 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}

- name: Lint markdown
run: npx markdownlint-cli ${{ needs.job1.outputs.markdown_files }} --ignore node_modules
run: npx markdownlint-cli --disable MD033 --ignore node_modules ${{ needs.job1.outputs.markdown_files }}
Loading

0 comments on commit 38acc3c

Please sign in to comment.