Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a testing framework for Wasmer Pack #112

Merged
merged 14 commits into from
Dec 12, 2022
29 changes: 8 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ env:
RUST_BACKTRACE: 1
CARGO_NET_GIT_FETCH_WITH_CLI: true
MDBOOK_VERSION: v0.4.21
MSRV: "1.64.0" # Required for [workspace.package]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -23,13 +22,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.MSRV }}
override: true
target: wasm32-unknown-unknown
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install Node
Expand All @@ -43,6 +35,13 @@ jobs:
- name: Install Pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python3
- run: yarn --version
- name: Setup Wasmer
uses: wasmerio/setup-wasmer@v1
- name: Install cargo-wapm
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-wapm --debug --verbose
- name: Type Checking
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -73,8 +72,7 @@ jobs:
message: |
Make sure you keep an eye on build times!

One of this project's goals is to [keep CI runs under 5 minutes][goal]
so developers can maintain fast edit-compile-test cycles.
One of this project's goals is to [keep CI runs under 5 minutes][goal] so developers can maintain fast edit-compile-test cycles.

[goal]: https://github.com/wasmerio/wasmer-pack/blob/bdfd5c9483821651cf0bbd70189fc04416bc22b1/CONTRIBUTING.md#goal-1-fast-compile-times

Expand All @@ -83,12 +81,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Check Formatting
Expand All @@ -107,11 +99,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install mdbook
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@ on:
env:
RUST_BACKTRACE: 1
CARGO_NET_GIT_FETCH_WITH_CLI: true
MSRV: "1.64.0" # Required for [workspace.package]

jobs:
publish-to-wapm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.MSRV }}
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install WebAssembly targets
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ yarn-error.log
.pytest_cache
__pycache__/
*.pyc
.venv/
106 changes: 106 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["crates/*", "examples/*"]
members = ["crates/*", "examples/*", "integration-tests"]

[workspace.package]
authors = ["Wasmer Engineering Team <[email protected]>"]
Expand Down
7 changes: 4 additions & 3 deletions crates/cli/src/codegen.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
use std::path::PathBuf;

use anyhow::{Context, Error};
use crate::Error;
use anyhow::Context;
use clap::Parser;

#[derive(Debug, Parser)]
pub struct Codegen {
/// Where to save the generated bindings.
#[clap(short, long)]
out_dir: Option<PathBuf>,
pub out_dir: Option<PathBuf>,
/// The Pirita file to read.
#[clap(parse(from_os_str))]
input: PathBuf,
pub input: PathBuf,
}

impl Codegen {
Expand Down
2 changes: 2 additions & 0 deletions crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ pub use crate::{
codegen::{Codegen, Language},
show::{Format, Show},
};

pub type Error = anyhow::Error;
3 changes: 2 additions & 1 deletion crates/cli/src/pirita.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use std::{
path::{Path, PathBuf},
};

use anyhow::{Context, Error};
use crate::Error;
use anyhow::Context;
use wapm_targz_to_pirita::{generate_webc_file, TransformManifestFunctions};
use wasmer_pack::{Command, Interface, Library, Metadata, Module, Package};
use webc::{DirOrFile, Manifest, ParseOptions, WebC, WebCOwned};
Expand Down
11 changes: 11 additions & 0 deletions crates/testing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "wasmer-pack-testing"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tempfile = "3.3.0"
tracing = "0.1.37"
wasmer-pack-cli = { version = "0.5.3", path = "../cli" }
Loading