Faster CI by running pre-built test separately (#34)

This commit is contained in:
Johan Andersson 2020-11-14 23:56:28 +01:00 committed by GitHub
parent ba18db6a82
commit 2ba14801cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View file

@ -12,20 +12,14 @@ jobs:
with: with:
toolchain: stable toolchain: stable
override: true override: true
# make sure all code has been formatted with rustfmt # make sure all code has been formatted with rustfmt
- run: rustup component add rustfmt - run: rustup component add rustfmt
- uses: actions-rs/cargo@v1 - uses: actions-rs/cargo@v1
with: with:
command: fmt command: fmt
args: --all -- --check --color always args: --all -- --check --color always
# run clippy to verify we have no warnings # run clippy to verify we have no warnings
- run: rustup component add clippy - run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- uses: actions-rs/cargo@v1 - uses: actions-rs/cargo@v1
with: with:
command: clippy command: clippy
@ -37,8 +31,8 @@ jobs:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: EmbarkStudios/cargo-deny-action@v1 - uses: EmbarkStudios/cargo-deny-action@v1
test: test-source:
name: Test name: Test (source build)
runs-on: macos-latest runs-on: macos-latest
env: env:
DEVELOPER_DIR: /Applications/Xcode_12.1.app DEVELOPER_DIR: /Applications/Xcode_12.1.app
@ -51,6 +45,18 @@ jobs:
- uses: actions-rs/cargo@v1 - uses: actions-rs/cargo@v1
with: with:
command: build command: build
test:
name: Test (pre-built)
runs-on: macos-latest
env:
DEVELOPER_DIR: /Applications/Xcode_12.1.app
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1 - uses: actions-rs/cargo@v1
with: with:
command: build command: build

View file

@ -116,6 +116,8 @@ mod mac {
std::fs::create_dir_all(&target_dir).expect("Couldn't create directory"); std::fs::create_dir_all(&target_dir).expect("Couldn't create directory");
let previous_path = std::env::current_dir().expect("Couldn't get current directory");
std::env::set_current_dir(&target_dir).expect("Couldn't change current directory"); std::env::set_current_dir(&target_dir).expect("Couldn't change current directory");
let curl = Command::new("curl") let curl = Command::new("curl")
@ -184,6 +186,8 @@ mod mac {
assert!(status.success()); assert!(status.success());
} }
} }
std::env::set_current_dir(&previous_path).expect("Couldn't change current directory");
} }
} }
@ -240,7 +244,6 @@ fn main() {
pb pb
}; };
println!("cargo:rustc-link-search=native={}", project_dir.display()); println!("cargo:rustc-link-search=native={}", project_dir.display());
} }