diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index a35c213ee3..586637f896 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -14,13 +14,14 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Use latest Rust + run: rustup override set stable + - uses: Swatinem/rust-cache@v2 with: key: sqlx-cli - - env: - RUSTFLAGS: -D warnings - run: > + - run: > cargo build -p sqlx-cli --bin sqlx diff --git a/.github/workflows/sqlx-cli.yml b/.github/workflows/sqlx-cli.yml new file mode 100644 index 0000000000..4c20c5a1b0 --- /dev/null +++ b/.github/workflows/sqlx-cli.yml @@ -0,0 +1,100 @@ +name: SQLx CLI + +on: + pull_request: + push: + branches: + - main + - "*-dev" + +jobs: + check: + name: CLI Checks + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - run: | + rustup update + rustup component add clippy + rustup toolchain install beta + rustup component add --toolchain beta clippy + + - uses: Swatinem/rust-cache@v2 + + - run: cargo clippy --manifest_path sqlx-cli/Cargo.toml -- -D warnings + + # Run beta for new warnings but don't break the build. + # Use a subdirectory of `target` to avoid clobbering the cache. + - run: > + cargo +beta clippy + --manifest_path sqlx-cli/Cargo.toml + --target-dir target/beta/ + + cli-test: + name: CLI Unit Test + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + # Note: macOS-latest uses M1 Silicon (ARM64) + os: + - ubuntu-latest, + - windows-latest + - macOS-13 + - macOS-latest + + steps: + - uses: actions/checkout@v4 + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-test + + - run: cargo test --manifest-path sqlx-cli/Cargo.toml + + build: + name: CLI Binaries + runs-on: ${{ matrix.os }} + + strategy: + matrix: + # Note: macOS-latest uses M1 Silicon (ARM64) + os: + - ubuntu-latest, + - windows-latest + - macOS-13 + - macOS-latest + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + args: --features openssl-vendored + bin: target/debug/cargo-sqlx + - os: windows-latest + target: x86_64-pc-windows-msvc + bin: target/debug/cargo-sqlx.exe + - os: macOS-13 + target: x86_64-apple-darwin + bin: target/debug/cargo-sqlx + - os: macOS-latest + target: aarch64-apple-darwin + bin: target/debug/cargo-sqlx + + steps: + - uses: actions/checkout@v4 + + - name: Use latest Rust + run: rustup override set stable + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-cli + + - run: cargo build --manifest-path sqlx-cli/Cargo.toml --bin cargo-sqlx ${{ matrix.args }} + + - uses: actions/upload-artifact@v4 + with: + name: cargo-sqlx-${{ matrix.target }} + path: ${{ matrix.bin }} diff --git a/.github/workflows/sqlx.yml b/.github/workflows/sqlx.yml index 295153e66a..e2967ec9ef 100644 --- a/.github/workflows/sqlx.yml +++ b/.github/workflows/sqlx.yml @@ -79,52 +79,6 @@ jobs: --manifest-path sqlx-core/Cargo.toml --features json,_rt-${{ matrix.runtime }},_tls-${{ matrix.tls }} - cli-test: - name: CLI Unit Test - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - - uses: Swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-test - - - run: cargo test --manifest-path sqlx-cli/Cargo.toml - - cli: - name: CLI Binaries - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest, windows-latest] #, macOS-latest] - include: - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - args: --features openssl-vendored - bin: target/debug/cargo-sqlx - - os: windows-latest - target: x86_64-pc-windows-msvc - bin: target/debug/cargo-sqlx.exe - # FIXME: macOS build fails because of missing pin-project-internal - # - os: macOS-latest - # target: x86_64-apple-darwin - # bin: target/debug/cargo-sqlx - - steps: - - uses: actions/checkout@v4 - - - uses: Swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-cli - - - run: cargo build --manifest-path sqlx-cli/Cargo.toml --bin cargo-sqlx ${{ matrix.args }} - - - uses: actions/upload-artifact@v2 - with: - name: cargo-sqlx-${{ matrix.target }} - path: ${{ matrix.bin }} - sqlite: name: SQLite runs-on: ubuntu-22.04