Remove Travis CI configuration file #5
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| upload_url: ${{ steps.release.outputs.upload_url }} | |
| version: ${{ steps.get_version.outputs.version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Get version from tag | |
| id: get_version | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=dev-$(date +%Y%m%d-%H%M%S)" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Check if release exists | |
| id: check_release | |
| run: | | |
| if gh release view "${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "Release ${{ steps.get_version.outputs.version }} already exists" | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "Release ${{ steps.get_version.outputs.version }} does not exist" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Delete existing release if it exists | |
| if: steps.check_release.outputs.exists == 'true' | |
| run: | | |
| echo "Deleting existing release ${{ steps.get_version.outputs.version }}" | |
| gh release delete "${{ steps.get_version.outputs.version }}" --yes --cleanup-tag | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| id: release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.get_version.outputs.version }} | |
| name: Release ${{ steps.get_version.outputs.version }} | |
| body: | | |
| ## Changes in ${{ steps.get_version.outputs.version }} | |
| ### Features | |
| - Rust code compression and minification | |
| - Support for entire `src/` directories and individual `.rs` files | |
| - AST-based parsing with `syn` for safe code transformation | |
| - Command-line interface with `clap` | |
| ### Supported Platforms | |
| - Linux (x86_64, ARM64) | |
| - macOS (x86_64, ARM64/Apple Silicon) | |
| - Windows (x86_64) | |
| ### Installation | |
| Download the appropriate binary for your platform from the assets below. | |
| **Linux/macOS:** | |
| ```bash | |
| chmod +x cg-bundler-* | |
| sudo mv cg-bundler-* /usr/local/bin/cg-bundler | |
| ``` | |
| **Windows:** | |
| Add the downloaded `.exe` file to your PATH. | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| build: | |
| name: Build for ${{ matrix.target }} | |
| needs: create-release | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux targets | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| name: cg-bundler-linux-amd64 | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| name: cg-bundler-linux-arm64 | |
| # macOS targets | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| name: cg-bundler-macos-amd64 | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| name: cg-bundler-macos-arm64 | |
| # Windows targets | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| name: cg-bundler-windows-amd64.exe | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross-compilation tools (Linux ARM64) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Configure cross-compilation (Linux ARM64) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| mkdir -p .cargo | |
| cat >> .cargo/config.toml << EOF | |
| [target.aarch64-unknown-linux-gnu] | |
| linker = "aarch64-linux-gnu-gcc" | |
| EOF | |
| - name: Cache cargo registry | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-${{ matrix.target }}- | |
| ${{ runner.os }}-cargo- | |
| - name: Cache target directory | |
| uses: actions/cache@v3 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-target-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-target-${{ matrix.target }}- | |
| ${{ runner.os }}-target- | |
| - name: Build binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Strip binary (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then | |
| # Use cross-compilation strip for ARM64 | |
| if command -v aarch64-linux-gnu-strip >/dev/null 2>&1; then | |
| aarch64-linux-gnu-strip target/${{ matrix.target }}/release/cg-bundler | |
| echo "✅ Stripped ARM64 binary" | |
| else | |
| echo "⚠️ aarch64-linux-gnu-strip not found, skipping strip" | |
| fi | |
| else | |
| # Use regular strip for native targets | |
| if command -v strip >/dev/null 2>&1; then | |
| strip target/${{ matrix.target }}/release/cg-bundler | |
| echo "✅ Stripped binary" | |
| else | |
| echo "⚠️ strip not found, skipping" | |
| fi | |
| fi | |
| - name: Prepare binary for upload (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| cp target/${{ matrix.target }}/release/cg-bundler ${{ matrix.name }} | |
| - name: Prepare binary for upload (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| copy target\${{ matrix.target }}\release\cg-bundler.exe ${{ matrix.name }} | |
| - name: Upload Release Asset | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ needs.create-release.outputs.version }} | |
| files: ./${{ matrix.name }} | |
| verify-binaries: | |
| name: Verify Built Binaries | |
| needs: [create-release, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download and verify release assets | |
| run: | | |
| echo "Downloading release assets for ${{ needs.create-release.outputs.version }}" | |
| # Download all assets from the release | |
| gh release download "${{ needs.create-release.outputs.version }}" --dir ./downloads | |
| echo "Downloaded files:" | |
| ls -la ./downloads/ | |
| # Verify each binary | |
| for file in ./downloads/*; do | |
| if [[ -f "$file" ]]; then | |
| filename=$(basename "$file") | |
| size=$(stat -c%s "$file") | |
| echo "📦 $filename: $size bytes" | |
| # Check if file is too small (might indicate build issue) | |
| if (( size < 1000000 )); then | |
| echo "⚠️ Warning: $filename seems small ($size bytes)" | |
| else | |
| echo "✅ $filename looks good" | |
| fi | |
| # Make executable and test (only for Linux binaries on Linux runner) | |
| if [[ "$filename" == *"linux-amd64"* ]]; then | |
| echo "Testing $filename..." | |
| chmod +x "$file" | |
| if "$file" --version 2>/dev/null; then | |
| echo "✅ $filename version check passed" | |
| else | |
| echo "⚠️ $filename version check failed (might be expected in CI)" | |
| fi | |
| fi | |
| fi | |
| done | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-crate: | |
| name: Publish to crates.io | |
| needs: [create-release, build, verify-binaries] | |
| runs-on: ubuntu-latest | |
| # Only publish on actual tag pushes, not workflow_dispatch | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-publish-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-publish- | |
| ${{ runner.os }}-cargo- | |
| - name: Verify package can be built | |
| run: cargo build --release | |
| - name: Run tests | |
| run: cargo test --release | |
| - name: Dry run cargo publish | |
| run: cargo publish --dry-run | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| - name: Publish to crates.io | |
| run: cargo publish | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| - name: Verify publication | |
| run: | | |
| echo "✅ Successfully published to crates.io!" | |
| echo "Package should be available at: https://crates.io/crates/$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')" |