diff --git a/.gitea/workflows/ci-reusable.yml b/.gitea/workflows/ci-reusable.yml index 0ce2db7..f2c93bd 100644 --- a/.gitea/workflows/ci-reusable.yml +++ b/.gitea/workflows/ci-reusable.yml @@ -6,10 +6,6 @@ on: os: required: true type: string - target: - required: false - type: string - default: "" upload-artifacts: required: false type: boolean @@ -24,60 +20,33 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: components: clippy, rustfmt - targets: ${{ inputs.target }} - - - name: Install cross - if: inputs.target != '' - run: | - cargo install cross --git https://github.com/cross-rs/cross - name: Build - run: | - if [[ -n "${{ inputs.target }}" ]]; then - cross build --all-features --target ${{ inputs.target }} - else - cargo build --all-features - fi + run: cargo build --all-features - name: Test - run: | - if [[ -n "${{ inputs.target }}" ]]; then - cross test --all-features --target ${{ inputs.target }} - else - cargo test --all-features - fi + run: cargo test --all-features - name: Clippy - run: | - if [[ -n "${{ inputs.target }}" ]]; then - cross clippy --all-targets --all-features --target ${{ inputs.target }} -- -D warnings - else - cargo clippy --all-targets --all-features -- -D warnings - fi + run: cargo clippy --all-targets --all-features -- -D warnings - name: Fmt check run: | cargo fmt --all -- --check - name: Benchmark (Linux only) - if: runner.os == 'Linux' && inputs.target == '' - run: | - cargo bench --bench heart + if: runner.os == 'Linux' + run: cargo bench --bench heart - name: Security audit (Linux only) - if: runner.os == 'Linux' && inputs.target == '' + if: runner.os == 'Linux' run: | cargo install cargo-audit cargo audit - name: Build FFI library if: inputs.upload-artifacts - run: | - if [[ -n "${{ inputs.target }}" ]]; then - cross build --release --features ffi --target ${{ inputs.target }} - else - cargo build --release --features ffi - fi + run: cargo build --release --features ffi - name: Extract version and create package if: inputs.upload-artifacts @@ -86,18 +55,12 @@ jobs: VERSION=$(sed -n 's/^version\s*=\s*"\([^"]\+\)"/\1/p' Cargo.toml | head -n1) # Determine target directory and library extension - if [[ -n "${{ inputs.target }}" ]]; then - TARGET_DIR="target/${{ inputs.target }}/release" - PKG_BASENAME="medicallib_rust-v${VERSION}-${{ inputs.target }}" - else - TARGET_DIR="target/release" - case "${{ runner.os }}" in - Linux) PKG_BASENAME="medicallib_rust-v${VERSION}-x86_64-unknown-linux-gnu" ;; - macOS) PKG_BASENAME="medicallib_rust-v${VERSION}-x86_64-apple-darwin" ;; - Windows) PKG_BASENAME="medicallib_rust-v${VERSION}-x86_64-pc-windows-msvc" ;; - *) PKG_BASENAME="medicallib_rust-v${VERSION}-native" ;; - esac - fi + TARGET_DIR="target/release" + case "${{ runner.os }}" in + Linux) PKG_BASENAME="medicallib_rust-v${VERSION}-x86_64-unknown-linux-gnu" ;; + Windows) PKG_BASENAME="medicallib_rust-v${VERSION}-x86_64-pc-windows-msvc" ;; + *) PKG_BASENAME="medicallib_rust-v${VERSION}-native" ;; + esac PKG_DIR="dist/${PKG_BASENAME}" @@ -129,5 +92,5 @@ jobs: if: inputs.upload-artifacts uses: actions/upload-artifact@v4 with: - name: medicallib-rust-${{ inputs.target || runner.os }} + name: medicallib-rust-${{ runner.os }} path: dist/ diff --git a/.gitea/workflows/multi-platform.yml b/.gitea/workflows/multi-platform.yml index 70eb84d..b113e04 100644 --- a/.gitea/workflows/multi-platform.yml +++ b/.gitea/workflows/multi-platform.yml @@ -5,32 +5,17 @@ on: pull_request: jobs: - # Test on all platforms + # Test on platforms with native builds only test-platforms: strategy: fail-fast: false matrix: include: - # Linux x86_64 target (may cross-compile on ARM runners) + # Linux native - os: ubuntu-22.04 - target: x86_64-unknown-linux-gnu - # Windows native targets only + # Windows native - os: windows-latest - target: x86_64-pc-windows-msvc - - uses: ./.gitea/workflows/ci-reusable.yml - with: - os: ${{ matrix.os }} - target: ${{ matrix.target }} - upload-artifacts: false - - # Test native builds (no cross-compilation) - test-native: - strategy: - fail-fast: false - matrix: - os: [ubuntu-22.04, windows-latest] uses: ./.gitea/workflows/ci-reusable.yml with: @@ -40,17 +25,14 @@ jobs: # Package for distribution (only on master) package: if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') - needs: [test-platforms, test-native] + needs: [test-platforms] strategy: matrix: include: - os: ubuntu-22.04 - target: x86_64-unknown-linux-gnu - os: windows-latest - target: x86_64-pc-windows-msvc uses: ./.gitea/workflows/ci-reusable.yml with: os: ${{ matrix.os }} - target: ${{ matrix.target }} upload-artifacts: true