feat(cli): handle only 1 file via the cli and handle other arguments … #474
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 | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: ${{ github.ref_name != 'main' }} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| contents: write | |
| jobs: | |
| typos: | |
| name: Spellcheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Spell check | |
| uses: crate-ci/typos@master | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| toolchain: nightly-2025-09-05 | |
| components: rustfmt, clippy, llvm-tools-preview, rustc-dev | |
| - name: Cache on ${{ github.ref_name }} | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: warm | |
| - name: Check formatting | |
| run: cargo fmt --check | |
| - name: Clippy | |
| run: | | |
| cargo +nightly-2025-09-05 clippy --all-targets -- -D warnings | |
| cargo +nightly-2025-09-05 clippy --all-targets --all-features -- -D warnings | |
| test: | |
| name: Build & Test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: | |
| [ | |
| "macos-14", | |
| "macos-latest", | |
| "ubuntu-24.04", | |
| "ubuntu-latest", | |
| "windows-latest", | |
| ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oxc-project/setup-rust@cd82e1efec7fef815e2c23d296756f31c7cdc03d # v1.0.0 | |
| with: | |
| cache-key: warm | |
| save-cache: ${{ github.ref_name == 'main' }} | |
| - name: Check | |
| run: cargo check --all-targets | |
| - name: Build | |
| run: cargo build --tests --bins --examples | |
| - name: Test | |
| run: cargo test | |
| env: | |
| RUST_BACKTRACE: 1 | |
| build: | |
| name: Build ${{ matrix.asset-name }} | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: true | |
| if: github.ref == 'refs/heads/main' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux (x86_64) | |
| - os: ubuntu-24.04 | |
| rust-target: x86_64-unknown-linux-gnu | |
| asset-name: andromeda-linux-amd64 | |
| installer-name: andromeda-installer-linux-amd64 | |
| # Linux (ARM64) - cross-compilation | |
| - os: ubuntu-24.04 | |
| rust-target: aarch64-unknown-linux-gnu | |
| asset-name: andromeda-linux-arm64 | |
| installer-name: andromeda-installer-linux-arm64 | |
| cross-compile: true | |
| # macOS (Intel) | |
| - os: macos-15-intel | |
| rust-target: x86_64-apple-darwin | |
| asset-name: andromeda-macos-amd64 | |
| installer-name: andromeda-installer-macos-amd64 | |
| # macOS (Apple Silicon/ARM) | |
| - os: macos-latest | |
| rust-target: aarch64-apple-darwin | |
| asset-name: andromeda-macos-arm64 | |
| installer-name: andromeda-installer-macos-arm64 | |
| # Windows (x86_64) | |
| - os: windows-latest | |
| rust-target: x86_64-pc-windows-msvc | |
| asset-name: andromeda-windows-amd64.exe | |
| installer-name: andromeda-installer-windows-amd64.exe | |
| # Windows (ARM64) | |
| - os: windows-latest | |
| rust-target: aarch64-pc-windows-msvc | |
| asset-name: andromeda-windows-arm64.exe | |
| installer-name: andromeda-installer-windows-arm64.exe | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install the rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: "nightly-2025-09-05" | |
| targets: ${{ matrix.rust-target }} | |
| - name: Install cross-compilation dependencies | |
| if: matrix.cross-compile | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross pkg-config | |
| - name: Build | |
| id: build-main | |
| continue-on-error: true | |
| run: | | |
| cargo build --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml | |
| cargo build --bin andromeda-installer --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
| CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc | |
| PKG_CONFIG_ALLOW_CROSS: 1 | |
| MACOSX_DEPLOYMENT_TARGET: ${{ runner.os == 'macOS' && '14.0' || '' }} | |
| RUSTFLAGS: ${{ runner.os == 'macOS' && '-C link-arg=-mmacosx-version-min=14.0' || '' }} | |
| - name: Build satellites | |
| id: build-satellites | |
| continue-on-error: true | |
| run: | | |
| cargo build --bin andromeda-run --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml | |
| cargo build --bin andromeda-compile --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml | |
| cargo build --bin andromeda-fmt --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml | |
| cargo build --bin andromeda-lint --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml | |
| cargo build --bin andromeda-check --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml | |
| cargo build --bin andromeda-bundle --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
| CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc | |
| PKG_CONFIG_ALLOW_CROSS: 1 | |
| MACOSX_DEPLOYMENT_TARGET: ${{ runner.os == 'macOS' && '14.0' || '' }} | |
| RUSTFLAGS: ${{ runner.os == 'macOS' && '-C link-arg=-mmacosx-version-min=14.0' || '' }} | |
| - name: Prepare binary | |
| if: steps.build-main.outcome == 'success' | |
| shell: bash | |
| run: | | |
| cd target/${{ matrix.rust-target }}/release/ | |
| # Prepare main binary | |
| if [ -f "andromeda.exe" ]; then | |
| mv andromeda.exe ${{ matrix.asset-name }} | |
| elif [ -f "andromeda" ]; then | |
| mv andromeda ${{ matrix.asset-name }} | |
| fi | |
| # Prepare installer binary | |
| if [ -f "andromeda-installer.exe" ]; then | |
| mv andromeda-installer.exe ${{ matrix.installer-name }} | |
| elif [ -f "andromeda-installer" ]; then | |
| mv andromeda-installer ${{ matrix.installer-name }} | |
| fi | |
| # Prepare satellite binaries (only if they exist) | |
| for satellite in run compile fmt lint check bundle; do | |
| if [ -f "andromeda-${satellite}.exe" ]; then | |
| # Windows binaries | |
| cp "andromeda-${satellite}.exe" "andromeda-${satellite}-${{ matrix.rust-target }}.exe" | |
| elif [ -f "andromeda-${satellite}" ]; then | |
| # Unix binaries | |
| cp "andromeda-${satellite}" "andromeda-${satellite}-${{ matrix.rust-target }}" | |
| fi | |
| done | |
| - name: Upload Binary as Artifact | |
| uses: actions/upload-artifact@v4 | |
| if: steps.build-main.outcome == 'success' | |
| with: | |
| name: ${{ matrix.asset-name }} | |
| path: target/${{ matrix.rust-target }}/release/${{ matrix.asset-name }} | |
| - name: Upload Installer as Artifact | |
| uses: actions/upload-artifact@v4 | |
| if: steps.build-main.outcome == 'success' && hashFiles(format('target/{0}/release/{1}', matrix.rust-target, matrix.installer-name)) != '' | |
| with: | |
| name: ${{ matrix.installer-name }} | |
| path: target/${{ matrix.rust-target }}/release/${{ matrix.installer-name }} | |
| - name: Upload Satellite Binaries as Artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: steps.build-satellites.outcome == 'success' | |
| with: | |
| name: satellites-${{ matrix.rust-target }} | |
| path: | | |
| target/${{ matrix.rust-target }}/release/andromeda-run-${{ matrix.rust-target }}* | |
| target/${{ matrix.rust-target }}/release/andromeda-compile-${{ matrix.rust-target }}* | |
| target/${{ matrix.rust-target }}/release/andromeda-fmt-${{ matrix.rust-target }}* | |
| target/${{ matrix.rust-target }}/release/andromeda-lint-${{ matrix.rust-target }}* | |
| target/${{ matrix.rust-target }}/release/andromeda-check-${{ matrix.rust-target }}* | |
| target/${{ matrix.rust-target }}/release/andromeda-bundle-${{ matrix.rust-target }}* | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./artifacts | |
| - name: Create Draft Release | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: ./artifacts/*/andromeda-* | |
| file_glob: true | |
| draft: true | |
| tag: latest | |
| overwrite: true |