Build Code Editor Targets #81
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Code Editor Targets | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| - '*.*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build Code Editor Targets | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| build-target: [code-editor-server, code-editor-sagemaker-server, code-editor-web-embedded, code-editor-web-embedded-with-terminal] | |
| steps: | |
| - name: Start Build Workflow | |
| env: | |
| BUILD_TARGET: ${{ matrix.build-target }} | |
| run: | | |
| echo "Starting Build Workflow for target: $BUILD_TARGET" | |
| - name: Set up build environment | |
| run: | | |
| echo "Installing required dependencies" | |
| sudo apt-get update | |
| sudo apt-get install -y quilt libkrb5-dev libx11-dev libxkbfile-dev libxml2-utils | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Run patches script | |
| env: | |
| BUILD_TARGET: ${{ matrix.build-target }} | |
| run: | | |
| ./scripts/prepare-src.sh "$BUILD_TARGET" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: 'code-editor-src/package-lock.json' | |
| - name: Install code editor dependencies | |
| run: | | |
| cd code-editor-src | |
| echo "Installing dependencies" && npm ci | |
| - name: Build artifacts | |
| env: | |
| BUILD_TARGET: ${{ matrix.build-target }} | |
| run: | | |
| ./scripts/build-artifacts.sh "$BUILD_TARGET" | |
| - name: Prepare artifacts to upload | |
| env: | |
| MATRIX_BUILD_TARGET: ${{ matrix.build-target }} | |
| run: | | |
| CODE_EDITOR_BUILD_TARGET=$(./scripts/determine-build-target.sh "$MATRIX_BUILD_TARGET") | |
| tar -czf "${MATRIX_BUILD_TARGET}-src.tar.gz" ./code-editor-src | |
| tar -czf "${MATRIX_BUILD_TARGET}-build.tar.gz" "./$CODE_EDITOR_BUILD_TARGET" | |
| - name: Upload src artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ github.sha }}-${{ matrix.build-target }}-src | |
| path: ${{ matrix.build-target }}-src.tar.gz | |
| retention-days: 90 | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ github.sha }}-${{ matrix.build-target }}-build | |
| path: ${{ matrix.build-target }}-build.tar.gz | |
| retention-days: 90 | |
| handle-failures: | |
| name: Handle Failures | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: build-targets-workflow-env | |
| if: failure() | |
| permissions: | |
| id-token: write # Required for OIDC | |
| env: | |
| REPOSITORY: ${{ github.repository }} | |
| AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
| steps: | |
| - name: Use role credentials for metrics | |
| id: aws-creds | |
| continue-on-error: ${{ env.REPOSITORY != 'aws/code-editor' }} | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }} | |
| aws-region: us-east-1 | |
| - name: Report failure | |
| if: steps.aws-creds.outcome == 'success' | |
| run: | | |
| aws cloudwatch put-metric-data \ | |
| --namespace "GitHub/Workflows" \ | |
| --metric-name "ExecutionsFailed" \ | |
| --dimensions "Repository=$REPOSITORY,Workflow=BuildTargets" \ | |
| --value 1 |