feat(ci): improve cache, add test-core features matrix (#5604)

This commit is contained in:
Lucas Fernandes Nogueira 2022-11-10 17:30:10 -03:00 committed by GitHub
parent a836373328
commit 6e879742f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 82 additions and 70 deletions

View File

@ -8,7 +8,7 @@
"getPublishedVersion": "cargo search ${ pkgFile.pkg.package.name } --limit 1 | sed -nE \"s/^[^\\\"]*\\\"//; s/\\\".*//1p\"",
"prepublish": [
"sudo apt-get update",
"sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf",
"sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev",
"cargo install cargo-audit --features=fix",
{
"command": "cargo generate-lockfile",

View File

@ -40,7 +40,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
with:

View File

@ -47,7 +47,7 @@ jobs:
run: |
python -m pip install --upgrade pip
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf xvfb
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev xvfb
wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
sudo dpkg -i hyperfine_1.11.0_amd64.deb
pip install memory_profiler

View File

@ -30,7 +30,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
with:

View File

@ -111,7 +111,7 @@ jobs:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- name: Test
run: |

View File

@ -62,7 +62,7 @@ jobs:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: actions-rs/toolchain@v1
with:
@ -74,6 +74,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
workspaces: core -> ../target
save-if: ${{ matrix.clippy.key == 'all' }}
- uses: actions-rs/clippy-check@v1
with:

View File

@ -259,7 +259,7 @@ jobs:
- name: install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- name: Test bindings
run: yarn test
test-linux-x64-musl-binding:
@ -298,7 +298,7 @@ jobs:
shell: bash
- name: Install system dependencies
run: |
apk add openssl-dev musl-dev glib-dev cairo-dev pkgconfig gdk-pixbuf-dev webkit2gtk-dev curl libappindicator-dev patchelf librsvg-dev gtk+3.0-dev
apk add openssl-dev musl-dev glib-dev cairo-dev pkgconfig gdk-pixbuf-dev webkit2gtk-dev curl libappindicator-dev gtk+3.0-dev
- name: Setup and run tests
run: |
yarn tauri --help
@ -355,7 +355,7 @@ jobs:
set -e
export PATH=/usr/local/cargo/bin/:/usr/local/fnm:$PATH
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends -y unzip libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends -y unzip webkit2gtk-4.0 libayatana-appindicator3-dev
bash
curl https://sh.rustup.rs -sSf | bash -s -- -y
curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "/usr/local/fnm" --skip-shell

View File

@ -51,7 +51,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
with:

View File

@ -46,6 +46,19 @@ jobs:
os: macos-latest,
toolchain: '1.59.0'
}
features:
- {
args: --no-default-features,
key: no-default
}
- {
args: --features api-all,
key: api-all
}
- {
args: --features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,
key: all
}
steps:
- uses: actions/checkout@v2
@ -62,14 +75,12 @@ jobs:
if: contains(matrix.platform.target, 'unknown-linux')
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
with:
workspaces: core -> ../target
save-if: ${{ matrix.features.key == 'all' }}
- name: test
run: |
cargo test --target ${{ matrix.platform.target }}
cargo test --target ${{ matrix.platform.target }} --features api-all
cargo test --target ${{ matrix.platform.target }} --features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart
run: cargo test --target ${{ matrix.platform.target }} ${{ matrix.features.args }}

View File

@ -157,7 +157,7 @@ jobs:
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: actions-rs/cargo@v1
with:

View File

@ -594,25 +594,25 @@ impl Response {
reader
}
/// Convert the response into a Stream of [`bytes::Bytes`] from the body.
///
/// # Examples
///
/// ```no_run
/// use futures_util::StreamExt;
///
/// # async fn run() -> Result<(), Box<dyn std::error::Error>> {
/// let client = tauri::api::http::ClientBuilder::new().build()?;
/// let mut stream = client.send(tauri::api::http::HttpRequestBuilder::new("GET", "http://httpbin.org/ip")?)
/// .await?
/// .bytes_stream();
///
/// while let Some(item) = stream.next().await {
/// println!("Chunk: {:?}", item?);
/// }
/// # Ok(())
/// # }
/// ```
// Convert the response into a Stream of [`bytes::Bytes`] from the body.
//
// # Examples
//
// ```no_run
// use futures_util::StreamExt;
//
// # async fn run() -> Result<(), Box<dyn std::error::Error>> {
// let client = tauri::api::http::ClientBuilder::new().build()?;
// let mut stream = client.send(tauri::api::http::HttpRequestBuilder::new("GET", "http://httpbin.org/ip")?)
// .await?
// .bytes_stream();
//
// while let Some(item) = stream.next().await {
// println!("Chunk: {:?}", item?);
// }
// # Ok(())
// # }
// ```
#[cfg(feature = "reqwest-client")]
#[allow(dead_code)]
pub(crate) fn bytes_stream(

View File

@ -34,9 +34,7 @@ mod rust {
Ok(())
})
.invoke_handler(tauri::generate_handler![close_splashscreen])
.run(tauri::generate_context!(
"../../examples/splashscreen/tauri.conf.json"
))
.run(super::context())
.expect("failed to run app");
}
}
@ -64,7 +62,7 @@ mod ui {
}
pub fn main() {
let context = tauri::generate_context!("../../examples/splashscreen/tauri.conf.json");
let context = super::context();
tauri::Builder::default()
.menu(if cfg!(target_os = "macos") {
tauri::Menu::os_default(&context.package_info().name)
@ -87,6 +85,10 @@ mod ui {
}
}
fn context() -> tauri::Context<tauri::utils::assets::EmbeddedAssets> {
tauri::generate_context!("../../examples/splashscreen/tauri.conf.json")
}
fn main() {
// toggle this flag to experiment with different splashscreen usages
let ui = false;

View File

@ -1,32 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
video {
width: 100vw;
height: 100vh;
}
</style>
</head>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
video {
width: 100vw;
height: 100vh;
}
</style>
</head>
<body>
<video id="video_source" controls="" autoplay="" name="media">
<source type="video/mp4" />
</video>
<script>
const { invoke, convertFileSrc } = window.__TAURI__.tauri
const video = document.getElementById('video_source')
const source = document.createElement('source')
invoke('video_uri').then(([scheme, path]) => {
source.type = 'video/mp4'
source.src = convertFileSrc(path, scheme)
video.appendChild(source)
video.load()
})
</script>
</body>
</html>
<body>
<video id="video_source" controls="" autoplay="" name="media">
<source type="video/mp4" />
</video>
<script>
const { invoke, convertFileSrc } = window.__TAURI__.tauri
const video = document.getElementById('video_source')
const source = document.createElement('source')
invoke('video_uri').then(([scheme, path]) => {
source.type = 'video/mp4'
source.src = convertFileSrc(path, scheme)
video.appendChild(source)
video.load()
})
</script>
</body>
</html>

View File

@ -6,7 +6,7 @@
"getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -",
"prepublish": [
"sudo apt-get update",
"sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0",
"sudo apt-get install -y webkit2gtk-4.0",
"cargo install cargo-audit",
{
"command": "cargo generate-lockfile",

View File

@ -6,7 +6,7 @@
"getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -",
"prepublish": [
"sudo apt-get update",
"sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0",
"sudo apt-get install -y webkit2gtk-4.0",
"cargo install cargo-audit",
{
"command": "cargo generate-lockfile",