Skip to content

Commit 0cd0921

Browse files
committed
feat: deploy ydoc on ci
1 parent 080d0a7 commit 0cd0921

File tree

3 files changed

+151
-16
lines changed

3 files changed

+151
-16
lines changed

.github/workflows/release.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,112 @@ jobs:
100100
env:
101101
ENSO_RELEASE_ID: ${{ needs.enso-build-ci-gen-draft-release-linux-amd64.outputs.ENSO_RELEASE_ID }}
102102
ENSO_VERSION: ${{ needs.enso-build-ci-gen-draft-release-linux-amd64.outputs.ENSO_VERSION }}
103+
enso-build-ci-gen-job-deploy-ydoc-nodejs-linux-amd64:
104+
name: Upload Node.js Ydoc to ECR (linux, amd64)
105+
needs:
106+
- enso-build-ci-gen-draft-release-linux-amd64
107+
- enso-build-ci-gen-job-upload-backend-linux-amd64
108+
runs-on:
109+
- self-hosted
110+
- Linux
111+
steps:
112+
- if: startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')
113+
name: Installing wasm-pack
114+
uses: jetli/[email protected]
115+
with:
116+
version: v0.12.1
117+
- name: Expose Artifact API and context information.
118+
uses: actions/github-script@v7
119+
with:
120+
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 "
121+
- name: Checking out the repository
122+
uses: actions/checkout@v4
123+
with:
124+
clean: false
125+
submodules: recursive
126+
- name: Build Script Setup
127+
run: ./run --help || (git clean -ffdx && ./run --help)
128+
env:
129+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130+
- if: "(contains(github.event.pull_request.labels.*.name, 'CI: Clean build required') || inputs.clean_build_required)"
131+
name: Clean before
132+
run: ./run git-clean
133+
env:
134+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135+
- run: ./run release deploy-ydoc-nodejs
136+
env:
137+
AWS_ACCESS_KEY_ID: ${{ secrets.ECR_PUSH_RUNTIME_ACCESS_KEY_ID }}
138+
AWS_DEFAULT_REGION: eu-west-1
139+
AWS_SECRET_ACCESS_KEY: ${{ secrets.ECR_PUSH_RUNTIME_SECRET_ACCESS_KEY }}
140+
ENSO_BUILD_ECR_REPOSITORY: runtime
141+
GITHUB_TOKEN: ${{ secrets.CI_PRIVATE_TOKEN }}
142+
- if: failure() && runner.os == 'Windows'
143+
name: List files if failed (Windows)
144+
run: Get-ChildItem -Force -Recurse
145+
- if: failure() && runner.os != 'Windows'
146+
name: List files if failed (non-Windows)
147+
run: ls -lAR
148+
- if: "(always()) && (contains(github.event.pull_request.labels.*.name, 'CI: Clean build required') || inputs.clean_build_required)"
149+
name: Clean after
150+
run: ./run git-clean
151+
env:
152+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153+
env:
154+
ENSO_RELEASE_ID: ${{ needs.enso-build-ci-gen-draft-release-linux-amd64.outputs.ENSO_RELEASE_ID }}
155+
ENSO_VERSION: ${{ needs.enso-build-ci-gen-draft-release-linux-amd64.outputs.ENSO_VERSION }}
156+
enso-build-ci-gen-job-deploy-ydoc-polyglot-linux-amd64:
157+
name: Upload polyglot Ydoc to ECR (linux, amd64)
158+
needs:
159+
- enso-build-ci-gen-draft-release-linux-amd64
160+
- enso-build-ci-gen-job-upload-backend-linux-amd64
161+
runs-on:
162+
- self-hosted
163+
- Linux
164+
steps:
165+
- if: startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')
166+
name: Installing wasm-pack
167+
uses: jetli/[email protected]
168+
with:
169+
version: v0.12.1
170+
- name: Expose Artifact API and context information.
171+
uses: actions/github-script@v7
172+
with:
173+
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 "
174+
- name: Checking out the repository
175+
uses: actions/checkout@v4
176+
with:
177+
clean: false
178+
submodules: recursive
179+
- name: Build Script Setup
180+
run: ./run --help || (git clean -ffdx && ./run --help)
181+
env:
182+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
183+
- if: "(contains(github.event.pull_request.labels.*.name, 'CI: Clean build required') || inputs.clean_build_required)"
184+
name: Clean before
185+
run: ./run git-clean
186+
env:
187+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
188+
- run: ./run release deploy-ydoc-polyglot
189+
env:
190+
AWS_ACCESS_KEY_ID: ${{ secrets.ECR_PUSH_RUNTIME_ACCESS_KEY_ID }}
191+
AWS_DEFAULT_REGION: eu-west-1
192+
AWS_SECRET_ACCESS_KEY: ${{ secrets.ECR_PUSH_RUNTIME_SECRET_ACCESS_KEY }}
193+
ENSO_BUILD_ECR_REPOSITORY: runtime
194+
GITHUB_TOKEN: ${{ secrets.CI_PRIVATE_TOKEN }}
195+
- if: failure() && runner.os == 'Windows'
196+
name: List files if failed (Windows)
197+
run: Get-ChildItem -Force -Recurse
198+
- if: failure() && runner.os != 'Windows'
199+
name: List files if failed (non-Windows)
200+
run: ls -lAR
201+
- if: "(always()) && (contains(github.event.pull_request.labels.*.name, 'CI: Clean build required') || inputs.clean_build_required)"
202+
name: Clean after
203+
run: ./run git-clean
204+
env:
205+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
206+
env:
207+
ENSO_RELEASE_ID: ${{ needs.enso-build-ci-gen-draft-release-linux-amd64.outputs.ENSO_RELEASE_ID }}
208+
ENSO_VERSION: ${{ needs.enso-build-ci-gen-draft-release-linux-amd64.outputs.ENSO_VERSION }}
103209
enso-build-ci-gen-job-upload-backend-linux-amd64:
104210
name: Upload Backend (linux, amd64)
105211
needs:
@@ -297,6 +403,8 @@ jobs:
297403
needs:
298404
- enso-build-ci-gen-draft-release-linux-amd64
299405
- enso-build-ci-gen-job-deploy-runtime-linux-amd64
406+
- enso-build-ci-gen-job-deploy-ydoc-nodejs-linux-amd64
407+
- enso-build-ci-gen-job-deploy-ydoc-polyglot-linux-amd64
300408
- enso-build-ci-gen-upload-ide-linux-amd64
301409
- enso-build-ci-gen-upload-ide-macos-aarch64
302410
- enso-build-ci-gen-upload-ide-macos-amd64

