Skip to content

Commit faabaff

Browse files
authored
Merge pull request #123 from Dirreke/add-ci
Rewrite CI ( Include CI for Cross-compilation)
2 parents e1fd795 + 28575a1 commit faabaff

File tree

4 files changed

+78
-50
lines changed

4 files changed

+78
-50
lines changed

.github/workflows/openblas-build.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,14 @@ jobs:
2222
env:
2323
RUST_BACKTRACE: 1
2424
steps:
25-
- uses: actions/checkout@v1
25+
- uses: actions/checkout@v4
2626
with:
2727
submodules: "recursive"
2828
- name: Install gfortran by apt
2929
run: |
3030
apt update
3131
apt install -y gfortran
3232
- name: Common minor tests
33-
uses: actions-rs/cargo@v1
34-
with:
35-
command: test
36-
args: --manifest-path=openblas-build/Cargo.toml
33+
run: cargo test --manifest-path=openblas-build/Cargo.toml
3734
- name: Build test
38-
uses: actions-rs/cargo@v1
39-
with:
40-
command: test
41-
args: ${{ matrix.test_target }} --manifest-path=openblas-build/Cargo.toml -- --ignored
35+
run: cargo test ${{ matrix.test_target }} --manifest-path=openblas-build/Cargo.toml -- --ignored

.github/workflows/openblas-src.yml

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
- x64-windows-static
1919
- x64-windows-static-md
2020
steps:
21-
- uses: actions/checkout@v1
22-
- uses: actions/cache@v2
21+
- uses: actions/checkout@v4
22+
- uses: actions/cache@v4
2323
with:
2424
path: ./vcpkg
2525
key: vcpkg-openblas
@@ -31,30 +31,20 @@ jobs:
3131
- name: Install OpenBLAS by vcpkg
3232
run: |
3333
./vcpkg/vcpkg.exe install openblas:${{ matrix.triple }}
34-
35-
- uses: actions-rs/cargo@v1
36-
name: Test features=system
37-
with:
38-
command: test
39-
args: --features=system --manifest-path=openblas-src/Cargo.toml
34+
- name: Test features=system
35+
run: cargo test --features=system --manifest-path=openblas-src/Cargo.toml
4036
env:
4137
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
4238
if: ${{ matrix.triple == 'x64-windows' }}
4339

44-
- uses: actions-rs/cargo@v1
45-
name: Test features=system,static
46-
with:
47-
command: test
48-
args: --features=system,static --manifest-path=openblas-src/Cargo.toml
40+
- name: Test features=system,static
41+
run: cargo test --features=system,static --manifest-path=openblas-src/Cargo.toml
4942
env:
5043
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
5144
if: ${{ matrix.triple == 'x64-windows-static-md' }}
5245

53-
- uses: actions-rs/cargo@v1
54-
name: Test features=system,static with crt-static
55-
with:
56-
command: test
57-
args: --features=system,static --manifest-path=openblas-src/Cargo.toml
46+
- name: Test features=system,static with crt-static
47+
run: cargo test --features=system,static --manifest-path=openblas-src/Cargo.toml
5848
env:
5949
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
6050
RUSTFLAGS: "-C target-feature=+crt-static"
@@ -70,21 +60,17 @@ jobs:
7060
- static
7161
- system
7262
steps:
73-
- uses: actions/checkout@v1
63+
- uses: actions/checkout@v4
7464
with:
7565
submodules: "recursive"
7666
- name: Install OpenBLAS by homebrew
7767
run: |
7868
brew install openblas
7969
if: ${{ contains(matrix.feature, 'system') }}
80-
- uses: actions-rs/cargo@v1
81-
with:
82-
command: test
83-
args: >
84-
--features=${{ matrix.feature }}
85-
--manifest-path=openblas-src/Cargo.toml
70+
- name: Test features=${{ matrix.feature }}
71+
run: cargo test --features=${{ matrix.feature }} --manifest-path=openblas-src/Cargo.toml
8672

