Skip to content

Commit 990383c

Browse files
committed
Migrate CI to GitHub Actions
1 parent 7bfc271 commit 990383c

10 files changed

+140
-191
lines changed

.github/workflows/main.yml

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: CI
2+
on: [push, pull_request]
3+
4+
jobs:
5+
test:
6+
name: Test
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
build: [stable, beta, nightly, linux32, macos, aarch64-ios, win32, win64, mingw32, mingw64, windows-2016]
11+
include:
12+
- build: stable
13+
os: ubuntu-latest
14+
rust: stable
15+
target: x86_64-unknown-linux-gnu
16+
- build: beta
17+
os: ubuntu-latest
18+
rust: beta
19+
target: x86_64-unknown-linux-gnu
20+
- build: nightly
21+
os: ubuntu-latest
22+
rust: nightly
23+
target: x86_64-unknown-linux-gnu
24+
- build: linux32
25+
os: ubuntu-latest
26+
rust: stable
27+
target: i686-unknown-linux-gnu
28+
- build: macos
29+
os: macos-latest
30+
rust: stable
31+
target: x86_64-apple-darwin
32+
- build: aarch64-ios
33+
os: macos-latest
34+
rust: stable
35+
target: aarch64-apple-ios
36+
no_run: --no-run
37+
- build: win32
38+
os: windows-2016
39+
rust: stable-i686-msvc
40+
target: i686-pc-windows-msvc
41+
- build: win64
42+
os: windows-latest
43+
rust: stable
44+
target: x86_64-pc-windows-msvc
45+
- build: mingw32
46+
os: windows-latest
47+
rust: stable-i686-gnu
48+
target: i686-pc-windows-gnu
49+
- build: mingw64
50+
os: windows-latest
51+
rust: stable-x86_64-gnu
52+
target: x86_64-pc-windows-gnu
53+
- build: windows-2016
54+
os: windows-2016
55+
rust: stable-x86_64
56+
target: x86_64-pc-windows-msvc
57+
steps:
58+
- uses: actions/checkout@master
59+
- name: Install Rust (rustup)
60+
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
61+
if: matrix.os != 'macos-latest'
62+
- name: Install Rust (macos)
63+
run: |
64+
curl https://sh.rustup.rs | sh -s -- -y
65+
echo "##[add-path]$HOME/.cargo/bin"
66+
if: matrix.os == 'macos-latest'
67+
- run: rustup target add ${{ matrix.target }}
68+
- name: Install g++-multilib
69+
run: |
70+
set -e
71+
# Remove the ubuntu-toolchain-r/test PPA, which is added by default.
72+
# Some packages were removed, and this is causing the g++multilib
73+
# install to fail. Similar issue:
74+
# https://github.com/scikit-learn/scikit-learn/issues/13928.
75+
sudo add-apt-repository --remove ppa:ubuntu-toolchain-r/test
76+
sudo apt-get install g++-multilib
77+
if: matrix.build == 'linux32'
78+
- run: cargo build
79+
- run: cargo test ${{ matrix.no_run }}
80+
- run: cargo test ${{ matrix.no_run }} --features parallel
81+
- run: cargo test ${{ matrix.no_run }} --manifest-path cc-test/Cargo.toml --target ${{ matrix.target }}
82+
- run: cargo test ${{ matrix.no_run }} --manifest-path cc-test/Cargo.toml --target ${{ matrix.target }} --features parallel
83+
- run: cargo test ${{ matrix.no_run }} --manifest-path cc-test/Cargo.toml --target ${{ matrix.target }} --release
84+
85+
msrv:
86+
name: MSRV
87+
runs-on: ${{ matrix.os }}
88+
strategy:
89+
matrix:
90+
os: [ubuntu-latest, windows-latest]
91+
steps:
92+
- uses: actions/checkout@master
93+
- name: Install Rust
94+
run: rustup update 1.31.0 && rustup default 1.31.0
95+
- run: cargo build
96+
97+
rustfmt:
98+
name: Rustfmt
99+
runs-on: ubuntu-latest
100+
steps:
101+
- uses: actions/checkout@master
102+
- name: Install Rust
103+
run: rustup update stable && rustup default stable && rustup component add rustfmt
104+
- run: cargo fmt -- --check
105+
106+
publish_docs:
107+
name: Publish Documentation
108+
runs-on: ubuntu-latest
109+
steps:
110+
- uses: actions/checkout@master
111+
- name: Install Rust
112+
run: rustup update stable && rustup default stable
113+
- name: Build documentation
114+
run: cargo doc --no-deps --all-features
115+
- name: Publish documentation
116+
run: |
117+
cd target/doc
118+
git init
119+
git add .
120+
git -c user.name='ci' -c user.email='ci' commit -m init
121+
git push -f -q https://git:${{ secrets.github_token }}@github.com/${{ github.repository }} HEAD:gh-pages
122+
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
A library to compile C/C++/assembly into a Rust library/application.
44

