-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple bugfixes and tweaks around Github actions. (#147)
* [API] Handle imink API being down * [API] Fix getVersion discrepency causing an error * [Github] Update actions and cleanup job ordering * [Github:MacOS] Use venv for macos building. Co-Authored-By: Spotlight <[email protected]> * [Github:MacOS] Add test for macos * [Github:MacOS] Install pyqt6 inside of venv * [Github] Pin versions and Support PR's * [Github] Dont include the test output.log file * [Fix] Update _version.py to handle tags and PR's correctly * [Github:MacOS] Fix typo in curl --------- Co-authored-by: Spotlight <[email protected]>
- Loading branch information
1 parent
f6e683f
commit ba58863
Showing
6 changed files
with
205 additions
and
96 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 |
---|---|---|
@@ -1,99 +1,130 @@ | ||
name: 'Build NSO-RPC - x86_64' | ||
--- | ||
name: Build NSO-RPC - x86_64 | ||
on: | ||
release: | ||
types: [published] | ||
|
||
types: | ||
- published | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
jobs: | ||
build-x86_64: | ||
name: 'Build NSO-RPC - x86_64' | ||
runs-on: ${{ matrix.os }} | ||
build-windows: | ||
name: Build NSO-RPC - Windows | ||
runs-on: windows-2022 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ['windows-latest', 'ubuntu-latest', 'macos-latest'] | ||
pyqt_version: | ||
- pyqt6 | ||
- pyqt5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.11.4 | ||
|
||
# Windows Build | ||
- name: "Build" | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
cd scripts && | ||
python -m pip install pyqt6 && | ||
./build.bat | ||
- name: "Upload Build" | ||
if: matrix.os == 'windows-latest' | ||
uses: softprops/[email protected] | ||
with: | ||
files: client/dist/NSO-RPC.exe | ||
|
||
# Linux Build | ||
- name: "Upload script" | ||
if: matrix.os == 'ubuntu-latest' | ||
uses: softprops/[email protected] | ||
with: | ||
files: scripts/linux.sh | ||
|
||
# MacOS Build | ||
- name: "Build" | ||
if: matrix.os == 'macos-latest' | ||
run: | | ||
cd scripts && | ||
python -m pip install pyqt6 && | ||
bash ./build.sh && | ||
cd ../client/dist && | ||
ln -s /Applications "Applications (admin)" && | ||
hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-installer.dmg && | ||
zip -yr mac-portable.zip NSO-RPC.app/ | ||
- name: "Upload Build" | ||
if: matrix.os == 'macos-latest' | ||
uses: softprops/[email protected] | ||
with: | ||
files: | | ||
client/dist/mac-installer.dmg | ||
client/dist/mac-portable.zip | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11.4 | ||
- name: Build | ||
run: | | ||
python -m pip install ${{ matrix.pyqt_version }} && | ||
cd scripts && | ||
./build.bat | ||
- name: Rename executable | ||
if: matrix.pyqt_version == 'pyqt5' | ||
run: mv client/dist/NSO-RPC.exe client/dist/NSO-RPC-qt5.exe | ||
- name: Upload Build | ||
if: github.event_name != 'pull_request' | ||
uses: softprops/[email protected] | ||
with: | ||
files: | | ||
client/dist/NSO-RPC*.exe | ||
build-linux: | ||
name: Build NSO-RPC - Linux | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11.4 | ||
- name: Upload script | ||
run: | | ||
cd scripts && | ||
chmod +x linux.sh | ||
continue-on-error: false | ||
- name: Upload Build | ||
if: github.event_name != 'pull_request' | ||
uses: softprops/[email protected] | ||
with: | ||
files: scripts/linux.sh | ||
build-macos: | ||
name: Build NSO-RPC - MacOS | ||
runs-on: macos-12 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11.4 | ||
- name: Build | ||
run: > | ||
cd scripts && | ||
./build.sh && | ||
cd ../client/dist && | ||
bash ../../scripts/tests/macos_test.sh && | ||
rm output.log && | ||
ln -s /Applications "Applications (admin)" && | ||
hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-installer.dmg && | ||
zip -yr mac-portable.zip NSO-RPC.app/ | ||
- name: Upload Build | ||
if: github.event_name != 'pull_request' | ||
uses: softprops/[email protected] | ||
with: | ||
files: | | ||
client/dist/mac-installer.dmg | ||
client/dist/mac-portable.zip | ||
build-universal2: | ||
name: 'Build NSO-RPC - Universal2' | ||
runs-on: macos-latest | ||
name: Build NSO-RPC - Universal2 | ||
runs-on: macos-12 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# MacOS Universal Build | ||
- name: "Install Python 3.11.4 and build NSO-RPC" | ||
run: | | ||
curl https://www.python.org/ftp/python/3.11.4/python-3.11.4-macos11.pkg -o python-3.11.4-macos11.pkg | ||
sudo installer -verbose -pkg python-3.11.4-macos11.pkg -target / && | ||
alias python3=python3.11 | ||
cd scripts/macos-universal2 && | ||
bash ./build.sh && | ||
cd ../../client/dist && | ||
ln -s /Applications "Applications (admin)" && | ||
hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-universal2-installer.dmg && | ||
zip -yr mac-universal2-portable.zip NSO-RPC.app/ | ||
- name: "Upload NSO-RPC Universal2 Build" | ||
uses: softprops/[email protected] | ||
with: | ||
files: | | ||
client/dist/mac-universal2-installer.dmg | ||
client/dist/mac-universal2-portable.zip | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11.4 | ||
- name: Install Python 3.11.4 and build NSO-RPC | ||
run: > | ||
curl https://www.python.org/ftp/python/3.11.4/python-3.11.4-macos11.pkg -o python-3.11.4-macos11.pkg && | ||
sudo installer -verbose -pkg python-3.11.4-macos11.pkg -target / && | ||
alias python3=python3.11 && | ||
cd scripts/macos-universal2 && | ||
bash ./build.sh && | ||
cd ../../client/dist && | ||
bash ../../scripts/tests/macos_test.sh && | ||
rm output.log && | ||
ln -s /Applications "Applications (admin)" && | ||
hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-universal2-installer.dmg && | ||
zip -yr mac-universal2-portable.zip NSO-RPC.app/ | ||
- name: Upload NSO-RPC Universal2 Build | ||
if: github.event_name != 'pull_request' | ||
uses: softprops/[email protected] | ||
with: | ||
files: | | ||
client/dist/mac-universal2-installer.dmg | ||
client/dist/mac-universal2-portable.zip | ||
get-hashes: | ||
runs-on: "ubuntu-latest" | ||
needs: ["build-x86_64", "build-universal2"] | ||
name: Generate Checksums | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- build-windows | ||
- build-linux | ||
- build-macos | ||
- build-universal2 | ||
if: github.event_name != 'pull_request' | ||
steps: | ||
- name: "Generate checksums.txt" | ||
- name: Generate checksums.txt | ||
uses: MCJack123/ghaction-generate-release-hashes@v4 | ||
with: | ||
hash-type: sha256 | ||
file-name: checksums.txt | ||
get-assets: true | ||
- uses: softprops/action-gh-release@v0.1.15 | ||
- uses: softprops/action-gh-release@v2.0.4 | ||
with: | ||
files: checksums.txt |
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 |
---|---|---|
@@ -1,15 +1,25 @@ | ||
import os | ||
import git | ||
|
||
|
||
def get_version_info(): | ||
r = git.repo.Repo(search_parent_directories=True) | ||
try: | ||
# Get all tags sorted by commit date | ||
tags = sorted(r.tags, key=lambda t: t.commit.committed_datetime, reverse=True) | ||
version_info = tags[0].name | ||
except IndexError: | ||
try: | ||
version_info = r.active_branch.name | ||
except TypeError: | ||
version_info = r.head.object.hexsha[:7] | ||
return version_info | ||
|
||
|
||
if __name__ == '__main__': | ||
# Deletes current version.txt file | ||
if os.path.exists('version.txt'): | ||
os.remove('version.txt') | ||
|
||
# Writes latest git version info to 'version.txt' | ||
r = git.repo.Repo(search_parent_directories=True) | ||
version_info = r.git.describe('--tags') | ||
version_info = get_version_info() | ||
with open('version.txt', 'w') as f: | ||
f.write(version_info) | ||
f.write('\n') | ||
f.close() |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
RED='\033[0;31m' | ||
GREEN='\033[0;32m' | ||
YELLOW='\033[0;33m' | ||
NC='\033[0m' | ||
|
||
# Start the application in the background | ||
./NSO-RPC.app/Contents/MacOS/NSO-RPC > output.log 2>&1 & | ||
APP_PID=$! | ||
|
||
sleep 10 | ||
kill $APP_PID | ||
|
||
output=$(<output.log) | ||
|
||
if echo "$output" | grep -q "Launch error"; then | ||
echo -e "${RED}Test Failed!${NC}" | ||
echo -e "${RED}Launch error was triggered${NC}" | ||
echo -e "${YELLOW}Application output:" | ||
echo -e "${YELLOW}$(cat output.log)${NC}" | ||
exit 1 | ||
else | ||
echo -e "${GREEN}Test Passed!${NC}" | ||
exit 0 | ||
fi |