fix: 12 CLI bugs — double execution, UUID IDs, ACK/FAIL, output forma… #426
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: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| env: | |
| BUN_VERSION: "latest" | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| # ============================================ | |
| # Code Quality | |
| # ============================================ | |
| lint: | |
| name: Lint & Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: ${{ env.BUN_VERSION }} | |
| - name: Install dependencies | |
| run: bun install --ignore-scripts | |
| - name: Run ESLint | |
| run: bun run lint | |
| - name: Check formatting | |
| run: bun run format:check | |
| typecheck: | |
| name: Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: ${{ env.BUN_VERSION }} | |
| - name: Install dependencies | |
| run: bun install --ignore-scripts | |
| - name: Run type check | |
| run: bun run typecheck | |
| # ============================================ | |
| # Tests | |
| # ============================================ | |
| test: | |
| name: Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: ${{ env.BUN_VERSION }} | |
| - name: Install dependencies | |
| run: bun install --ignore-scripts | |
| - name: Run tests | |
| run: bun test | |
| # ============================================ | |
| # Build Binaries (only on main) | |
| # ============================================ | |
| build: | |
| name: Build (${{ matrix.target }}) | |
| runs-on: ubuntu-latest | |
| needs: [lint, typecheck, test] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| strategy: | |
| matrix: | |
| include: | |
| - target: bun-linux-x64 | |
| artifact: bunqueue-linux-x64 | |
| - target: bun-linux-arm64 | |
| artifact: bunqueue-linux-arm64 | |
| - target: bun-darwin-x64 | |
| artifact: bunqueue-darwin-x64 | |
| - target: bun-darwin-arm64 | |
| artifact: bunqueue-darwin-arm64 | |
| - target: bun-windows-x64 | |
| artifact: bunqueue-windows-x64.exe | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: ${{ env.BUN_VERSION }} | |
| - name: Install dependencies | |
| run: bun install --ignore-scripts | |
| - name: Get version from package.json | |
| id: version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Build executable | |
| run: bun build --compile --minify --target=${{ matrix.target }} src/main.ts --outfile ${{ matrix.artifact }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: ${{ matrix.artifact }} | |
| retention-days: 7 | |
| # ============================================ | |
| # Docker Build & Push (only on main) | |
| # ============================================ | |
| docker: | |
| name: Docker | |
| runs-on: ubuntu-latest | |
| needs: [lint, typecheck, test] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate tags | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=latest | |
| type=sha,prefix= | |
| type=raw,value={{date 'YYYYMMDD-HHmm'}} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # ============================================ | |
| # Create Release (only on main) | |
| # ============================================ | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: [build, docker] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get version from package.json | |
| id: version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| pattern: bunqueue-* | |
| merge-multiple: true | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release | |
| ls -la artifacts/ | |
| # Copy all binaries to release folder | |
| cp artifacts/bunqueue-linux-x64 release/ 2>/dev/null || cp artifacts/*/bunqueue-linux-x64 release/ 2>/dev/null || true | |
| cp artifacts/bunqueue-linux-arm64 release/ 2>/dev/null || cp artifacts/*/bunqueue-linux-arm64 release/ 2>/dev/null || true | |
| cp artifacts/bunqueue-darwin-x64 release/ 2>/dev/null || cp artifacts/*/bunqueue-darwin-x64 release/ 2>/dev/null || true | |
| cp artifacts/bunqueue-darwin-arm64 release/ 2>/dev/null || cp artifacts/*/bunqueue-darwin-arm64 release/ 2>/dev/null || true | |
| cp artifacts/bunqueue-windows-x64.exe release/ 2>/dev/null || cp artifacts/*/bunqueue-windows-x64.exe release/ 2>/dev/null || true | |
| # Make executables | |
| chmod +x release/bunqueue-linux-x64 release/bunqueue-linux-arm64 release/bunqueue-darwin-x64 release/bunqueue-darwin-arm64 2>/dev/null || true | |
| ls -la release/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| name: Release v${{ steps.version.outputs.version }} | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| make_latest: true | |
| files: | | |
| release/bunqueue-linux-x64 | |
| release/bunqueue-linux-arm64 | |
| release/bunqueue-darwin-x64 | |
| release/bunqueue-darwin-arm64 | |
| release/bunqueue-windows-x64.exe | |
| body: | | |
| ## Installation | |
| ### Docker (recommended) | |
| ```bash | |
| docker pull ghcr.io/${{ github.repository }}:latest | |
| docker run -p 6789:6789 -p 6790:6790 ghcr.io/${{ github.repository }}:latest | |
| ``` | |
| ### Binary | |
| | Platform | Architecture | Download | | |
| |----------|-------------|----------| | |
| | Linux | x64 | `bunqueue-linux-x64` | | |
| | Linux | arm64 | `bunqueue-linux-arm64` | | |
| | macOS | x64 (Intel) | `bunqueue-darwin-x64` | | |
| | macOS | arm64 (Apple Silicon) | `bunqueue-darwin-arm64` | | |
| | Windows | x64 | `bunqueue-windows-x64.exe` | | |
| ```bash | |
| # Example: Linux x64 | |
| chmod +x bunqueue-linux-x64 | |
| ./bunqueue-linux-x64 | |
| ``` |