From aee5d9a3fb2c51ecf1a8c13e5a4b30035e6b7864 Mon Sep 17 00:00:00 2001 From: kkent030315 Date: Sun, 24 Nov 2024 22:37:00 +0900 Subject: [PATCH] build: expand targets for x64/x86 compatibility --- .github/workflows/main.yml | 92 +++++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 32 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 44fd7cde8..980872173 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,8 +2,8 @@ name: CI on: push: pull_request: - branches: - - master + branches: + - master jobs: test: @@ -12,52 +12,80 @@ jobs: strategy: matrix: build: [MSRV, stable, nightly, macos, win32, win64] + target: + - x86_64-unknown-linux-gnu # Linux x64 + - i686-unknown-linux-gnu # Linux x86 + - x86_64-apple-darwin # macOS x64 + - i686-pc-windows-msvc # Windows x86 + - x86_64-pc-windows-msvc # Windows x64 include: + # Linux configurations - build: MSRV # Minimum supported Rust version + rust: 1.63.0 + target: x86_64-unknown-linux-gnu os: ubuntu-latest + - build: MSRV # Minimum supported Rust version rust: 1.63.0 + target: i686-unknown-linux-gnu + os: ubuntu-latest - build: stable + rust: stable + target: x86_64-unknown-linux-gnu os: ubuntu-latest + - build: stable rust: stable + target: i686-unknown-linux-gnu + os: ubuntu-latest - build: nightly + rust: nightly + target: x86_64-unknown-linux-gnu os: ubuntu-latest + - build: nightly rust: nightly + target: i686-unknown-linux-gnu + os: ubuntu-latest + # macOS configuration - build: macos - os: macos-latest rust: stable + target: x86_64-apple-darwin + os: macos-latest + # Windows configurations - build: win32 + rust: stable + target: i686-pc-windows-msvc os: windows-latest - rust: stable-i686-msvc - build: win64 + rust: stable + target: x86_64-pc-windows-msvc os: windows-latest - rust: stable-x86_64-msvc env: CARGO_TARGET_DIR: ${{ github.workspace }}/target steps: - - uses: actions/checkout@master - - name: Cache CARGO_HOME - uses: actions/cache@v1 - with: - path: ~/.cargo - key: ${{ runner.os }}-cargo-home-${{ hashFiles('**/Cargo.toml') }} - restore-keys: ${{ runner.os }}-cargo-home - - name: Install Rust - shell: bash - run: | - curl -sSL https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain=none - export PATH="$HOME/.cargo/bin:$PATH" - rustup override set ${{ matrix.rust }} - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - - name: rustfmt - shell: bash - if: runner.os == 'Linux' && matrix.rust == 'stable' - run: | - rustup component add rustfmt - cargo fmt -- --check - - run: cargo build - - run: cargo build --all-targets - # FIXME: Looks like fuzzer cannot be run on Windows - - if: runner.os == 'Linux' - run: cargo build --manifest-path=fuzz/Cargo.toml - - run: cargo test - - run: make api + - uses: actions/checkout@master + - name: Cache CARGO_HOME + uses: actions/cache@v1 + with: + path: ~/.cargo + key: ${{ runner.os }}-cargo-home-${{ hashFiles('**/Cargo.toml') }} + restore-keys: ${{ runner.os }}-cargo-home + - name: Install Rust + shell: bash + run: | + curl -sSL https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain=none + export PATH="$HOME/.cargo/bin:$PATH" + rustup override set ${{ matrix.rust }} + rustup target add ${{ matrix.target }} + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + - name: rustfmt + shell: bash + if: runner.os == 'Linux' && matrix.rust == 'stable' + run: | + rustup component add rustfmt + cargo fmt -- --check + - run: cargo build --target ${{ matrix.target }} + - run: cargo build --all-targets --target ${{ matrix.target }} + # FIXME: Looks like fuzzer cannot be run on Windows + - if: runner.os == 'Linux' + run: cargo build --manifest-path=fuzz/Cargo.toml --target ${{ matrix.target }} + - run: cargo test --target ${{ matrix.target }} + - run: make api