From 4e08a0242150e97873deaa97d3ddaee934cfda88 Mon Sep 17 00:00:00 2001 From: Roger-luo Date: Sun, 19 Feb 2023 20:07:40 -0500 Subject: [PATCH 01/11] test julia-semver --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 061957f..d90d779 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,6 +57,12 @@ jobs: with: command: test + - name: Run cargo test -p julia-semver + uses: actions-rs/cargo@v1 + with: + command: test + args: --package julia-semver + coverage: name: Coverage strategy: From 2dd85165d303927685105d05b47ccd733e9c73b7 Mon Sep 17 00:00:00 2001 From: Roger-luo Date: Sun, 19 Feb 2023 20:13:31 -0500 Subject: [PATCH 02/11] test on semver --- .github/workflows/main.yml | 6 -- .github/workflows/semver.yml | 142 +++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/semver.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d90d779..061957f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,12 +57,6 @@ jobs: with: command: test - - name: Run cargo test -p julia-semver - uses: actions-rs/cargo@v1 - with: - command: test - args: --package julia-semver - coverage: name: Coverage strategy: diff --git a/.github/workflows/semver.yml b/.github/workflows/semver.yml new file mode 100644 index 0000000..c4daa2c --- /dev/null +++ b/.github/workflows/semver.yml @@ -0,0 +1,142 @@ +name: Julia Semver +on: + pull_request: + push: + branches: + - main + schedule: + - cron: '00 01 * * *' +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + pre_job: + # continue-on-error: true # Uncomment once integration is finished + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + # All of these options are optional, so you can remove them if you are happy with the defaults + concurrent_skipping: 'never' + skip_after_successful_duplicate: 'true' + paths: '["**/julia-semver"]' + do_not_skip: '["workflow_dispatch", "schedule"]' + + check: + name: Check + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - uses: Swatinem/rust-cache@v1 + + - name: Run cargo check + uses: actions-rs/cargo@v1 + with: + command: check + args: --package julia-semver + + test: + name: Test Suite + strategy: + matrix: + os: [ubuntu-latest] + rust: [stable] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + + - uses: Swatinem/rust-cache@v1 + - name: Run cargo test -p julia-semver + uses: actions-rs/cargo@v1 + with: + command: test + args: --package julia-semver + + coverage: + name: Coverage + strategy: + matrix: + os: [ubuntu-latest] + rust: [stable] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Setup Julia + uses: ./.github/actions/setup-julia + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + components: llvm-tools-preview + + - uses: Swatinem/rust-cache@v1 + + - name: Download grcov + run: | + mkdir -p "${HOME}/.local/bin" + curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin" + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Run xtask coverage + uses: actions-rs/cargo@v1 + with: + command: xtask + args: coverage --package julia-semver + + - name: Upload to codecov.io + uses: codecov/codecov-action@v3 + with: + files: coverage/*.lcov + + lints: + name: Lints + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + with: + submodules: true + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt, clippy + + - uses: Swatinem/rust-cache@v1 + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings From d6c6c6e3db1802e058fb58f9c2b7c42771511cdb Mon Sep 17 00:00:00 2001 From: Roger-luo Date: Sun, 19 Feb 2023 20:34:44 -0500 Subject: [PATCH 03/11] use cargo-llvm-cov --- .github/workflows/main.yml | 47 ++++++++++++-------------------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 061957f..112bab5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,42 +58,23 @@ jobs: command: test coverage: - name: Coverage - strategy: - matrix: - os: [ubuntu-latest] - rust: [stable] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest + env: + CARGO_TERM_COLOR: always steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Setup Julia - uses: ./.github/actions/setup-julia - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - components: llvm-tools-preview - - - uses: Swatinem/rust-cache@v1 - - - name: Download grcov - run: | - mkdir -p "${HOME}/.local/bin" - curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin" - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Run xtask coverage - uses: actions-rs/cargo@v1 - with: - command: xtask - args: coverage - - - name: Upload to codecov.io + - uses: actions/checkout@v3 + - name: Install Rust + run: rustup update stable + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Generate code coverage + run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: - files: coverage/*.lcov + token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + files: lcov.info + fail_ci_if_error: true lints: name: Lints From 8c60bed143f0975847d922a24b06300b3efeb8d3 Mon Sep 17 00:00:00 2001 From: Roger-luo Date: Sun, 19 Feb 2023 20:42:44 -0500 Subject: [PATCH 04/11] fix tests on macos --- tests/bin/template.rs | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/tests/bin/template.rs b/tests/bin/template.rs index d6f3dc5..6f13716 100644 --- a/tests/bin/template.rs +++ b/tests/bin/template.rs @@ -23,41 +23,17 @@ fn test_template() -> Result<()> { Ok(()) } -#[test] -fn test_ctrl_c() -> Result<()> { - // Test escape from input / Ctrl+C behaviour with `ion template inspect` (cf. ask_inspect_input fn) - let mut p = Ion::new() - .arg("template") - .arg("inspect") - .arg("nonce") - .spawn(Some(5_000))?; - - p.send_control('j')?; // skip download if there is - p.read_line()?; // The nonce template was not found. - p.read_line()?; // Installed templates are: - p.read_line()?; // research - p.read_line()?; // project - p.read_line()?; // package - p.send_control('c')?; - p.exp_eof()?; - - Ok(()) -} - #[test] fn test_nonce() -> Result<()> { let mut p = Ion::new() .arg("template") .arg("inspect") .arg("nonce") - .spawn(Some(5_000))?; - - p.send_control('j')?; // skip download if there is - p.exp_string("Installed templates are:")?; + .spawn(Some(30_000))?; + p.send_line("")?; // skip download if there is // Send keycode to pty - p.send_control('j')?; - p.exp_string("name")?; + p.send_line("")?; p.exp_eof()?; Ok(()) From 174751faf852dcd97f5a67d69628670f7f9ccde3 Mon Sep 17 00:00:00 2001 From: Roger-luo Date: Sun, 19 Feb 2023 20:44:22 -0500 Subject: [PATCH 05/11] fixup code coverage --- .github/workflows/main.yml | 4 ++-- .gitignore | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 112bab5..ae4006f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,7 +55,7 @@ jobs: - name: Run cargo test uses: actions-rs/cargo@v1 with: - command: test + command: test --workspace coverage: runs-on: ubuntu-latest @@ -68,7 +68,7 @@ jobs: - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov - name: Generate code coverage - run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + run: cargo llvm-cov --workspace --lcov --output-path lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: diff --git a/.gitignore b/.gitignore index 3ed5b03..d4e9329 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ Cargo.lock /tests/packages/scratch .vscode Manifest.toml -*.profraw \ No newline at end of file +*.profraw +lcov.info From 0b6faa4484033268216dd59559288263e2c22393 Mon Sep 17 00:00:00 2001 From: Roger-luo Date: Sun, 19 Feb 2023 20:45:15 -0500 Subject: [PATCH 06/11] rm julia-semver test --- .github/workflows/semver.yml | 142 ----------------------------------- 1 file changed, 142 deletions(-) delete mode 100644 .github/workflows/semver.yml diff --git a/.github/workflows/semver.yml b/.github/workflows/semver.yml deleted file mode 100644 index c4daa2c..0000000 --- a/.github/workflows/semver.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: Julia Semver -on: - pull_request: - push: - branches: - - main - schedule: - - cron: '00 01 * * *' -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - pre_job: - # continue-on-error: true # Uncomment once integration is finished - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - # All of these options are optional, so you can remove them if you are happy with the defaults - concurrent_skipping: 'never' - skip_after_successful_duplicate: 'true' - paths: '["**/julia-semver"]' - do_not_skip: '["workflow_dispatch", "schedule"]' - - check: - name: Check - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - - uses: Swatinem/rust-cache@v1 - - - name: Run cargo check - uses: actions-rs/cargo@v1 - with: - command: check - args: --package julia-semver - - test: - name: Test Suite - strategy: - matrix: - os: [ubuntu-latest] - rust: [stable] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - override: true - - - uses: Swatinem/rust-cache@v1 - - name: Run cargo test -p julia-semver - uses: actions-rs/cargo@v1 - with: - command: test - args: --package julia-semver - - coverage: - name: Coverage - strategy: - matrix: - os: [ubuntu-latest] - rust: [stable] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Setup Julia - uses: ./.github/actions/setup-julia - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - components: llvm-tools-preview - - - uses: Swatinem/rust-cache@v1 - - - name: Download grcov - run: | - mkdir -p "${HOME}/.local/bin" - curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin" - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Run xtask coverage - uses: actions-rs/cargo@v1 - with: - command: xtask - args: coverage --package julia-semver - - - name: Upload to codecov.io - uses: codecov/codecov-action@v3 - with: - files: coverage/*.lcov - - lints: - name: Lints - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - with: - submodules: true - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt, clippy - - - uses: Swatinem/rust-cache@v1 - - - name: Run cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - - name: Run cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings From 90187baa690e96d807107052136b1c2754b413a2 Mon Sep 17 00:00:00 2001 From: Roger-luo Date: Sun, 19 Feb 2023 20:50:47 -0500 Subject: [PATCH 07/11] fix ci --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ae4006f..983bd25 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,7 +55,8 @@ jobs: - name: Run cargo test uses: actions-rs/cargo@v1 with: - command: test --workspace + command: test + args: --workspace coverage: runs-on: ubuntu-latest From 7dadd77ee5d90aa145f99e64b8ab60851c6d590a Mon Sep 17 00:00:00 2001 From: Roger-luo Date: Sun, 19 Feb 2023 20:51:05 -0500 Subject: [PATCH 08/11] run fmt --- tests/bin/template.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bin/template.rs b/tests/bin/template.rs index 6f13716..de7370b 100644 --- a/tests/bin/template.rs +++ b/tests/bin/template.rs @@ -32,7 +32,7 @@ fn test_nonce() -> Result<()> { .spawn(Some(30_000))?; p.send_line("")?; // skip download if there is - // Send keycode to pty + // Send keycode to pty p.send_line("")?; p.exp_eof()?; From 077cfec72098cf3a4d84bc20597e9b8581df877d Mon Sep 17 00:00:00 2001 From: Roger-luo Date: Sun, 19 Feb 2023 20:51:24 -0500 Subject: [PATCH 09/11] try macos --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 983bd25..40f433d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,7 +35,7 @@ jobs: name: Test Suite strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest] rust: [stable] runs-on: ${{ matrix.os }} steps: From 102dca3098e0b3c748b07f11b88cafc033c70585 Mon Sep 17 00:00:00 2001 From: Roger-luo Date: Sun, 19 Feb 2023 20:58:38 -0500 Subject: [PATCH 10/11] setup julia --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 40f433d..4e974f9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,6 +64,8 @@ jobs: CARGO_TERM_COLOR: always steps: - uses: actions/checkout@v3 + - name: Setup Julia + uses: ./.github/actions/setup-julia - name: Install Rust run: rustup update stable - name: Install cargo-llvm-cov From ea645d1b9b14d8b7db0e315cacca4f4f4e35efff Mon Sep 17 00:00:00 2001 From: Roger-luo Date: Sun, 19 Feb 2023 20:59:38 -0500 Subject: [PATCH 11/11] rm macos --- .github/workflows/main.yml | 2 +- tests/bin/template.rs | 32 ++++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4e974f9..2d845e0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,7 +35,7 @@ jobs: name: Test Suite strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest] rust: [stable] runs-on: ${{ matrix.os }} steps: diff --git a/tests/bin/template.rs b/tests/bin/template.rs index de7370b..d6f3dc5 100644 --- a/tests/bin/template.rs +++ b/tests/bin/template.rs @@ -23,17 +23,41 @@ fn test_template() -> Result<()> { Ok(()) } +#[test] +fn test_ctrl_c() -> Result<()> { + // Test escape from input / Ctrl+C behaviour with `ion template inspect` (cf. ask_inspect_input fn) + let mut p = Ion::new() + .arg("template") + .arg("inspect") + .arg("nonce") + .spawn(Some(5_000))?; + + p.send_control('j')?; // skip download if there is + p.read_line()?; // The nonce template was not found. + p.read_line()?; // Installed templates are: + p.read_line()?; // research + p.read_line()?; // project + p.read_line()?; // package + p.send_control('c')?; + p.exp_eof()?; + + Ok(()) +} + #[test] fn test_nonce() -> Result<()> { let mut p = Ion::new() .arg("template") .arg("inspect") .arg("nonce") - .spawn(Some(30_000))?; + .spawn(Some(5_000))?; + + p.send_control('j')?; // skip download if there is + p.exp_string("Installed templates are:")?; - p.send_line("")?; // skip download if there is - // Send keycode to pty - p.send_line("")?; + // Send keycode to pty + p.send_control('j')?; + p.exp_string("name")?; p.exp_eof()?; Ok(())