5-
[![Build Status](https://dev.azure.com/alexcrichton/cc-rs/_apis/build/status/alexcrichton.cc-rs?branchName=master)](https://dev.azure.com/alexcrichton/cc-rs/_build/latest?definitionId=5&branchName=master)
6-
75
[Documentation](https://docs.rs/cc)
86

97
A simple library meant to be used as a build dependency with Cargo packages in

azure-pipelines.yml

-105
This file was deleted.

ci/azure-install-rust.yml

-38
This file was deleted.

ci/azure-steps.yml

-28
This file was deleted.

src/com.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77

88
#![allow(unused)]
99

10-
use std::ffi::{OsStr, OsString};
11-
use std::mem::forget;
12-
use std::ops::Deref;
13-
use std::os::windows::ffi::{OsStrExt, OsStringExt};
14-
use std::ptr::null_mut;
15-
use std::slice::from_raw_parts;
1610
use crate::winapi::CoInitializeEx;
1711
use crate::winapi::IUnknown;
1812
use crate::winapi::Interface;
1913
use crate::winapi::BSTR;
2014
use crate::winapi::COINIT_MULTITHREADED;
2115
use crate::winapi::{SysFreeString, SysStringLen};
2216
use crate::winapi::{HRESULT, S_FALSE, S_OK};
17+
use std::ffi::{OsStr, OsString};
18+
use std::mem::forget;
19+
use std::ops::Deref;
20+
use std::os::windows::ffi::{OsStrExt, OsStringExt};
21+
use std::ptr::null_mut;
22+
use std::slice::from_raw_parts;
2323

2424
pub fn initialize() -> Result<(), HRESULT> {
2525
let err = unsafe { CoInitializeEx(null_mut(), COINIT_MULTITHREADED) };

src/setup_config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#![allow(bad_style)]
99
#![allow(unused)]
1010

11-
use std::ffi::OsString;
12-
use std::ptr::null_mut;
1311
use crate::winapi::Interface;
1412
use crate::winapi::BSTR;
1513
use crate::winapi::LPCOLESTR;
@@ -19,6 +17,8 @@ use crate::winapi::{CoCreateInstance, CLSCTX_ALL};
1917
use crate::winapi::{IUnknown, IUnknownVtbl};
2018
use crate::winapi::{HRESULT, LCID, LPCWSTR, PULONGLONG};
2119
use crate::winapi::{LPFILETIME, ULONG};
20+
use std::ffi::OsString;
21+
use std::ptr::null_mut;
2222

2323
use crate::com::{BStr, ComPtr};
2424

src/windows_registry.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,7 @@ mod impl_ {
313313
}
314314

315315
fn tool_from_vs15_instance(tool: &str, target: &str, instance: &SetupInstance) -> Option<Tool> {
316-
let (bin_path, host_dylib_path, lib_path, include_path) =
317-
vs15_vc_paths(target, instance)?;
316+
let (bin_path, host_dylib_path, lib_path, include_path) = vs15_vc_paths(target, instance)?;
318317
let tool_path = bin_path.join(tool);
319318
if !tool_path.exists() {
320319
return None;
@@ -520,12 +519,13 @@ mod impl_ {
520519
let max_libdir = readdir
521520
.filter_map(|dir| dir.ok())
522521
.map(|dir| dir.path())
523-
.filter(|dir| dir
524-
.components()
525-
.last()
526-
.and_then(|c| c.as_os_str().to_str())
527-
.map(|c| c.starts_with("10.") && dir.join("ucrt").is_dir())
528-
.unwrap_or(false))
522+
.filter(|dir| {
523+
dir.components()
524+
.last()
525+
.and_then(|c| c.as_os_str().to_str())
526+
.map(|c| c.starts_with("10.") && dir.join("ucrt").is_dir())
527+
.unwrap_or(false)
528+
})
529529
.max()?;
530530
let version = max_libdir.components().last().unwrap();
531531
let version = version.as_os_str().to_str().unwrap().to_string();

tests/cflags.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod support;
22

3-
use std::env;
43
use crate::support::Test;
4+
use std::env;
55

66
/// This test is in its own module because it modifies the environment and would affect other tests
77
/// when run in parallel with them.

tests/cxxflags.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod support;
22

3-
use std::env;
43
use crate::support::Test;
4+
use std::env;
55

66
/// This test is in its own module because it modifies the environment and would affect other tests
77
/// when run in parallel with them.

0 commit comments

Comments
 (0)