Skip to content

Commit

Permalink
feat: ✨ Standardize github action build flow between platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobiClark committed Aug 8, 2023
1 parent e22eb8e commit 61ddec6
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 9 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/Build-and-deploy-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ jobs:

- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: env-electron-python
environment-file: tools/anaconda-env/environment-Linux.yml
auto-update-conda: true
auto-activate-base: false
- run: |
conda info
Expand All @@ -37,9 +39,36 @@ jobs:
- name: Install package.json modules and their dependencies
run: npm install --ignore-scripts

- name: Build and deploy on Linux
- name: Build the python server executable
run: |
npm run python-onefile-build-unix
- name: Test the python server executable
run: |
# Run the executable in the background
./pyflaskdist/app.exe 4242 > server_output.txt 2>&1 &
# Wait for the server to start
sleep 30
# Display the server output
cat server_output.txt
# Check the server output for the "Running on" line
if grep -q "Running on http://127.0.0.1:4242/" server_output.txt; then
echo "Server started successfully."
else
echo "Error: Server failed to start."
# You can perform additional error handling or cleanup here if needed
# For example, you may want to exit the workflow with an error code
exit 1
fi
# Clean up the temporary output file
rm server_output.txt
- name: Deploy the application
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run python-onefile-build
npm run deploy-linux
35 changes: 31 additions & 4 deletions .github/workflows/Build-and-deploy-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ jobs:

- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: env-electron-python
environment-file: tools/anaconda-env/environment-MAC.yml
auto-update-conda: true
auto-activate-base: false
- run: |
conda info
Expand All @@ -42,11 +44,36 @@ jobs:
p12-file-base64: ${{ secrets.MACOS_CERTIFICATE }}
p12-password: ${{ secrets.MACOS_CERTIFICATE_PWD }}

- name: Build and deploy on MAC
- name: Build the python server executable
run: |
npm run python-onefile-build-unix
- name: Test the python server executable
run: |
# Run the executable in the background
./pyflaskdist/app.exe 4242 > server_output.txt 2>&1 &
# Wait for the server to start
sleep 30
# Display the server output
cat server_output.txt
# Check the server output for the "Running on" line
if grep -q "Running on http://127.0.0.1:4242/" server_output.txt; then
echo "Server started successfully."
else
echo "Error: Server failed to start."
# You can perform additional error handling or cleanup here if needed
# For example, you may want to exit the workflow with an error code
exit 1
fi
# Clean up the temporary output file
rm server_output.txt
- name: Deploy the application
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
appleId: ${{ secrets.APPLE_ID }}
appleIdPassword: ${{ secrets.APPLE_PASSWORD }}
run: |
npm run python-onefile-build
npm run deploy-mac
4 changes: 2 additions & 2 deletions .github/workflows/Build-and-deploy-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: 3.9
Expand All @@ -28,7 +29,6 @@ jobs:
auto-update-conda: true
auto-activate-base: false
- run: |
conda activate env-electron-python
conda info
conda list
Expand All @@ -41,7 +41,7 @@ jobs:

- name: Build the python server executable
run: |
npm run python-onefile-build
npm run python-onefile-build-win
- name: Test the python server executable
run: |
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"deploy-win": "electron-builder build --win --publish always",
"deploy-mac": "electron-builder build --mac --publish always",
"deploy-linux": "electron-builder build --linux --publish always",
"python-onefile-build": "python -m PyInstaller --onefile --add-data libcrypto-1_1-x64.dll;. --add-data libssl-1_1-x64.dll;. --clean ./pyflask/app.py --distpath ./pyflaskdist",
"python-onefile-build-unix": "python -m PyInstaller --onefile --clean ./pyflask/app.py --distpath ./pyflaskdist",
"python-onefile-build-win": "python -m PyInstaller --onefile --add-data libcrypto-1_1-x64.dll;. --add-data libssl-1_1-x64.dll;. --clean ./pyflask/app.py --distpath ./pyflaskdist",
"postinstall": "electron-builder install-app-deps",
"format": "prettier --ignore-path .gitignore --ignore-path .prettierignore \"./**/*.+(html|css|js|md|yml)\" --write",
"commit": "cz",
Expand Down

0 comments on commit 61ddec6

Please sign in to comment.