build/build/src/ci_gen.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,12 @@ fn add_release_steps(workflow: &mut Workflow) -> Result {
523523
let upload_runtime_job_id =
524524
workflow.add_dependent(target, job::DeployRuntime, runtime_requirements);
525525
packaging_job_ids.push(upload_runtime_job_id);
526+
let upload_ydoc_polyglot_job_id =
527+
workflow.add_dependent(target, job::DeployYdocPolyglot, runtime_requirements);
528+
packaging_job_ids.push(upload_ydoc_polyglot_job_id);
529+
let upload_ydoc_nodejs_job_id =
530+
workflow.add_dependent(target, job::DeployYdocNodejs, runtime_requirements);
531+
packaging_job_ids.push(upload_ydoc_nodejs_job_id);
526532
}
527533
}
528534

build/build/src/ci_gen/job.rs

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -452,25 +452,46 @@ pub struct DeployRuntime;
452452

453453
impl JobArchetype for DeployRuntime {
454454
fn job(&self, target: Target) -> Job {
455-
RunStepsBuilder::new("release deploy-runtime")
456-
.customize(|step| {
457-
vec![step
458-
.with_secret_exposed_as(secret::CI_PRIVATE_TOKEN, ide_ci::github::GITHUB_TOKEN)
459-
.with_env("ENSO_BUILD_ECR_REPOSITORY", crate::aws::ecr::runtime::NAME)
460-
.with_secret_exposed_as(
461-
secret::ECR_PUSH_RUNTIME_ACCESS_KEY_ID,
462-
"AWS_ACCESS_KEY_ID",
463-
)
464-
.with_secret_exposed_as(
465-
secret::ECR_PUSH_RUNTIME_SECRET_ACCESS_KEY,
466-
"AWS_SECRET_ACCESS_KEY",
467-
)
468-
.with_env("AWS_DEFAULT_REGION", crate::aws::ecr::runtime::REGION)]
469-
})
470-
.build_job("Upload Runtime to ECR", target)
455+
ecr_deploy_steps_builder("release deploy-runtime").build_job("Upload Runtime to ECR", target)
456+
}
457+
}
458+
459+
#[derive(Clone, Copy, Debug)]
460+
pub struct DeployYdocPolyglot;
461+
462+
impl JobArchetype for DeployYdocPolyglot {
463+
fn job(&self, target: Target) -> Job {
464+
ecr_deploy_steps_builder("release deploy-ydoc-polyglot").build_job("Upload polyglot Ydoc to ECR", target)
471465
}
472466
}
473467

468+
#[derive(Clone, Copy, Debug)]
469+
pub struct DeployYdocNodejs;
470+
471+
impl JobArchetype for DeployYdocNodejs {
472+
fn job(&self, target: Target) -> Job {
473+
ecr_deploy_steps_builder("release deploy-ydoc-nodejs").build_job("Upload Node.js Ydoc to ECR", target)
474+
}
475+
}
476+
477+
fn ecr_deploy_steps_builder(run_command: impl Into<String>) -> RunStepsBuilder {
478+
RunStepsBuilder::new(run_command)
479+
.customize(|step| {
480+
vec![step
481+
.with_secret_exposed_as(secret::CI_PRIVATE_TOKEN, ide_ci::github::GITHUB_TOKEN)
482+
.with_env("ENSO_BUILD_ECR_REPOSITORY", crate::aws::ecr::runtime::NAME)
483+
.with_secret_exposed_as(
484+
secret::ECR_PUSH_RUNTIME_ACCESS_KEY_ID,
485+
"AWS_ACCESS_KEY_ID",
486+
)
487+
.with_secret_exposed_as(
488+
secret::ECR_PUSH_RUNTIME_SECRET_ACCESS_KEY,
489+
"AWS_SECRET_ACCESS_KEY",
490+
)
491+
.with_env("AWS_DEFAULT_REGION", crate::aws::ecr::runtime::REGION)]
492+
})
493+
}
494+
474495
pub fn expose_os_specific_signing_secret(os: OS, step: Step) -> Step {
475496
match os {
476497
OS::Windows => step

0 commit comments

Comments
 (0)