Skip to content

Commit 7ae5b94

Browse files
codebyrpproot
andauthored
Updated Github Workflows and Added Scripts (#30)
* added powershell build exe script * added build bash script * renamed workflow - sphinx.yml to docs.yml * updated tests workflow triggers --------- Co-authored-by: root <root@XPS-15>
1 parent a76472b commit 7ae5b94

File tree

4 files changed

+94
-16
lines changed

4 files changed

+94
-16
lines changed
File renamed without changes.
Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
name: Unit Tests
2-
on:
3-
push:
4-
paths:
5-
- 'src/**'
6-
jobs:
7-
build:
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v2
11-
- name: Set up Python3
12-
uses: actions/setup-python@v3
13-
- name: Run Tests
14-
run: |
15-
cd src
16-
python3 -m unittest discover -s tests -p 'test_*.py'
1+
name: Unit Tests
2+
on:
3+
push:
4+
branches:
5+
- dev
6+
paths:
7+
- "src/**"
8+
pull_request:
9+
branches:
10+
- dev
11+
paths:
12+
- "src/**"
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set up Python3
19+
uses: actions/setup-python@v3
20+
- name: Run Tests
21+
run: |
22+
cd src
23+
python3 -m unittest discover -s tests -p 'test_*.py'

build.ps1

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Exit immediately if a command exits with a non-zero status
2+
$ErrorActionPreference = "Stop"
3+
4+
# Navigate to the directory containing your script
5+
Set-Location -Path (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
6+
Set-Location -Path "src"
7+
8+
# Install PyInstaller if it's not already installed
9+
if (-not (Get-Command pyinstaller -ErrorAction SilentlyContinue)) {
10+
pip show pyinstaller -ErrorAction SilentlyContinue | Out-Null
11+
if ($LASTEXITCODE -ne 0) {
12+
pip install pyinstaller
13+
}
14+
}
15+
16+
# Build the executable
17+
pyinstaller --onefile --name myrpal myrpal.py
18+
19+
# Create the build directory if it doesn't exist
20+
$buildDir = "../build"
21+
if (-not (Test-Path -Path $buildDir)) {
22+
New-Item -Path $buildDir -ItemType Directory | Out-Null
23+
}
24+
25+
# Remove the existing executable from the build directory
26+
if (Test-Path -Path "$buildDir/myrpal.exe") {
27+
Remove-Item -Path "$buildDir/myrpal.exe"
28+
}
29+
30+
# Move the executable to the build directory
31+
Move-Item -Path "dist/myrpal.exe" -Destination $buildDir
32+
33+
# Clean up build files
34+
Remove-Item -Recurse -Force "build", "dist", "myrpal.spec", "__pycache__"
35+
36+
# Navigate back to the original directory
37+
Set-Location -Path ".."

build.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Exit immediately if a command exits with a non-zero status
4+
set -e
5+
6+
# Navigate to the directory containing your script
7+
cd "$(dirname "$0")"
8+
cd src
9+
10+
# Install PyInstaller if it's not already installed
11+
if ! command -v pyinstaller &> /dev/null; then
12+
pip show pyinstaller &> /dev/null || pip install pyinstaller
13+
fi
14+
15+
# Build the executable
16+
pyinstaller --onefile --name myrpal myrpal.py
17+
18+
# Create the build directory if it doesn't exist
19+
build_dir="../build"
20+
[ -d "$build_dir" ] || mkdir -p "$build_dir"
21+
22+
# Remove the existing executable from the build directory
23+
if [ -f "$build_dir/myrpal" ]; then
24+
rm "$build_dir/myrpal"
25+
fi
26+
27+
# Move the executable to the build directory
28+
mv dist/myrpal "$build_dir/"
29+
30+
# Clean up build files
31+
rm -rf build dist myrpal.spec __pycache__
32+
33+
# Navigate back to the original directory
34+
cd ..

0 commit comments

Comments
 (0)