diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b51f19c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: Build + +on: + workflow_call: + +env: + CARGO_TERM_COLOR: always + +jobs: + linux: + name: Linux + runs-on: ubuntu-latest + container: rust:1.75-slim + steps: + - uses: actions/checkout@v4 + - run: apt-get update && apt-get install -y pkg-config libssl-dev + - run: cargo build --release + - uses: actions/upload-artifact@v4 + with: + name: gitclaw-linux + path: target/release/gitclaw + + macos: + name: macOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.75 + - run: cargo build --release + - uses: actions/upload-artifact@v4 + with: + name: gitclaw-macos + path: target/release/gitclaw + + windows: + name: Windows + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.75 + - run: cargo build --release + - uses: actions/upload-artifact@v4 + with: + name: gitclaw-windows + path: target/release/gitclaw.exe diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 651caf0..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: CI - -on: - push: - branches: [main, master] - pull_request: - branches: [main, master] - -env: - CARGO_TERM_COLOR: always - -jobs: - test: - name: Test on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - rust: [stable] - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-action@stable - with: - toolchain: ${{ matrix.rust }} - - - name: Cache cargo dependencies - uses: Swatinem/rust-cache@v2 - - - name: Check formatting - run: cargo fmt -- --check - - - name: Run clippy - run: cargo clippy -- -D warnings - - - name: Run tests - run: cargo test - - - name: Build release binary - run: cargo build --release - - coverage: - name: Code Coverage - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-action@stable - with: - toolchain: stable - - - name: Install cargo-tarpaulin - run: cargo install cargo-tarpaulin - - - name: Generate coverage report - run: cargo tarpaulin --out Xml - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - files: ./cobertura.xml - fail_ci_if_error: false diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..4195913 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,19 @@ +name: Main + +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +jobs: + Verify: + uses: ./.github/workflows/verify.yml + + Test: + needs: Verify + uses: ./.github/workflows/test.yml + + Build: + needs: Test + uses: ./.github/workflows/build.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b06992c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: Test + +on: + workflow_call: + +env: + CARGO_TERM_COLOR: always + +jobs: + linux: + name: Linux + runs-on: ubuntu-latest + container: rust:1.75-slim + steps: + - uses: actions/checkout@v4 + - run: apt-get update && apt-get install -y pkg-config libssl-dev + - run: cargo test + + macos: + name: macOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.75 + - run: cargo test + + windows: + name: Windows + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.75 + - run: cargo test diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml new file mode 100644 index 0000000..0333ab0 --- /dev/null +++ b/.github/workflows/verify.yml @@ -0,0 +1,27 @@ +name: Verify + +on: + workflow_call: + +env: + CARGO_TERM_COLOR: always + +jobs: + Format: + name: Format + runs-on: ubuntu-latest + container: rust:1.75-slim + steps: + - uses: actions/checkout@v4 + - run: rustup component add rustfmt + - run: cargo fmt --check + + Clippy: + name: Clippy + runs-on: ubuntu-latest + container: rust:1.75-slim + steps: + - uses: actions/checkout@v4 + - run: apt-get update && apt-get install -y pkg-config libssl-dev + - run: rustup component add clippy + - run: cargo clippy -- -D warnings diff --git a/tests/error_handling.rs b/tests/error_handling.rs index 4760ce6..7987bac 100644 --- a/tests/error_handling.rs +++ b/tests/error_handling.rs @@ -109,7 +109,7 @@ fn test_find_matching_asset_empty_assets() { /// Test asset matching with only checksum files #[test] fn test_find_matching_asset_only_checksums() { - use gitclaw::github::{Asset, find_matching_asset, Platform, Release}; + use gitclaw::github::{find_matching_asset, Asset, Platform, Release}; let release = Release { tag_name: "v1.0.0".to_string(),