Skip to content

Rewrite CI ( Include CI for Cross-compilation) #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/openblas-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,14 @@ jobs:
env:
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install gfortran by apt
run: |
apt update
apt install -y gfortran
- name: Common minor tests
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path=openblas-build/Cargo.toml
run: cargo test --manifest-path=openblas-build/Cargo.toml
- name: Build test
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ matrix.test_target }} --manifest-path=openblas-build/Cargo.toml -- --ignored
run: cargo test ${{ matrix.test_target }} --manifest-path=openblas-build/Cargo.toml -- --ignored
72 changes: 40 additions & 32 deletions .github/workflows/openblas-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
- x64-windows-static
- x64-windows-static-md
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ./vcpkg
key: vcpkg-openblas
Expand All @@ -31,30 +31,20 @@ jobs:
- name: Install OpenBLAS by vcpkg
run: |
./vcpkg/vcpkg.exe install openblas:${{ matrix.triple }}

- uses: actions-rs/cargo@v1
name: Test features=system
with:
command: test
args: --features=system --manifest-path=openblas-src/Cargo.toml
- name: Test features=system
run: cargo test --features=system --manifest-path=openblas-src/Cargo.toml
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
if: ${{ matrix.triple == 'x64-windows' }}

- uses: actions-rs/cargo@v1
name: Test features=system,static
with:
command: test
args: --features=system,static --manifest-path=openblas-src/Cargo.toml
- name: Test features=system,static
run: cargo test --features=system,static --manifest-path=openblas-src/Cargo.toml
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
if: ${{ matrix.triple == 'x64-windows-static-md' }}

- uses: actions-rs/cargo@v1
name: Test features=system,static with crt-static
with:
command: test
args: --features=system,static --manifest-path=openblas-src/Cargo.toml
- name: Test features=system,static with crt-static
run: cargo test --features=system,static --manifest-path=openblas-src/Cargo.toml
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
RUSTFLAGS: "-C target-feature=+crt-static"
Expand All @@ -70,21 +60,17 @@ jobs:
- static
- system
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install OpenBLAS by homebrew
run: |
brew install openblas
if: ${{ contains(matrix.feature, 'system') }}
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--features=${{ matrix.feature }}
--manifest-path=openblas-src/Cargo.toml
- name: Test features=${{ matrix.feature }}
run: cargo test --features=${{ matrix.feature }} --manifest-path=openblas-src/Cargo.toml

linux:
x86_64-unknown-linux-gnu:
runs-on: ubuntu-22.04
container:
image: rust
Expand All @@ -96,7 +82,7 @@ jobs:
- static
- system
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install gfortran by apt
Expand All @@ -108,9 +94,31 @@ jobs:
apt update
apt install -y libopenblas-dev
if: ${{ contains(matrix.feature, 'system') }}
- uses: actions-rs/cargo@v1
- name: Test features=${{ matrix.feature }}
run: cargo test --features=${{ matrix.feature }} --manifest-path=openblas-src/Cargo.toml

cross:
name: ${{matrix.target}} (${{matrix.feature}})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
feature:
- ""
- static
- system
target:
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
steps:
- uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
target: ${{matrix.target}}
- name: Install Cross
uses: taiki-e/install-action@v2
with:
command: test
args: >
--features=${{ matrix.feature }}
--manifest-path=openblas-src/Cargo.toml
tool: cross
- name: Test features=${{ matrix.feature }}
run: cross test --target ${{matrix.target}} --features=${{ matrix.feature }} --manifest-path=openblas-src/Cargo.toml
16 changes: 7 additions & 9 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@ on:
branches:
- master
pull_request: {}
workflow_dispatch: {}

jobs:
check-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- uses: actions/checkout@v4
- name: Check format
run: cargo fmt -- --check

clippy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: actions-rs/cargo@v1
with:
command: clippy
- name: Check format
run: cargo clippy
28 changes: 28 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[target.aarch64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main"
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get --assume-yes install libopenblas-dev:$CROSS_DEB_ARCH libssl-dev"
]
[target.aarch64-unknown-linux-gnu.env]
passthrough = [
"OPENBLAS_CC=aarch64-linux-gnu-gcc",
"OPENBLAS_HOSTCC=gcc",
"OPENBLAS_FC=aarch64-linux-gnu-gfortran",
"OPENBLAS_TARGET=ARMV8"
]

[target.armv7-unknown-linux-gnueabihf]
image = "ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf:main"
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get --assume-yes install libopenblas-dev:$CROSS_DEB_ARCH libssl-dev"
]
[target.armv7-unknown-linux-gnueabihf.env]
passthrough = [
"OPENBLAS_CC=arm-linux-gnueabihf-gcc",
"OPENBLAS_HOSTCC=gcc",
"OPENBLAS_FC=arm-linux-gnueabihf-gfortran",
"OPENBLAS_TARGET=ARMV7"
]