feat(ci): first draft of modulo caching

This commit is contained in:
Federico Terzi 2022-07-03 16:10:35 +02:00
parent c244642459
commit 89aca32b09
2 changed files with 47 additions and 2 deletions

View File

@ -12,6 +12,7 @@ on:
env:
CARGO_TERM_COLOR: always
WX_WIDGETS_BUILD_OUT_DIR: "wx-widgets-build"
jobs:
build:
@ -37,6 +38,13 @@ jobs:
run: |
cargo install rust-script --version "0.7.0"
cargo install cargo-make --version 0.34.0
- name: "Cache wxWidgets builds"
if: ${{ runner.os != 'Linux' }}
uses: actions/cache@v3
with:
path: |
wx-widgets-build/
key: ${{ runner.os }}-${{ hashFiles('espanso-modulo/build.rs') }}-${{ hashFiles('espanso-modulo/vendor/*') }}
- name: Build
run: |
cargo make build-binary
@ -70,6 +78,13 @@ jobs:
run: |
cargo install rust-script --version "0.7.0"
cargo install cargo-make --version 0.34.0
- name: "Cache wxWidgets builds"
if: ${{ runner.os != 'Linux' }}
uses: actions/cache@v3
with:
path: |
wx-widgets-build/
key: ${{ runner.os }}-${{ hashFiles('espanso-modulo/build.rs') }}-${{ hashFiles('espanso-modulo/vendor/*') }}
- name: Run test suite
run: cargo make test-binary
@ -128,6 +143,13 @@ jobs:
run: |
cargo install rust-script --version "0.7.0"
cargo install cargo-make --version 0.34.0
- name: "Cache wxWidgets builds"
if: ${{ runner.os != 'Linux' }}
uses: actions/cache@v3
with:
path: |
wx-widgets-build/
key: ${{ runner.os }}-${{ hashFiles('espanso-modulo/build.rs') }}-${{ hashFiles('espanso-modulo/vendor/*') }}
- name: Build
run: |
cargo make build-macos-arm-binary

View File

@ -25,6 +25,9 @@ use std::path::Path;
#[cfg(not(target_os = "linux"))]
const WX_WIDGETS_ARCHIVE_NAME: &str = "wxWidgets-3.1.5.zip";
#[cfg(not(target_os = "linux"))]
const WX_WIDGETS_BUILD_OUT_DIR_ENV_NAME: &str = "WX_WIDGETS_BUILD_OUT_DIR";
#[cfg(target_os = "windows")]
fn build_native() {
use std::process::Command;
@ -36,7 +39,17 @@ fn build_native() {
panic!("could not find wxWidgets archive!");
}
let out_dir = PathBuf::from(std::env::var("OUT_DIR").expect("missing OUT_DIR"));
let out_dir = if let Ok(out_path) = std::env::var(WX_WIDGETS_BUILD_OUT_DIR_ENV_NAME) {
println!(
"detected wxWidgets build output directory override: {}",
out_path
);
let path = PathBuf::from(out_path);
std::fs::create_dir_all(&path).expect("unable to create wxWidgets out dir");
path
} else {
PathBuf::from(std::env::var("OUT_DIR").expect("missing OUT_DIR"))
};
let out_wx_dir = out_dir.join("wx");
if !out_wx_dir.is_dir() {
@ -154,7 +167,17 @@ fn build_native() {
panic!("could not find wxWidgets archive!");
}
let out_dir = PathBuf::from(std::env::var("OUT_DIR").expect("missing OUT_DIR"));
let out_dir = if let Ok(out_path) = std::env::var(WX_WIDGETS_BUILD_OUT_DIR_ENV_NAME) {
println!(
"detected wxWidgets build output directory override: {}",
out_path
);
let path = PathBuf::from(out_path);
std::fs::create_dir_all(&path).expect("unable to create wxWidgets out dir");
path
} else {
PathBuf::from(std::env::var("OUT_DIR").expect("missing OUT_DIR"))
};
let out_wx_dir = out_dir.join("wx");
let target_arch = match std::env::var("CARGO_CFG_TARGET_ARCH")