v0.0.114-2 #423
Workflow file for this run
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: CLI CI/CD | |
| on: | |
| push: | |
| branches: ['main'] | |
| paths: ['src/cli/**', '.github/workflows/**'] | |
| pull_request: | |
| branches: ['main'] | |
| paths: ['src/cli/**', '.github/workflows/**'] | |
| workflow_dispatch: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.target }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: linux-amd64 | |
| asset_name: chithi-cli-linux-amd64 | |
| - os: ubuntu-24.04-arm | |
| target: linux-arm64 | |
| asset_name: chithi-cli-linux-arm64 | |
| - os: windows-latest | |
| target: windows-amd64 | |
| asset_name: chithi-cli-windows-amd64.exe | |
| - os: windows-11-arm | |
| target: windows-arm64 | |
| asset_name: chithi-cli-windows-arm64.exe | |
| - os: macos-15-intel | |
| target: macos-amd64 | |
| asset_name: chithi-cli-macos-amd64 | |
| - os: macos-latest | |
| target: macos-arm64 | |
| asset_name: chithi-cli-macos-arm64 | |
| defaults: | |
| run: | |
| working-directory: ./src/cli | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install dependencies | |
| run: uv sync --frozen | |
| - name: Build Binary | |
| run: uv run python build.py --output ${{ matrix.asset_name }} | |
| - name: Package macOS app | |
| if: startsWith(matrix.target, 'macos') | |
| run: | | |
| # Define the binary and the app structure | |
| BINARY_NAME="${{ matrix.asset_name }}" | |
| APP_NAME="${BINARY_NAME}.app" | |
| # Create the macOS App Bundle structure | |
| mkdir -p "${APP_NAME}/Contents/MacOS" | |
| # Move the generated binary into the bundle | |
| mv "$BINARY_NAME" "${APP_NAME}/Contents/MacOS/" | |
| # Zip the bundle | |
| zip -r "${BINARY_NAME}.zip" "$APP_NAME" | |
| - name: Upload CI Artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: cli-${{ matrix.target }} | |
| path: | | |
| src/cli/${{ matrix.asset_name }} | |
| src/cli/${{ matrix.asset_name }}.zip | |
| if-no-files-found: error | |
| - name: Test CLI | |
| shell: bash | |
| run: | | |
| if [[ "${{ matrix.target }}" == macos* ]]; then | |
| ./${{ matrix.asset_name }}.app/Contents/MacOS/${{ matrix.asset_name }} --help || { echo 'CLI failed'; exit 1; } | |
| else | |
| chmod +x ./${{ matrix.asset_name }} || true | |
| ./${{ matrix.asset_name }} --help || { echo 'CLI failed'; exit 1; } | |
| fi | |
| - name: Upload to GitHub Release | |
| uses: softprops/action-gh-release@v3 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: | | |
| src/cli/${{ matrix.asset_name }} | |
| src/cli/${{ matrix.asset_name }}.zip |