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

Add CLI driver tests #20

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b001c76
Add Dockerfile and Docker usage instructions
camerondurham Oct 22, 2021
37bbc9b
Remove unnecessary gcc, g++ deps in builder img
camerondurham Oct 22, 2021
3d384f2
Add build workflow, cleanup README
camerondurham Nov 2, 2021
5126b11
Test: intentionally break build
camerondurham Nov 2, 2021
16cf2b2
Fix build: re-add clang dep
camerondurham Nov 2, 2021
2dae6ea
Add note about Debian dependencies to README
camerondurham Nov 2, 2021
0d16ec9
Merge branch 'amzn:master' into master
camerondurham Nov 7, 2021
7cae483
Add basic, runnable tests
camerondurham Nov 8, 2021
6c5218a
Update ion-rs version, ion-c submodule and Dockerfile
camerondurham Nov 22, 2021
256630c
Merge pull request #2 from camerondurham/upgrade-deps
camerondurham Nov 22, 2021
ae9b22b
Merge branch 'amzn:master' into master
camerondurham Dec 10, 2021
0e54cce
Merge branch 'amzn:master' into master
camerondurham Dec 27, 2021
39f03c1
Add basic, runnable tests
camerondurham Nov 8, 2021
0e36543
Add basic workflows for coverage and build
camerondurham Dec 19, 2021
290c4f9
rebase branch and add new Cargo.lock, ion-c changes
camerondurham Dec 27, 2021
784c43e
pin to specific cargo release
camerondurham Dec 27, 2021
1a53227
Make bin match cargo name
camerondurham Feb 10, 2022
5dfab4d
Update Cargo.toml
camerondurham Feb 10, 2022
3f48b37
Add Dockerfile and Docker usage instructions
camerondurham Oct 22, 2021
6e2a445
Remove unnecessary gcc, g++ deps in builder img
camerondurham Oct 22, 2021
d853d6e
Add build workflow, cleanup README
camerondurham Nov 2, 2021
20fc2e5
Test: intentionally break build
camerondurham Nov 2, 2021
51ec039
Fix build: re-add clang dep
camerondurham Nov 2, 2021
d4b7fa9
Add basic, runnable tests
camerondurham Nov 8, 2021
37ef014
Update ion-rs version, ion-c submodule and Dockerfile
camerondurham Nov 22, 2021
1583eb9
Add basic, runnable tests
camerondurham Nov 8, 2021
b7b4fdb
Add basic workflows for coverage and build
camerondurham Dec 19, 2021
33faba8
rebase branch and add new Cargo.lock, ion-c changes
camerondurham Dec 27, 2021
0cd765d
pin to specific cargo release
camerondurham Dec 27, 2021
12a3aa5
Make bin match cargo name
camerondurham Feb 10, 2022
1f20d49
Update Cargo.toml
camerondurham Feb 10, 2022
153b07b
Merge branch 'amzn-master' into cli-tests
camerondurham Feb 20, 2022
7980666
* use 2022 pinned version and fix edition 2021 errors
camerondurham Feb 20, 2022
0534da9
Add test comment, revert ion-c commits, remove failing coverage test …
camerondurham Mar 1, 2022
4b38b93
try updating ion-c submodule to resolve windows build error
camerondurham Mar 1, 2022
20204c9
revert ion-c commits to match main branch
camerondurham Mar 1, 2022
a40992d
Remove Windows build due to CMake build failure
camerondurham Mar 1, 2022
d3f7faa
try with windows latest
camerondurham Mar 1, 2022
6992c98
remove windows build for now
camerondurham Mar 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI Build

on: [push, pull_request]

jobs:
build:
name: Build and Test
runs-on: ${{ matrix.os }}
# We want to run on external PRs, but not on internal ones as push automatically builds
# H/T: https://github.com/Dart-Code/Dart-Code/commit/612732d5879730608baa9622bf7f5e5b7b51ae65
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'amzn/ion-cli'
strategy:
matrix:
# TODO: add windows after fixing cmake version error issues
# see for example Windows build workflow: https://github.com/amzn/ion-rust/blob/a4b154cc0a5b5b661a45ac14d3719a501573d8f2/.github/workflows/rust.yml#L13-L28
os: [ubuntu-latest, macos-latest]

steps:
- name: Git Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Cargo Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --workspace
- name: Cargo Test
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --workspace -- --test-threads=1
- name: Rustfmt Check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --verbose -- --check
157 changes: 157 additions & 0 deletions Cargo.lock

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

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ ion-schema = "0.1.0"
[build-dependencies]
cmake = "0.1.44"

[dev-dependencies]
rstest = "~0.10.0"
assert_cmd = "~1.0.5"
tempfile = "~3.2.0"

[[bin]]
name = "ion"
test = false
test = true
bench = false
20 changes: 16 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,24 @@ fn main() {
// which libraries to link against and in which directories they can be found.

// ion_events library
println!("cargo:rustc-link-search=native={}/build/tools/events", ion_c_release_dir);
println!(
"cargo:rustc-link-search=native={}/build/tools/events",
ion_c_release_dir
);
println!("cargo:rustc-link-lib=static=ion_events_static");

// ion_c library
println!("cargo:rustc-link-search=native={}/build/ionc", ion_c_release_dir);
println!(
"cargo:rustc-link-search=native={}/build/ionc",
ion_c_release_dir
);
println!("cargo:rustc-link-lib=static=ionc_static");

// decNumber library
println!("cargo:rustc-link-search=native={}/build/decNumber", ion_c_release_dir);
println!(
"cargo:rustc-link-search=native={}/build/decNumber",
ion_c_release_dir
);
println!("cargo:rustc-link-lib=static=decNumber_static");

// C++ library
Expand All @@ -63,7 +72,10 @@ fn main() {
}

// ion-c CLI library
println!("cargo:rustc-link-search=native={}/build/tools/cli/", ion_c_release_dir);
println!(
"cargo:rustc-link-search=native={}/build/tools/cli/",
ion_c_release_dir
);
println!("cargo:rustc-link-lib=static=ion_cli_main");

// Only rebuild ion-c if that submodule directory is updated
Expand Down
11 changes: 4 additions & 7 deletions src/bin/ion/commands/beta/mod.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
pub mod inspect;
pub mod schema;

use crate::commands::{CommandConfig, CommandRunner};
use anyhow::Result;
use clap::{App, ArgMatches};
use crate::commands::{CommandRunner, CommandConfig};

// To add a beta subcommand, add your new command to the `beta_subcommands`
// and `runner_for_beta_subcommands` functions.

// Creates a Vec of CLI configurations for all of the available built-in commands
pub fn beta_subcommands() -> Vec<CommandConfig> {
vec![
inspect::app(),
schema::app()
]
vec![inspect::app(), schema::app()]
}

pub fn runner_for_beta_subcommand(command_name: &str) -> Option<CommandRunner> {
let runner = match command_name {
"inspect" => inspect::run,
"schema" => schema::run,
_ => return None
_ => return None,
};
Some(runner)
}
Expand All @@ -39,7 +36,7 @@ pub fn run(_command_name: &str, matches: &ArgMatches<'static>) -> Result<()> {
"The requested beta command ('{}') is not supported and clap did not generate an error message.",
command_name
);
unreachable!(message);
unreachable!("{}", message);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed you fixed this already in #21. Apologies for including too many things in this CR, I'll avoid this in the future. Would it be better if I send a new CR rebased on the main branch with only the commits to add the driver test and workflow?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better if I send a new CR rebased on the main branch with only the commits to add the driver test and workflow?

That would be really helpful if you don't mind!

}
Ok(())
}
Expand Down
Loading