87-
linux:
73+
x86_64-unknown-linux-gnu:
8874
runs-on: ubuntu-22.04
8975
container:
9076
image: rust
@@ -96,7 +82,7 @@ jobs:
9682
- static
9783
- system
9884
steps:
99-
- uses: actions/checkout@v1
85+
- uses: actions/checkout@v4
10086
with:
10187
submodules: "recursive"
10288
- name: Install gfortran by apt
@@ -108,9 +94,31 @@ jobs:
10894
apt update
10995
apt install -y libopenblas-dev
11096
if: ${{ contains(matrix.feature, 'system') }}
111-
- uses: actions-rs/cargo@v1
97+
- name: Test features=${{ matrix.feature }}
98+
run: cargo test --features=${{ matrix.feature }} --manifest-path=openblas-src/Cargo.toml
99+
100+
cross:
101+
name: ${{matrix.target}} (${{matrix.feature}})
102+
runs-on: ubuntu-latest
103+
strategy:
104+
fail-fast: false
105+
matrix:
106+
feature:
107+
- ""
108+
- static
109+
- system
110+
target:
111+
- aarch64-unknown-linux-gnu
112+
- armv7-unknown-linux-gnueabihf
113+
steps:
114+
- uses: actions/checkout@v4
115+
- name: Install toolchain
116+
uses: dtolnay/rust-toolchain@stable
117+
with:
118+
target: ${{matrix.target}}
119+
- name: Install Cross
120+
uses: taiki-e/install-action@v2
112121
with:
113-
command: test
114-
args: >
115-
--features=${{ matrix.feature }}
116-
--manifest-path=openblas-src/Cargo.toml
122+
tool: cross
123+
- name: Test features=${{ matrix.feature }}
124+
run: cross test --target ${{matrix.target}} --features=${{ matrix.feature }} --manifest-path=openblas-src/Cargo.toml

.github/workflows/rust.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,21 @@ on:
55
branches:
66
- master
77
pull_request: {}
8+
workflow_dispatch: {}
89

910
jobs:
1011
check-format:
1112
runs-on: ubuntu-22.04
1213
steps:
13-
- uses: actions/checkout@v1
14-
- uses: actions-rs/cargo@v1
15-
with:
16-
command: fmt
17-
args: -- --check
14+
- uses: actions/checkout@v4
15+
- name: Check format
16+
run: cargo fmt -- --check
1817

1918
clippy:
2019
runs-on: ubuntu-22.04
2120
steps:
22-
- uses: actions/checkout@v1
21+
- uses: actions/checkout@v4
2322
with:
2423
submodules: "true"
25-
- uses: actions-rs/cargo@v1
26-
with:
27-
command: clippy
24+
- name: Check format
25+
run: cargo clippy

Cross.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[target.aarch64-unknown-linux-gnu]
2+
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main"
3+
pre-build = [
4+
"dpkg --add-architecture $CROSS_DEB_ARCH",
5+
"apt-get update && apt-get --assume-yes install libopenblas-dev:$CROSS_DEB_ARCH libssl-dev"
6+
]
7+
[target.aarch64-unknown-linux-gnu.env]
8+
passthrough = [
9+
"OPENBLAS_CC=aarch64-linux-gnu-gcc",
10+
"OPENBLAS_HOSTCC=gcc",
11+
"OPENBLAS_FC=aarch64-linux-gnu-gfortran",
12+
"OPENBLAS_TARGET=ARMV8"
13+
]
14+
15+
[target.armv7-unknown-linux-gnueabihf]
16+
image = "ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf:main"
17+
pre-build = [
18+
"dpkg --add-architecture $CROSS_DEB_ARCH",
19+
"apt-get update && apt-get --assume-yes install libopenblas-dev:$CROSS_DEB_ARCH libssl-dev"
20+
]
21+
[target.armv7-unknown-linux-gnueabihf.env]
22+
passthrough = [
23+
"OPENBLAS_CC=arm-linux-gnueabihf-gcc",
24+
"OPENBLAS_HOSTCC=gcc",
25+
"OPENBLAS_FC=arm-linux-gnueabihf-gfortran",
26+
"OPENBLAS_TARGET=ARMV7"
27+
]
28+

0 commit comments

Comments
 (0)