1
1
name : Build and Lint
2
2
on :
3
+ schedule :
4
+ # runs every monday at midnight
5
+ - cron : " 0 0 * * 1"
3
6
push :
4
7
branches :
5
8
- master
12
15
strategy :
13
16
matrix :
14
17
os : [ubuntu-latest, macos-latest, windows-latest]
15
- php : [' 8.0', ' 8.1' ]
18
+ php : [" 8.0", " 8.1" ]
16
19
rust : [stable, nightly]
20
+ clang : ["14"]
17
21
phpts : [ts, nts]
18
22
exclude :
19
23
# ext-php-rs requires nightly Rust when on Windows.
24
28
phpts : ts
25
29
- os : ubuntu-latest
26
30
phpts : ts
31
+ env :
32
+ CARGO_TERM_COLOR : always
27
33
steps :
28
34
- name : Checkout code
29
35
uses : actions/checkout@v3
@@ -34,59 +40,67 @@ jobs:
34
40
env :
35
41
phpts : ${{ matrix.phpts }}
36
42
- name : Setup Rust
37
- uses : actions-rs/ toolchain@v1
43
+ uses : dtolnay/rust- toolchain@master
38
44
with :
39
45
toolchain : ${{ matrix.rust }}
40
- override : true
41
46
components : rustfmt, clippy
42
- - name : Setup LLVM & Clang
47
+ - run : rustup show
48
+ - name : Cache cargo dependencies
49
+ uses : Swatinem/rust-cache@v2
50
+ # Uncomment the following if statement if caching nightly deps
51
+ # ends up causing too much cache invalidation.
52
+ # if: matrix.rust == 'stable'
53
+ with :
54
+ # increment this manually to force cache eviction
55
+ prefix-key : " v0-rust"
56
+ # LLVM & Clang
57
+ - name : Cache LLVM and Clang
58
+ id : cache-llvm
59
+ uses : actions/cache@v3
43
60
if : " !contains(matrix.os, 'windows')"
61
+ with :
62
+ path : ${{ runner.temp }}/llvm-${{ matrix.clang }}
63
+ key : ${{ matrix.os }}-llvm-${{ matrix.clang }}
64
+ - name : Setup LLVM & Clang
44
65
id : clang
45
66
uses : KyleMayes/install-llvm-action@v1
67
+ if : " !contains(matrix.os, 'windows')"
46
68
with :
47
- version : ' 13.0'
48
- directory : ${{ runner.temp }}/llvm
69
+ version : ${{ matrix.clang }}
70
+ directory : ${{ runner.temp }}/llvm-${{ matrix.clang }}
71
+ cached : ${{ steps.cache-llvm.outputs.cache-hit }}
49
72
- name : Configure Clang
50
73
if : " !contains(matrix.os, 'windows')"
51
74
run : |
52
- echo "LIBCLANG_PATH=${{ runner.temp }}/llvm/lib" >> $GITHUB_ENV
75
+ echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }} /lib" >> $GITHUB_ENV
53
76
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
77
+ echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/bin/llvm-config" >> $GITHUB_ENV
54
78
- name : Configure Clang (macOS only)
55
79
if : " contains(matrix.os, 'macos')"
56
80
run : echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
81
+ # Build
57
82
- name : Build
58
83
env :
59
- EXT_PHP_RS_TEST :
84
+ EXT_PHP_RS_TEST : " "
60
85
run : cargo build --release --all-features --all
86
+ # Test & lint
61
87
- name : Test inline examples
62
- uses : actions-rs/cargo@v1
63
- with :
64
- command : test
65
- args : --release --all --all-features
88
+ run : cargo test --release --all --all-features
66
89
- name : Run rustfmt
67
- uses : actions-rs/cargo@v1
68
- with :
69
- command : fmt
70
- args : --all -- --check
71
90
if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
91
+ run : cargo fmt --all -- --check
72
92
- name : Run clippy
73
- uses : actions-rs/cargo@v1
74
- with :
75
- command : clippy
76
- args : --all -- -D warnings
77
93
if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
94
+ run : cargo clippy --all -- -D warnings
95
+ # Docs
78
96
- name : Run rustdoc
79
- uses : actions-rs/cargo@v1
80
- with :
81
- command : rustdoc
82
- args : -- -D warnings
83
97
if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
98
+ run : cargo rustdoc -- -D warnings
84
99
- name : Build with docs stub
85
- env :
86
- DOCS_RS :
87
- run :
88
- cargo clean && cargo build
89
100
if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
101
+ env :
102
+ DOCS_RS : " "
103
+ run : cargo clean && cargo build
90
104
build-zts :
91
105
name : Build with ZTS
92
106
runs-on : ubuntu-latest
0 commit comments