Merge pull request #654 from mecha-org/shoaibmerchant-patch-1 #207
This file contains hidden or 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
| name: Apps - Build aarch64 | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| - dev-arm64-build | |
| - pre-release | |
| paths: | |
| - ".github/workflows/build-apps-aarch64.yml" | |
| - "apps/**" | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_RETRY: 10 | |
| RUST_BACKTRACE: short | |
| RUSTUP_MAX_RETRIES: 10 | |
| CARGO_NET_GIT_FETCH_WITH_CLI: true | |
| MECHA_PULP_USERNAME: ${{ secrets.MECHA_PULP_USERNAME }} | |
| MECHA_PULP_PASSWORD: ${{ secrets.MECHA_PULP_PASSWORD }} | |
| MECHA_PULP_API_URL: ${{ vars.MECHA_PULP_API_URL }} | |
| MECHA_PULP_DEBS_REPOSITORY_NAME: ${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }} | |
| MECHA_PULP_RPMS_REPOSITORY_NAME: ${{ vars.MECHA_PULP_RPMS_REPOSITORY_NAME }} | |
| jobs: | |
| # Detect which apps have changed | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| settings: ${{ steps.filter.outputs.settings }} | |
| notes: ${{ steps.filter.outputs.notes }} | |
| files: ${{ steps.filter.outputs.files }} | |
| music: ${{ steps.filter.outputs.music }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check for changes | |
| uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| settings: | |
| - 'apps/settings/**' | |
| notes: | |
| - 'apps/notes/**' | |
| files: | |
| - 'apps/files/**' | |
| music: | |
| - 'apps/music/**' | |
| camera: | |
| - 'apps/camera/**' | |
| build: | |
| name: ${{ matrix.name }} | |
| needs: detect-changes | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: mechanix-settings | |
| app: settings | |
| folder: settings | |
| binary: mechanix_settings | |
| - name: mechanix-notes | |
| app: notes | |
| folder: notes | |
| binary: mechanix_notes | |
| - name: mechanix-files | |
| app: files | |
| folder: files | |
| binary: mechanix_files | |
| - name: mechanix-music | |
| app: music | |
| folder: music | |
| binary: mechanix_music | |
| - name: mechanix-camera | |
| app: camera | |
| folder: camera | |
| binary: mechanix_camera | |
| runs-on: ubuntu-24.04-arm | |
| environment: pre-release | |
| continue-on-error: true | |
| steps: | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y git tar unzip curl clang cmake pkg-config \ | |
| libwayland-dev libwayland-cursor0 libwayland-egl1 \ | |
| libwayland-egl-backend-dev libegl1-mesa-dev libgles2-mesa-dev libxkbcommon-dev \ | |
| libgstreamer1.0-dev \ | |
| libgstreamer-plugins-base1.0-dev | |
| - name: Install PDFium (ARM64) | |
| run: | | |
| set -eux | |
| URL="https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-linux-arm64.tgz" | |
| curl -L "$URL" -o pdfium.tgz | |
| mkdir pdfium | |
| tar -xzf pdfium.tgz -C pdfium --strip-components=1 | |
| echo "=== Extracted ===" | |
| ls -la pdfium | |
| # install library | |
| sudo cp pdfium/libpdfium.so /usr/local/lib/ | |
| # install headers | |
| sudo mkdir -p /usr/local/include/pdfium | |
| sudo cp pdfium/*.h /usr/local/include/pdfium/ | |
| sudo cp -r pdfium/cpp /usr/local/include/pdfium/ | |
| sudo ldconfig | |
| # verify | |
| ldconfig -p | grep pdfium || true | |
| ls -l /usr/local/lib/libpdfium.so | |
| # Install NuShell | |
| - name: Install Nushell | |
| run: | | |
| curl -fsSL https://apt.fury.io/nushell/gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/fury-nushell.gpg | |
| echo "deb https://apt.fury.io/nushell/ /" | sudo tee /etc/apt/sources.list.d/fury.list | |
| sudo apt update | |
| sudo apt install nushell | |
| # Add Comet repository | |
| - name: Add Comet repository | |
| run: | | |
| curl -fsSL https://pub-a2f44c787cec4290833312e57fd59522.r2.dev/comet.asc | \ | |
| sudo gpg --dearmor -o /usr/share/keyrings/comet-deb.gpg | |
| echo "deb [signed-by=/usr/share/keyrings/comet-deb.gpg] http://pkg.mecha.so/debian pulp upload" | \ | |
| sudo tee /etc/apt/sources.list.d/comet.list | |
| sudo apt update | |
| # Add RPM Packaging Tools | |
| - name: Install RPM Packaging Tools | |
| run: | | |
| sudo apt install -y rpm build-essential \ | |
| rpm2cpio \ | |
| rpmlint \ | |
| dnf | |
| # Checkout repository | |
| - name: Setup | Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch full history for git operations | |
| # Install Flutter eLinux | |
| - name: Install Flutter eLinux | |
| run: | | |
| if [ ! -d "/opt/flutter-elinux" ]; then | |
| git clone https://github.com/sony/flutter-elinux.git | |
| sudo mv flutter-elinux /opt/ | |
| fi | |
| echo "PATH=$PATH:/opt/flutter-elinux/bin" >> $GITHUB_ENV | |
| # Build the app (ALWAYS) | |
| - name: Build ${{ matrix.name }} | |
| working-directory: apps/${{ matrix.folder }} | |
| run: | | |
| flutter-elinux pub get | |
| flutter-elinux build elinux --release | |
| # Update NuShell script permissions | |
| - name: Update NuShell script permissions | |
| run: | | |
| chmod +x apps/*.nu | |
| chmod +x utils/*.nu | |
| # Move entire bundle to ./build/<binary> | |
| - name: Prepare build folder ${{ matrix.name }} | |
| run: | | |
| mkdir -p ./build/${{ matrix.binary }} | |
| cp -r "apps/${{ matrix.folder }}/build/elinux/arm64/release/bundle/"* "./build/${{ matrix.binary }}/" | |
| # Package Debian using Nushell script (ALWAYS) | |
| - name: Package Debian ${{ matrix.name }} | |
| working-directory: apps | |
| run: | | |
| nu package-deb.nu "${{ matrix.folder }}" "../build/deb" | |
| # Package RPM using Nushell script | |
| - name: Package RPM ${{ matrix.name }} | |
| working-directory: apps | |
| run: | | |
| nu package-rpm.nu "${{ matrix.folder }}" "../build/rpm" | |
| # List artifacts | |
| - name: List artifacts ${{ matrix.name }} | |
| run: ls -la ./build/deb/ | |
| # Setup Pulp CLI | |
| - name: Setup | Pulp CLI | |
| run: | | |
| pipx install --force pulp-cli[pygments] | |
| # Added pulp-cli-rpm here | |
| pipx inject pulp-cli pulp-cli-deb pulp_rpm | |
| - name: Configure Pulp CLI | |
| run: | | |
| set -euo pipefail | |
| PULP_API_URL="${MECHA_PULP_API_URL}:8080" | |
| pulp config create \ | |
| --username "$MECHA_PULP_USERNAME" \ | |
| --password "$MECHA_PULP_PASSWORD" \ | |
| --base-url "$PULP_API_URL" \ | |
| --overwrite | |
| - name: Check Publish Condition | |
| id: check_publish | |
| run: | | |
| SHOULD_PUBLISH="false" | |
| if [[ "${{ matrix.app }}" == "settings" && "${{ needs.detect-changes.outputs.settings }}" == "true" ]]; then SHOULD_PUBLISH="true"; fi | |
| if [[ "${{ matrix.app }}" == "notes" && "${{ needs.detect-changes.outputs.notes }}" == "true" ]]; then SHOULD_PUBLISH="true"; fi | |
| if [[ "${{ matrix.app }}" == "files" && "${{ needs.detect-changes.outputs.files }}" == "true" ]]; then SHOULD_PUBLISH="true"; fi | |
| if [[ "${{ matrix.app }}" == "music" && "${{ needs.detect-changes.outputs.music }}" == "true" ]]; then SHOULD_PUBLISH="true"; fi | |
| echo "should_publish=$SHOULD_PUBLISH" >> $GITHUB_OUTPUT | |
| - name: Publish DEB | |
| if: steps.check_publish.outputs.should_publish == 'true' | |
| run: | | |
| DEB_FILE=$(find ./build/deb -name "mechanix-${{ matrix.app }}*.deb" -type f | head -n1) | |
| echo "[INFO] 📦 Publishing DEB: $DEB_FILE" | |
| pulp deb content upload --repository="${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }}" --file="$DEB_FILE" | |
| PUB_HREF=$(pulp deb publication create \ | |
| --repository="${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }}" \ | |
| --signing-service=mecha-pkg-sign | jq -r '.pulp_href') | |
| pulp deb distribution update \ | |
| --name="${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }}" \ | |
| --base-path="${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }}" \ | |
| --repository="${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }}" | |
| - name: Publish RPM | |
| if: steps.check_publish.outputs.should_publish == 'true' | |
| run: | | |
| RPM_FILE=$(find ./build/rpm -name "mechanix-${{ matrix.app }}*.rpm" -type f | head -n1) | |
| echo "[INFO] 📦 Publishing RPM: $RPM_FILE" | |
| pulp rpm content upload --repository="${{ vars.MECHA_PULP_RPMS_REPOSITORY_NAME }}" --file="$RPM_FILE" | |
| PUB_HREF=$(pulp rpm publication create \ | |
| --repository="${{ vars.MECHA_PULP_RPMS_REPOSITORY_NAME }}" | jq -r '.pulp_href') | |
| pulp rpm distribution update \ | |
| --name="${{ vars.MECHA_PULP_RPMS_REPOSITORY_NAME }}" \ | |
| --base-path="${{ vars.MECHA_PULP_RPMS_REPOSITORY_NAME }}" \ | |
| --publication="$PUB_HREF" | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.binary }} | |
| path: | | |
| ./build/${{ matrix.binary }}/ | |
| ./build/deb/*.deb | |
| ./build/rpm/*.rpm |