diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5cfd918e13a..28f61275797 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -187,12 +187,6 @@ jobs: with: key: ubuntu-latest cache-on-failure: true - - uses: actions/setup-go@v3 - with: - go-version: "1.18.0" - - run: | - cd mirrord-layer/tests/apps/app_go - go build -o 18 - uses: actions/setup-go@v3 with: go-version: "1.19.0" diff --git a/mirrord-layer/tests/integration.rs b/mirrord-layer/tests/integration.rs index 2c74a633fe3..1e74d43b58e 100644 --- a/mirrord-layer/tests/integration.rs +++ b/mirrord-layer/tests/integration.rs @@ -1,4 +1,11 @@ -use std::{collections::HashMap, path::PathBuf, process::Stdio, time::Duration}; +use std::{ + collections::HashMap, + env, + path::{Path, PathBuf}, + process, + process::Stdio, + time::Duration, +}; use actix_codec::Framed; use futures::{stream::StreamExt, SinkExt}; @@ -182,6 +189,21 @@ impl Application { } } +/// For running locally, so that new developers don't have the extra step of building the go app +/// before running the tests. +#[cfg(test)] +#[ctor::ctor] +fn build_go_app() { + let original_dir = env::current_dir().unwrap(); + let go_app_path = Path::new("tests/apps/app_go"); + env::set_current_dir(go_app_path).unwrap(); + let server = process::Command::new("go") + .args(vec!["build", "-o", "19"]) + .output() + .expect("Failed to build Go test app."); + env::set_current_dir(original_dir).unwrap(); +} + /// Return the path to the existing layer lib, or build it first and return the path, according to /// whether the environment variable MIRRORD_TEST_USE_EXISTING_LIB is set. /// When testing locally the lib should be rebuilt on each run so that when developers make changes