-
-
Notifications
You must be signed in to change notification settings - Fork 601
Improve PR CI workflow readability, caching, and structure #1008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 9 commits
220dda8
789feba
3e5b5b9
d339134
de8865a
c890102
c7b2101
3a116f0
f618327
7f0c8d6
d4f8a8d
3ab8a84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,50 +10,32 @@ on: | |
| type: string | ||
|
|
||
| jobs: | ||
| build-server-windows: | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.12 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| cd backend | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip uninstall -y onnxruntime | ||
| pip install onnxruntime-directml | ||
|
|
||
| - name: Build executable with PyInstaller | ||
| run: | | ||
| cd backend | ||
| pyinstaller main.py --name PictoPy_Server --onedir --distpath dist | ||
|
|
||
| - name: Copy app folder | ||
| run: | | ||
| cd backend | ||
| mkdir dist/PictoPy_Server/images | ||
| robocopy app dist\PictoPy_Server\app /e | ||
| if ($LASTEXITCODE -le 1) { exit 0 } | ||
|
|
||
| - name: Create ZIP package | ||
| run: | | ||
| cd backend/dist/PictoPy_Server | ||
| tar -a -c -f PictoPy-Windows.zip . | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: PictoPy-Windows | ||
| path: backend/dist/PictoPy_Server/PictoPy-Windows.zip | ||
|
|
||
| build-server-ubuntu: | ||
| runs-on: ubuntu-22.04 | ||
| build-server: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - platform: windows-latest | ||
| artifact-name: PictoPy-Windows | ||
| onnx-package: onnxruntime-directml | ||
| mkdir-cmd: mkdir dist/PictoPy_Server/images | ||
| copy-cmd: | | ||
| robocopy app dist\PictoPy_Server\app /e | ||
| if ($LASTEXITCODE -le 1) { exit 0 } | ||
| zip-cmd: tar -a -c -f PictoPy-Windows.zip . | ||
| - platform: ubuntu-22.04 | ||
| artifact-name: PictoPy-Ubuntu | ||
| onnx-package: onnxruntime-gpu | ||
| mkdir-cmd: mkdir -p dist/PictoPy_Server/images && mkdir -p dist/PictoPy_Server/app | ||
| copy-cmd: cp -r app/* dist/PictoPy_Server/app/ | ||
| zip-cmd: zip -r PictoPy-Ubuntu.zip . | ||
| - platform: macos-latest | ||
| artifact-name: PictoPy-MacOS | ||
| onnx-package: "" | ||
| mkdir-cmd: mkdir -p dist/PictoPy_Server/images && mkdir -p dist/PictoPy_Server/app | ||
| copy-cmd: cp -r app/* dist/PictoPy_Server/app/ | ||
| zip-cmd: zip -r PictoPy-MacOS.zip . | ||
| runs-on: ${{ matrix.platform }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
@@ -62,120 +44,65 @@ jobs: | |
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.12 | ||
| cache: 'pip' | ||
| cache-dependency-path: backend/requirements.txt | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: backend | ||
| shell: bash | ||
| run: | | ||
| cd backend | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip uninstall -y onnxruntime | ||
| pip install onnxruntime-gpu | ||
| if [ -n "${{ matrix.onnx-package }}" ]; then | ||
| pip uninstall -y onnxruntime | ||
| pip install ${{ matrix.onnx-package }} | ||
| fi | ||
|
|
||
| - name: Build executable with PyInstaller | ||
| working-directory: backend | ||
| run: | | ||
| cd backend | ||
| pyinstaller main.py --name PictoPy_Server --onedir --distpath dist | ||
|
|
||
| - name: Copy app folder | ||
| working-directory: backend | ||
| shell: ${{ matrix.platform == 'windows-latest' && 'pwsh' || 'bash' }} | ||
| run: | | ||
| cd backend | ||
| mkdir -p dist/PictoPy_Server/images | ||
| mkdir -p dist/PictoPy_Server/app | ||
| cp -r app/* dist/PictoPy_Server/app/ | ||
|
|
||
| - name: Create ZIP package | ||
| run: | | ||
| cd backend/dist/PictoPy_Server | ||
| zip -r PictoPy-Ubuntu.zip . | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: PictoPy-Ubuntu | ||
| path: backend/dist/PictoPy_Server/PictoPy-Ubuntu.zip | ||
|
|
||
| build-server-macos: | ||
| runs-on: macos-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.12 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| cd backend | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
|
|
||
| - name: Build executable with PyInstaller | ||
| run: | | ||
| cd backend | ||
| pyinstaller main.py --name PictoPy_Server --onedir --distpath dist | ||
| ${{ matrix.mkdir-cmd }} | ||
| ${{ matrix.copy-cmd }} | ||
|
|
||
| - name: Copy app folder | ||
| run: | | ||
| cd backend | ||
| mkdir -p dist/PictoPy_Server/images | ||
| mkdir -p dist/PictoPy_Server/app | ||
| cp -r app/* dist/PictoPy_Server/app/ | ||
|
|
||
| - name: Create ZIP package | ||
| run: | | ||
| cd backend/dist/PictoPy_Server | ||
| zip -r PictoPy-MacOS.zip . | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: PictoPy-MacOS | ||
| path: backend/dist/PictoPy_Server/PictoPy-MacOS.zip | ||
|
|
||
| build-sync-microservice-windows: | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.12 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| cd sync-microservice | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip install pyinstaller | ||
|
|
||
| - name: Build executable with PyInstaller | ||
| run: | | ||
| cd sync-microservice | ||
| pyinstaller main.py --name PictoPy_Sync --onedir --distpath dist | ||
|
|
||
| - name: Copy app folder | ||
| run: | | ||
| cd sync-microservice | ||
| robocopy app dist\PictoPy_Sync\app /e | ||
| if ($LASTEXITCODE -le 1) { exit 0 } | ||
|
|
||
| - name: Create ZIP package | ||
| working-directory: backend/dist/PictoPy_Server | ||
| shell: bash | ||
| run: | | ||
| cd sync-microservice/dist/PictoPy_Sync | ||
| tar -a -c -f PictoPy-Sync-Windows.zip . | ||
| ${{ matrix.zip-cmd }} | ||
|
Comment on lines
74
to
+78
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's examine the workflow file to see the exact code
cat -n .github/workflows/build-and-release.yml | sed -n '13,150p'Repository: AOSSIE-Org/PictoPy Length of output: 5698 🏁 Script executed: # Also check the specific lines 74-78 mentioned
cat -n .github/workflows/build-and-release.yml | sed -n '70,85p'Repository: AOSSIE-Org/PictoPy Length of output: 604 🏁 Script executed: # Check the sync microservice zip step at lines 136-140
cat -n .github/workflows/build-and-release.yml | sed -n '132,145p'Repository: AOSSIE-Org/PictoPy Length of output: 502 🏁 Script executed: # Verify the matrix definition including zip-cmd
cat -n .github/workflows/build-and-release.yml | sed -n '13,38p'Repository: AOSSIE-Org/PictoPy Length of output: 1359 🏁 Script executed: # Check GNU tar documentation for -a flag behavior
# Let's search for information about tar -a with zip files in the codebase context
rg -i "tar.*-a.*zip|zip.*tar.*-a" || echo "No mixed tar/zip commands found in other files"Repository: AOSSIE-Org/PictoPy Length of output: 108 🌐 Web query:
💡 Result:
So: if you’re using GNU tar, Sources: 🌐 Web query:
💡 Result: On GitHub Actions Windows runners, you can easily end up with different Which bash is used when you set
|
||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: PictoPy-Sync-Windows | ||
| path: sync-microservice/dist/PictoPy_Sync/PictoPy-Sync-Windows.zip | ||
| name: ${{ matrix.artifact-name }} | ||
| path: backend/dist/PictoPy_Server/${{ matrix.artifact-name }}.zip | ||
|
|
||
| build-sync-microservice-ubuntu: | ||
| runs-on: ubuntu-22.04 | ||
| build-sync-microservice: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - platform: windows-latest | ||
| artifact-name: PictoPy-Sync-Windows | ||
| copy-cmd: | | ||
| robocopy app dist\PictoPy_Sync\app /e | ||
| if ($LASTEXITCODE -le 1) { exit 0 } | ||
| zip-cmd: tar -a -c -f PictoPy-Sync-Windows.zip . | ||
| - platform: ubuntu-22.04 | ||
| artifact-name: PictoPy-Sync-Ubuntu | ||
| copy-cmd: mkdir -p dist/PictoPy_Sync/app && cp -r app/* dist/PictoPy_Sync/app/ | ||
| zip-cmd: zip -r PictoPy-Sync-Ubuntu.zip . | ||
| - platform: macos-latest | ||
| artifact-name: PictoPy-Sync-MacOS | ||
| copy-cmd: mkdir -p dist/PictoPy_Sync/app && cp -r app/* dist/PictoPy_Sync/app/ | ||
| zip-cmd: zip -r PictoPy-Sync-MacOS.zip . | ||
| runs-on: ${{ matrix.platform }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
@@ -184,88 +111,44 @@ jobs: | |
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.12 | ||
| cache: 'pip' | ||
| cache-dependency-path: sync-microservice/requirements.txt | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: sync-microservice | ||
| run: | | ||
| cd sync-microservice | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip install pyinstaller | ||
|
|
||
| - name: Build executable with PyInstaller | ||
| working-directory: sync-microservice | ||
| run: | | ||
| cd sync-microservice | ||
| pyinstaller main.py --name PictoPy_Sync --onedir --distpath dist | ||
|
|
||
| - name: Copy app folder | ||
| working-directory: sync-microservice | ||
| shell: ${{ matrix.platform == 'windows-latest' && 'pwsh' || 'bash' }} | ||
| run: | | ||
| cd sync-microservice | ||
| mkdir -p dist/PictoPy_Sync/app | ||
| cp -r app/* dist/PictoPy_Sync/app/ | ||
| ${{ matrix.copy-cmd }} | ||
|
|
||
| - name: Create ZIP package | ||
| run: | | ||
| cd sync-microservice/dist/PictoPy_Sync | ||
| zip -r PictoPy-Sync-Ubuntu.zip . | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: PictoPy-Sync-Ubuntu | ||
| path: sync-microservice/dist/PictoPy_Sync/PictoPy-Sync-Ubuntu.zip | ||
|
|
||
| build-sync-microservice-macos: | ||
| runs-on: macos-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.12 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| cd sync-microservice | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip install pyinstaller | ||
|
|
||
| - name: Build executable with PyInstaller | ||
| run: | | ||
| cd sync-microservice | ||
| pyinstaller main.py --name PictoPy_Sync --onedir --distpath dist | ||
|
|
||
| - name: Copy app folder | ||
| run: | | ||
| cd sync-microservice | ||
| mkdir -p dist/PictoPy_Sync/app | ||
| cp -r app/* dist/PictoPy_Sync/app/ | ||
|
|
||
| - name: Create ZIP package | ||
| working-directory: sync-microservice/dist/PictoPy_Sync | ||
| shell: bash | ||
| run: | | ||
| cd sync-microservice/dist/PictoPy_Sync | ||
| zip -r PictoPy-Sync-MacOS.zip . | ||
| ${{ matrix.zip-cmd }} | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: PictoPy-Sync-MacOS | ||
| path: sync-microservice/dist/PictoPy_Sync/PictoPy-Sync-MacOS.zip | ||
| name: ${{ matrix.artifact-name }} | ||
| path: sync-microservice/dist/PictoPy_Sync/${{ matrix.artifact-name }}.zip | ||
|
|
||
| publish-tauri: | ||
| permissions: | ||
| contents: write | ||
| needs: | ||
| [ | ||
| build-server-windows, | ||
| build-server-ubuntu, | ||
| build-server-macos, | ||
| build-sync-microservice-windows, | ||
| build-sync-microservice-ubuntu, | ||
| build-sync-microservice-macos, | ||
| ] | ||
| needs: [build-server, build-sync-microservice] | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
|
|
@@ -306,38 +189,45 @@ jobs: | |
|
|
||
| - name: Extract server files | ||
| shell: bash | ||
| working-directory: backend/dist | ||
| run: | | ||
| cd backend/dist | ||
| unzip -o *.zip | ||
| rm *.zip | ||
| ls -l | ||
|
|
||
| - name: Extract sync microservice files | ||
| shell: bash | ||
| working-directory: sync-microservice/dist | ||
| run: | | ||
| cd sync-microservice/dist | ||
| unzip -o *.zip | ||
| rm *.zip | ||
| ls -l | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: lts/* | ||
| cache: 'npm' | ||
| cache-dependency-path: frontend/package-lock.json | ||
|
|
||
| - name: Install Rust stable | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin' || '' }} | ||
|
|
||
| - name: Rust cache | ||
| uses: swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: frontend/src-tauri | ||
|
|
||
| - name: Install dependencies (ubuntu only) | ||
| if: matrix.platform == 'ubuntu-22.04' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | ||
|
|
||
| - name: Install frontend dependencies | ||
| working-directory: frontend | ||
| run: | | ||
| cd frontend | ||
| npm install | ||
|
|
||
| - uses: tauri-apps/tauri-action@v0 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.