ci: Fix broken CI (#1183)

* Fixed building tests
* added `set -eo pipefail` for actually fail pipeline, for some reason it does not work by default
macos-click-through
Serhii Tereshchenko 3 years ago committed by GitHub
parent a7ed6acadd
commit cdf61a970b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -36,7 +36,17 @@ jobs:
NEOVIM_BIN: "C:/tools/neovim/Neovim/bin/nvim.exe" NEOVIM_BIN: "C:/tools/neovim/Neovim/bin/nvim.exe"
RUST_BACKTRACE: full RUST_BACKTRACE: full
run: | run: |
cargo test -- -- -Z unstable-options --format json | cargo2junit > results.xml # Pay attention not to break BUILD stage of a test,
# when tests are failing at BUILD stage, everything after -- is ignored,
# and no json output will be generated.
# Becouse those arguments is passed to compiled test binary. And it is failed to compile.
cargo test -- -Z unstable-options --format json > results.json
# This and `set -eo pipefail` for MacOS/Linux
# is added, becouse without it pipe will eat exit status.
# Docs are stating that it should work by default, but it does not.
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
# Oh, it still does not fail on Windows. ¯\_(ツ)_/¯
cat results.json | cargo2junit > results.xml
- name: Publish Test Results - name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v1 uses: EnricoMi/publish-unit-test-result-action/composite@v1
@ -98,7 +108,8 @@ jobs:
env: env:
RUST_BACKTRACE: full RUST_BACKTRACE: full
run: | run: |
cargo test -- -- -Z unstable-options --format json | cargo2junit > results.xml set -eo pipefail
cargo test -- -Z unstable-options --format json | cargo2junit > results.xml
- name: Publish Test Results - name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v1 uses: EnricoMi/publish-unit-test-result-action/composite@v1
@ -149,10 +160,6 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Update apt
run: |
sudo apt-get update
- name: Install Nightly Toolchain - name: Install Nightly Toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
@ -167,23 +174,23 @@ jobs:
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
- name: Install Dependencies
run: |
sudo apt-get install -y curl gnupg ca-certificates git gcc-multilib g++-multilib cmake libssl-dev pkg-config libfreetype6-dev libasound2-dev libexpat1-dev libxcb-composite0-dev libbz2-dev freeglut3-dev libxi-dev
- name: Check Formatting - name: Check Formatting
run: | run: |
cargo fmt --all -- --check cargo fmt --all -- --check
- name: Install Neovim - name: Install dependencies and neovim
run: | run: |
sudo apt-get install -y neovim sudo apt-get update
sudo apt-get -qq install -y \
curl gnupg ca-certificates git gcc-multilib g++-multilib cmake libssl-dev pkg-config libfreetype6-dev libasound2-dev libexpat1-dev libxcb-composite0-dev libbz2-dev freeglut3-dev libxi-dev\
neovim
- name: Test - name: Test
env: env:
RUST_BACKTRACE: full RUST_BACKTRACE: full
run: | run: |
cargo test -- -- -Z unstable-options --format json | cargo2junit > results.xml set -eo pipefail
cargo test -- -Z unstable-options --format json | cargo2junit > results.xml
- name: Publish Test Results - name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1 uses: EnricoMi/publish-unit-test-result-action@v1

@ -17,7 +17,7 @@ use crate::{
settings::*, settings::*,
}; };
use command::create_nvim_command; pub use command::create_nvim_command;
pub use events::*; pub use events::*;
use handler::NeovimHandler; use handler::NeovimHandler;
use setup::setup_neovide_specific_state; use setup::setup_neovide_specific_state;

@ -325,19 +325,13 @@ impl Window {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::channel_utils::*;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::mpsc::*; use std::sync::mpsc::*;
fn build_test_channels() -> (Receiver<Vec<DrawCommand>>, Arc<DrawCommandBatcher>) { fn build_test_channels() -> (Receiver<Vec<DrawCommand>>, Arc<DrawCommandBatcher>) {
let (batched_draw_command_sender, batched_draw_command_receiver) = channel(); let (_batched_draw_command_sender, batched_draw_command_receiver) = channel();
let logging_batched_draw_command_sender = LoggingSender::attach(
batched_draw_command_sender,
"batched_draw_command".to_owned(),
);
let draw_command_batcher = let draw_command_batcher = Arc::new(DrawCommandBatcher::new());
Arc::new(DrawCommandBatcher::new(logging_batched_draw_command_sender));
(batched_draw_command_receiver, draw_command_batcher) (batched_draw_command_receiver, draw_command_batcher)
} }
@ -353,9 +347,7 @@ mod tests {
(114, 64), (114, 64),
batched_sender.clone(), batched_sender.clone(),
); );
batched_sender batched_sender.send_batch();
.send_batch()
.expect("Could not send batch of commands");
batched_receiver.recv().expect("Could not receive commands"); batched_receiver.recv().expect("Could not receive commands");
window.draw_grid_line( window.draw_grid_line(
@ -371,9 +363,7 @@ mod tests {
assert_eq!(window.grid.get_cell(70, 1), Some(&("|".to_owned(), None))); assert_eq!(window.grid.get_cell(70, 1), Some(&("|".to_owned(), None)));
batched_sender batched_sender.send_batch();
.send_batch()
.expect("Could not send batch of commands");
let sent_commands = batched_receiver.recv().expect("Could not receive commands"); let sent_commands = batched_receiver.recv().expect("Could not receive commands");
assert!(sent_commands.len() != 0); assert!(sent_commands.len() != 0);

Loading…
Cancel
Save