Skip to content

Commit

Permalink
Run Enso Cloud tests on the CI (#10964)
Browse files Browse the repository at this point in the history
- Closes #9523
  • Loading branch information
radeusgd authored Sep 4, 2024
1 parent 26678f3 commit 0543a69
Show file tree
Hide file tree
Showing 9 changed files with 378 additions and 13 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/extra-nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./run backend test std-snowflake
env:
ENSO_CLOUD_COGNITO_REGION: ${{ secrets.ENSO_CLOUD_COGNITO_REGION }}
ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ secrets.ENSO_CLOUD_COGNITO_USER_POOL_ID }}
ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ secrets.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }}
ENSO_CLOUD_TEST_ACCOUNT_PASSWORD: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_PASSWORD }}
ENSO_CLOUD_TEST_ACCOUNT_USERNAME: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_USERNAME }}
ENSO_SNOWFLAKE_ACCOUNT: ${{ secrets.ENSO_SNOWFLAKE_ACCOUNT }}
ENSO_SNOWFLAKE_DATABASE: ${{ secrets.ENSO_SNOWFLAKE_DATABASE }}
ENSO_SNOWFLAKE_PASSWORD: ${{ secrets.ENSO_SNOWFLAKE_PASSWORD }}
Expand Down Expand Up @@ -75,5 +80,69 @@ jobs:
GRAAL_EDITION: GraalVM CE
permissions:
checks: write
enso-build-ci-gen-job-standard-library-tests-graal-vm-ce-linux-amd64:
name: Standard Library Tests (GraalVM CE) (linux, amd64)
runs-on:
- self-hosted
- Linux
steps:
- if: startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')
name: Installing wasm-pack
uses: jetli/[email protected]
with:
version: v0.10.2
- name: Expose Artifact API and context information.
uses: actions/github-script@v7
with:
script: "\n core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\n core.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\n core.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])\n console.log(context)\n "
- name: Checking out the repository
uses: actions/checkout@v4
with:
clean: false
submodules: recursive
- name: Build Script Setup
run: ./run --help || (git clean -ffdx && ./run --help)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: "(contains(github.event.pull_request.labels.*.name, 'CI: Clean build required') || inputs.clean_build_required)"
name: Clean before
run: ./run git-clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./run backend test standard-library
env:
ENSO_CLOUD_COGNITO_REGION: ${{ secrets.ENSO_CLOUD_COGNITO_REGION }}
ENSO_CLOUD_COGNITO_USER_POOL_ID: ${{ secrets.ENSO_CLOUD_COGNITO_USER_POOL_ID }}
ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: ${{ secrets.ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID }}
ENSO_CLOUD_TEST_ACCOUNT_PASSWORD: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_PASSWORD }}
ENSO_CLOUD_TEST_ACCOUNT_USERNAME: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_USERNAME }}
ENSO_LIB_S3_AWS_ACCESS_KEY_ID: ${{ secrets.ENSO_LIB_S3_AWS_ACCESS_KEY_ID }}
ENSO_LIB_S3_AWS_REGION: ${{ secrets.ENSO_LIB_S3_AWS_REGION }}
ENSO_LIB_S3_AWS_SECRET_ACCESS_KEY: ${{ secrets.ENSO_LIB_S3_AWS_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: (success() || failure()) && github.event.pull_request.head.repo.full_name == github.repository
name: Standard Library Test Reporter
uses: dorny/test-reporter@v1
with:
max-annotations: 50
name: Standard Library Tests Report (GraalVM CE, linux, amd64)
path: ${{ env.ENSO_TEST_JUNIT_DIR }}/*/*.xml
path-replace-backslashes: true
reporter: java-junit
- if: failure() && runner.os == 'Windows'
name: List files if failed (Windows)
run: Get-ChildItem -Force -Recurse
- if: failure() && runner.os != 'Windows'
name: List files if failed (non-Windows)
run: ls -lAR
- if: "(always()) && (contains(github.event.pull_request.labels.*.name, 'CI: Clean build required') || inputs.clean_build_required)"
name: Clean after
run: ./run git-clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
env:
GRAAL_EDITION: GraalVM CE
permissions:
checks: write
env:
ENSO_BUILD_SKIP_VERSION_CHECK: "true"
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"rust-analyzer.linkedProjects": [
"./app/gui2/rust-ffi/Cargo.toml"
"./app/rust-ffi/Cargo.toml"
],
"vue.complete.casing.status": false,
"vue.complete.casing.props": "camel",
Expand All @@ -19,7 +19,7 @@
},
"eslint.workingDirectories": [
"./app/gui2",
"./app/gui2/ide-desktop"
"./app/ide-desktop"
],
"files.watcherExclude": {
"**/target": true
Expand Down
13 changes: 12 additions & 1 deletion build/build/src/ci_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ pub mod secret {
/// Static token for admin requests on our Lambdas.
pub const ENSO_ADMIN_TOKEN: &str = "ENSO_ADMIN_TOKEN";

// === Enso Cloud Test Account ===
pub const ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID: &str =
"ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID";
pub const ENSO_CLOUD_COGNITO_USER_POOL_ID: &str = "ENSO_CLOUD_COGNITO_USER_POOL_ID";
pub const ENSO_CLOUD_COGNITO_REGION: &str = "ENSO_CLOUD_COGNITO_REGION";
pub const ENSO_CLOUD_TEST_ACCOUNT_USERNAME: &str = "ENSO_CLOUD_TEST_ACCOUNT_USERNAME";
pub const ENSO_CLOUD_TEST_ACCOUNT_PASSWORD: &str = "ENSO_CLOUD_TEST_ACCOUNT_PASSWORD";

// === Apple Code Signing & Notarization ===
pub const APPLE_CODE_SIGNING_CERT: &str = "APPLE_CODE_SIGNING_CERT";
Expand Down Expand Up @@ -538,7 +545,7 @@ pub fn add_backend_checks(
) {
workflow.add(target, job::CiCheckBackend { graal_edition });
workflow.add(target, job::JvmTests { graal_edition });
workflow.add(target, job::StandardLibraryTests { graal_edition });
workflow.add(target, job::StandardLibraryTests { graal_edition, cloud_tests_enabled: false });
}

pub fn workflow_call_job(name: impl Into<String>, path: impl Into<String>) -> Job {
Expand Down Expand Up @@ -702,6 +709,10 @@ pub fn extra_nightly_tests() -> Result<Workflow> {
// behavior.
let target = (OS::Linux, Arch::X86_64);
workflow.add(target, job::SnowflakeTests {});
workflow.add(target, job::StandardLibraryTests {
graal_edition: graalvm::Edition::Community,
cloud_tests_enabled: true,
});
Ok(workflow)
}

Expand Down
41 changes: 38 additions & 3 deletions build/build/src/ci_gen/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,39 @@ impl JobArchetype for JvmTests {
}
}

fn enable_cloud_tests(step: Step) -> Step {
step.with_secret_exposed_as(
secret::ENSO_CLOUD_COGNITO_USER_POOL_ID,
crate::cloud_tests::env::ci_config::ENSO_CLOUD_COGNITO_USER_POOL_ID,
)
.with_secret_exposed_as(
secret::ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID,
crate::cloud_tests::env::ci_config::ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID,
)
.with_secret_exposed_as(
secret::ENSO_CLOUD_COGNITO_REGION,
crate::cloud_tests::env::ci_config::ENSO_CLOUD_COGNITO_REGION,
)
.with_secret_exposed_as(
secret::ENSO_CLOUD_TEST_ACCOUNT_USERNAME,
crate::cloud_tests::env::ci_config::ENSO_CLOUD_TEST_ACCOUNT_USERNAME,
)
.with_secret_exposed_as(
secret::ENSO_CLOUD_TEST_ACCOUNT_PASSWORD,
crate::cloud_tests::env::ci_config::ENSO_CLOUD_TEST_ACCOUNT_PASSWORD,
)
}

#[derive(Clone, Copy, Debug)]
pub struct StandardLibraryTests {
pub graal_edition: graalvm::Edition,
pub graal_edition: graalvm::Edition,
pub cloud_tests_enabled: bool,
}

impl JobArchetype for StandardLibraryTests {
fn job(&self, target: Target) -> Job {
let graal_edition = self.graal_edition;
let should_enable_cloud_tests = self.cloud_tests_enabled;
let job_name = format!("Standard Library Tests ({graal_edition})");
let mut job = RunStepsBuilder::new("backend test standard-library")
.customize(move |step| {
Expand All @@ -235,7 +260,14 @@ impl JobArchetype for StandardLibraryTests {
secret::ENSO_LIB_S3_AWS_SECRET_ACCESS_KEY,
crate::libraries_tests::s3::env::ENSO_LIB_S3_AWS_SECRET_ACCESS_KEY,
);
vec![main_step, step::stdlib_test_reporter(target, graal_edition)]

let updated_main_step = if should_enable_cloud_tests {
enable_cloud_tests(main_step)
} else {
main_step
};

vec![updated_main_step, step::stdlib_test_reporter(target, graal_edition)]
})
.build_job(job_name, target)
.with_permission(Permission::Checks, Access::Write);
Expand Down Expand Up @@ -291,8 +323,11 @@ impl JobArchetype for SnowflakeTests {
secret::ENSO_SNOWFLAKE_WAREHOUSE,
crate::libraries_tests::snowflake::env::ENSO_SNOWFLAKE_WAREHOUSE,
);

let updated_main_step = enable_cloud_tests(main_step);

vec![
main_step,
updated_main_step,
step::extra_stdlib_test_reporter(target, GRAAL_EDITION_FOR_EXTRA_TESTS),
]
})
Expand Down
39 changes: 39 additions & 0 deletions build/build/src/cloud_tests/env.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//! Environment variables commonly used by AWS services.
use ide_ci::define_env_var;

pub mod ci_config {
use super::*;

define_env_var! {
/// Username for an Enso Cloud account used for running Cloud integration tests.
ENSO_CLOUD_TEST_ACCOUNT_USERNAME, String;

/// Password for an Enso Cloud account used for running Cloud integration tests.
ENSO_CLOUD_TEST_ACCOUNT_PASSWORD, String;

// The Client ID of the User Pool for Enso Cloud Cognito auth flow.
ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID, String;

// The User Pool ID for Enso Cloud Cognito auth flow.
ENSO_CLOUD_COGNITO_USER_POOL_ID, String;

// The Region used for Cognito auth flow.
ENSO_CLOUD_COGNITO_REGION, String;
}
}

pub mod test_controls {
use super::*;

define_env_var! {
/// Locates an Enso Cloud credentials file used in tests.
ENSO_CLOUD_CREDENTIALS_FILE, String;

/// Denotes the URI of the Enso Cloud API deployment to be used in tests.
ENSO_CLOUD_API_URI, String;

/// A flag that tells the test suite to run applicable tests on the cloud environment instead of just a mock.
ENSO_RUN_REAL_CLOUD_TEST, String;
}
}
Loading

0 comments on commit 0543a69

Please sign in to comment.