mirror of
https://github.com/mii443/wasmer.git
synced 2025-08-23 00:45:32 +00:00
Merge branch 'main' into 5198-cli-support-wasm_c_api-backends-together-with-native-ones
This commit is contained in:
47
.github/workflows/test.yaml
vendored
47
.github/workflows/test.yaml
vendored
@ -1099,47 +1099,16 @@ jobs:
|
|||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: wasmer-cli-linux-x64
|
name: wasmer-cli-linux-x64
|
||||||
- name: Cargo Registry Cache
|
- uses: wasmerio/setup-wasmer@v2
|
||||||
uses: actions/cache@v3
|
- uses: denoland/setup-deno@v1
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/advisory-db
|
|
||||||
~/.cargo/git
|
|
||||||
~/.cargo/registry
|
|
||||||
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
- name: Cargo target cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
target/
|
|
||||||
key: cargo-release-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
- run: |
|
- run: |
|
||||||
# install rust toolchain
|
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
||||||
. "$HOME/.cargo/env"
|
|
||||||
|
|
||||||
# add wasmer cli to PATH
|
|
||||||
tar -xzf build-wasmer.tar.gz
|
tar -xzf build-wasmer.tar.gz
|
||||||
|
cp ./bin/wasmer ~/.wasmer/bin/wasmer
|
||||||
docker build -t tmp .
|
- name: test
|
||||||
docker run -v $PWD:/app -w /app tmp bash -c " \
|
env:
|
||||||
cp ./bin/wasmer /root/.wasmer/bin/wasmer &&\
|
WASMER_REGISTRY: https://registry.wasmer.wtf/graphql
|
||||||
export MYSQL_HOST='${{ vars.INTEGRATION_TEST_MYSQL_HOST }}' &&\
|
WASMER_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }}
|
||||||
export MYSQL_DBNAME='${{ vars.INTEGRATION_TEST_MYSQL_DBNAME }}' &&\
|
run: deno test --allow-all --parallel
|
||||||
export MYSQL_USERNAME='${{ secrets.INTEGRATION_TEST_MYSQL_USERNAME }}' &&\
|
|
||||||
export MYSQL_PASSWORD='${{ secrets.INTEGRATION_TEST_MYSQL_PASSWORD }}' &&\
|
|
||||||
export MYSQL_PORT='${{ vars.INTEGRATION_TEST_MYSQL_PORT }}' &&\
|
|
||||||
export MYSQL_CERT='${{ secrets.INTEGRATION_TEST_MYSQL_CERT }}' &&\
|
|
||||||
export PG_HOST='${{ vars.INTEGRATION_TEST_PG_HOST }}' &&\
|
|
||||||
export PG_DBNAME='${{ vars.INTEGRATION_TEST_PG_DBNAME }}' &&\
|
|
||||||
export PG_USERNAME='${{ secrets.INTEGRATION_TEST_PG_USERNAME }}' &&\
|
|
||||||
export PG_PASSWORD='${{ secrets.INTEGRATION_TEST_PG_PASSWORD }}' &&\
|
|
||||||
export PG_PORT='${{ vars.INTEGRATION_TEST_PG_PORT }}' &&\
|
|
||||||
wasmer config set registry.url https://registry.wasmer.io/graphql &&\
|
|
||||||
wasmer login '${{ secrets.WAPM_PROD_TOKEN }}' &&\
|
|
||||||
wasmer config set registry.url https://registry.wasmer.wtf/graphql &&\
|
|
||||||
wasmer login '${{ secrets.WAPM_DEV_TOKEN }}' &&\
|
|
||||||
cargo test --no-fail-fast"
|
|
||||||
- name: notify failure in slack
|
- name: notify failure in slack
|
||||||
if: failure()
|
if: failure()
|
||||||
run: |
|
run: |
|
||||||
|
23
Cargo.lock
generated
23
Cargo.lock
generated
@ -2372,7 +2372,7 @@ dependencies = [
|
|||||||
"http",
|
"http",
|
||||||
"hyper",
|
"hyper",
|
||||||
"hyper-util",
|
"hyper-util",
|
||||||
"rustls 0.23.17",
|
"rustls 0.23.19",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-rustls 0.26.0",
|
"tokio-rustls 0.26.0",
|
||||||
@ -2901,7 +2901,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.48.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3978,7 +3978,7 @@ dependencies = [
|
|||||||
"quinn-proto",
|
"quinn-proto",
|
||||||
"quinn-udp",
|
"quinn-udp",
|
||||||
"rustc-hash 2.0.0",
|
"rustc-hash 2.0.0",
|
||||||
"rustls 0.23.17",
|
"rustls 0.23.19",
|
||||||
"socket2",
|
"socket2",
|
||||||
"thiserror 2.0.3",
|
"thiserror 2.0.3",
|
||||||
"tokio",
|
"tokio",
|
||||||
@ -3996,8 +3996,7 @@ dependencies = [
|
|||||||
"rand",
|
"rand",
|
||||||
"ring",
|
"ring",
|
||||||
"rustc-hash 2.0.0",
|
"rustc-hash 2.0.0",
|
||||||
"rustls 0.23.17",
|
"rustls 0.23.19",
|
||||||
"rustls-pki-types",
|
|
||||||
"slab",
|
"slab",
|
||||||
"thiserror 2.0.3",
|
"thiserror 2.0.3",
|
||||||
"tinyvec",
|
"tinyvec",
|
||||||
@ -4246,7 +4245,7 @@ dependencies = [
|
|||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"quinn",
|
"quinn",
|
||||||
"rustls 0.23.17",
|
"rustls 0.23.19",
|
||||||
"rustls-pemfile",
|
"rustls-pemfile",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"serde",
|
"serde",
|
||||||
@ -4418,9 +4417,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls"
|
name = "rustls"
|
||||||
version = "0.23.17"
|
version = "0.23.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7f1a745511c54ba6d4465e8d5dfbd81b45791756de28d4981af70d6dca128f1e"
|
checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
@ -5388,7 +5387,7 @@ version = "0.26.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
|
checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustls 0.23.17",
|
"rustls 0.23.19",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
@ -5459,7 +5458,7 @@ checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"log",
|
"log",
|
||||||
"rustls 0.23.17",
|
"rustls 0.23.19",
|
||||||
"rustls-native-certs",
|
"rustls-native-certs",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"tokio",
|
"tokio",
|
||||||
@ -5744,7 +5743,7 @@ dependencies = [
|
|||||||
"httparse",
|
"httparse",
|
||||||
"log",
|
"log",
|
||||||
"rand",
|
"rand",
|
||||||
"rustls 0.23.17",
|
"rustls 0.23.19",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"sha1",
|
"sha1",
|
||||||
"thiserror 1.0.69",
|
"thiserror 1.0.69",
|
||||||
@ -5998,7 +5997,7 @@ dependencies = [
|
|||||||
"flate2",
|
"flate2",
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustls 0.23.17",
|
"rustls 0.23.19",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"url",
|
"url",
|
||||||
"webpki-roots",
|
"webpki-roots",
|
||||||
|
@ -172,6 +172,24 @@ impl NamedPackageIdent {
|
|||||||
|
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if this ident matches the given package id.
|
||||||
|
///
|
||||||
|
/// Semver constraints are matched against the package id's version.
|
||||||
|
pub fn matches_id(&self, id: &NamedPackageId) -> bool {
|
||||||
|
if self.full_name() == id.full_name {
|
||||||
|
if let Some(tag) = &self.tag {
|
||||||
|
match tag {
|
||||||
|
Tag::Named(n) => n == &id.version.to_string(),
|
||||||
|
Tag::VersionReq(v) => v.matches(&id.version),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<NamedPackageId> for NamedPackageIdent {
|
impl From<NamedPackageId> for NamedPackageIdent {
|
||||||
@ -443,4 +461,23 @@ mod tests {
|
|||||||
let ident2 = serde_json::from_str::<NamedPackageIdent>(&raw).unwrap();
|
let ident2 = serde_json::from_str::<NamedPackageIdent>(&raw).unwrap();
|
||||||
assert_eq!(ident, ident2);
|
assert_eq!(ident, ident2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_named_package_ident_matches_id() {
|
||||||
|
assert!(NamedPackageIdent::from_str("ns/name")
|
||||||
|
.unwrap()
|
||||||
|
.matches_id(&NamedPackageId::try_new("ns/name", "0.1.0").unwrap()));
|
||||||
|
|
||||||
|
assert!(NamedPackageIdent::from_str("ns/name")
|
||||||
|
.unwrap()
|
||||||
|
.matches_id(&NamedPackageId::try_new("ns/name", "1.0.1").unwrap()));
|
||||||
|
|
||||||
|
assert!(NamedPackageIdent::from_str("ns/name@1")
|
||||||
|
.unwrap()
|
||||||
|
.matches_id(&NamedPackageId::try_new("ns/name", "1.0.1").unwrap()));
|
||||||
|
|
||||||
|
assert!(!NamedPackageIdent::from_str("ns/name@2")
|
||||||
|
.unwrap()
|
||||||
|
.matches_id(&NamedPackageId::try_new("ns/name", "1.0.1").unwrap()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use super::{NamedPackageIdent, PackageHash, PackageParseError};
|
use super::{NamedPackageIdent, PackageHash, PackageId, PackageParseError};
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Debug, Hash)]
|
#[derive(PartialEq, Eq, Clone, Debug, Hash)]
|
||||||
pub enum PackageIdent {
|
pub enum PackageIdent {
|
||||||
@ -24,6 +24,17 @@ impl PackageIdent {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if this ident matches the given package id.
|
||||||
|
///
|
||||||
|
/// Semver constraints are matched against the package id's version.
|
||||||
|
pub fn matches_id(&self, id: &PackageId) -> bool {
|
||||||
|
match (self, id) {
|
||||||
|
(Self::Named(a), PackageId::Named(b)) => a.matches_id(b),
|
||||||
|
(Self::Hash(a), PackageId::Hash(b)) => a == b,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<NamedPackageIdent> for PackageIdent {
|
impl From<NamedPackageIdent> for PackageIdent {
|
||||||
@ -92,3 +103,23 @@ impl schemars::JsonSchema for PackageIdent {
|
|||||||
String::json_schema(gen)
|
String::json_schema(gen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_package_ident_matches_id() {
|
||||||
|
assert!(PackageIdent::from_str("ns/pkg")
|
||||||
|
.unwrap()
|
||||||
|
.matches_id(&PackageId::new_named("ns/pkg", "1.0.0".parse().unwrap())));
|
||||||
|
|
||||||
|
assert!(PackageIdent::from_str("ns/pkg@2")
|
||||||
|
.unwrap()
|
||||||
|
.matches_id(&PackageId::new_named("ns/pkg", "2.3.7".parse().unwrap())));
|
||||||
|
|
||||||
|
assert!(!PackageIdent::from_str("ns/pkg@3")
|
||||||
|
.unwrap()
|
||||||
|
.matches_id(&PackageId::new_named("ns/pkg", "2.3.7".parse().unwrap())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user