Skip to content

Commit e26cc2a

Browse files
committed
Add CI for windows and macos support
1 parent 19f159e commit e26cc2a

File tree

1 file changed

+105
-9
lines changed

1 file changed

+105
-9
lines changed

.github/workflows/ci.yml

Lines changed: 105 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ env:
1414
jobs:
1515

1616
rustfmt_check:
17-
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
os: [macos-latest, windows-latest, ubuntu-latest]
20+
fail-fast: false
21+
runs-on: ${{ matrix.os }}
1822
steps:
1923
- uses: actions/checkout@v2
2024
- uses: actions-rs/toolchain@v1
@@ -28,8 +32,7 @@ jobs:
2832
command: fmt
2933
args: --all -- --check
3034

31-
# Interestingly clippy check needs to build the crate.
32-
rust_clippy_check:
35+
rust_clippy_check_ubuntu:
3336
runs-on: ubuntu-latest
3437
steps:
3538
- uses: actions/checkout@v2
@@ -48,7 +51,37 @@ jobs:
4851
4952
- run: cargo clippy -- -D warnings
5053

51-
build_and_test:
54+
rust_clippy_check_windows:
55+
runs-on: windows-latest
56+
steps:
57+
- uses: actions/checkout@v2
58+
- uses: actions-rs/toolchain@v1
59+
with:
60+
profile: minimal
61+
toolchain: stable
62+
override: true
63+
# Using this since it's used by clang-sys's CI
64+
- name: Install LLVM and Clang
65+
uses: KyleMayes/install-llvm-action@v1
66+
with:
67+
version: "10.0"
68+
directory: ${{ github.workspace }}/clang
69+
70+
- name: Clone vcpkg FFmpeg
71+
run: git clone https://github.com/microsoft/vcpkg --depth 1
72+
- name: Bootstrap vcpkg FFmpeg
73+
run: ./vcpkg/bootstrap-vcpkg.bat
74+
- name: Vcpkg install ffmpeg
75+
run: ./vcpkg/vcpkg.exe install ffmpeg:x64-windows-static-md
76+
77+
- name: Clippy check
78+
env:
79+
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
80+
LIBCLANG_PATH: ${{ github.workspace }}/clang/lib
81+
LLVM_CONFIG_PATH: ${{ github.workspace }}/clang/bin/llvm-config
82+
run: cargo clippy -- -D warnings
83+
84+
build_and_test_ubuntu:
5285
runs-on: ubuntu-latest
5386
steps:
5487
- uses: actions/checkout@v2
@@ -100,9 +133,7 @@ jobs:
100133

101134
- name: Run Slice Example
102135
run: cargo run --example slice
103-
# Avoid the situation that example outputs incorrect results.
104-
# (Is this really essential? Maybe I'm too anxious?)
105-
- name: Check No Change
136+
- name: Check test result correctness
106137
run: |
107138
if [[ -z "$(git status --porcelain)" ]]; then
108139
echo "0"
@@ -226,7 +257,7 @@ jobs:
226257
hash -r
227258
cd ..
228259
- name: Binding Build
229-
run: PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" cargo build --verbose
260+
run: FFMPEG_PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" cargo build --verbose
230261

231262
build_with_system_ffmpeg:
232263
runs-on: ubuntu-latest
@@ -247,6 +278,69 @@ jobs:
247278
- name: Binding Build
248279
run: cargo build --verbose
249280

281+
build_with_vcpkg_ffmpeg_windows:
282+
runs-on: windows-latest
283+
strategy:
284+
matrix:
285+
config:
286+
- target: "x86_64-pc-windows-msvc"
287+
vcpkg_triplet: "x64-windows-static"
288+
rustflags: "-Ctarget-feature=+crt-static"
289+
- target: "x86_64-pc-windows-msvc"
290+
vcpkg_triplet: "x64-windows-static-md"
291+
- target: "x86_64-pc-windows-msvc"
292+
vcpkg_triplet: "x64-windows"
293+
dynamic: true
294+
295+
- target: "i686-pc-windows-msvc"
296+
vcpkg_triplet: "x86-windows-static"
297+
rustflags: "-Ctarget-feature=+crt-static"
298+
- target: "i686-pc-windows-msvc"
299+
vcpkg_triplet: "x86-windows-static-md"
300+
- target: "i686-pc-windows-msvc"
301+
vcpkg_triplet: "x86-windows"
302+
dynamic: true
303+
fail-fast: false
304+
steps:
305+
- uses: actions/checkout@v2
306+
# Using this since it's used by clang-sys's CI
307+
- name: Install LLVM and Clang
308+
uses: KyleMayes/install-llvm-action@v1
309+
with:
310+
version: "10.0"
311+
directory: ${{ github.workspace }}/clang
312+
313+
- uses: actions-rs/toolchain@v1
314+
with:
315+
profile: minimal
316+
toolchain: stable
317+
override: true
318+
target: ${{ matrix.config.target }}
319+
320+
- name: Clone vcpkg FFmpeg
321+
run: git clone https://github.com/microsoft/vcpkg --depth 1
322+
- name: Bootstrap vcpkg FFmpeg
323+
run: ./vcpkg/bootstrap-vcpkg.bat
324+
- name: Vcpkg install ffmpeg
325+
run: ./vcpkg/vcpkg.exe install ffmpeg:${{ matrix.config.vcpkg_triplet }}
326+
327+
- name: Set env
328+
shell: bash
329+
run: |
330+
if [ '${{ matrix.config.dynamic }}' != '' ]; then
331+
echo "FFMPEG_DYNAMIC_LINKING=1" >> $GITHUB_ENV
332+
fi
333+
334+
- name: Binding build
335+
shell: bash
336+
env:
337+
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
338+
RUSTFLAGS: ${{ matrix.config.rustflags}}
339+
VCPKG_DEFAULT_TRIPLET: ${{ matrix.config.vcpkg_triplet }}
340+
LIBCLANG_PATH: ${{ github.workspace }}/clang/lib
341+
LLVM_CONFIG_PATH: ${{ github.workspace }}/clang/bin/llvm-config
342+
run: cargo build --target ${{ matrix.config.target }} --verbose
343+
250344
# Check if correct documentation can be generated by docs.rs
251345
docs_rs_check:
252346
runs-on: ubuntu-latest
@@ -291,7 +385,9 @@ jobs:
291385
sudo apt-get -y install libmp3lame-dev
292386
sudo apt-get -y install libopus-dev
293387
388+
- name: Set env
389+
run: echo "DOCS_RS=1" >> $GITHUB_ENV
294390
- name: Binding Build
295-
run: DOCS_RS=1 cargo build --verbose
391+
run: cargo build --verbose
296392
- name: Document Generation
297393
run: cargo doc --verbose

0 commit comments

Comments
 (0)