Skip to content

Commit

Permalink
Setup theia folder with example app and config-store skeleton (#389)
Browse files Browse the repository at this point in the history
## Setup new theia folder with example app and config-store extension skeleton

- Create a new root-level folder `theia` for all theia extensions,
  corresponding example extensions and a test browser app.
- The theia folder uses a copied version of the tsconfig and eslint settings of the node folder.
- Initial setup of config-store extension, service and client
- Add license check for theia folder
- Depend on the exact version in the example app to avoid pulling older versions from the registry
- Add Theia CI workflow to build all Theia extensions and the example app
- Add reusable theia extension publish workflow

## Move monitor-theia extension to theia folder and setup Theia CI

- Move monitor-theia extension from node/ to theia/extensions/
- Add monitor-theia to Theia example app
- Adapt monitor theia Demo docker file
- Adapt monitor extension workflow to only do the publishing
  • Loading branch information
lucas-koehler authored Jan 16, 2025
1 parent 99dd2c8 commit 5133b8e
Show file tree
Hide file tree
Showing 60 changed files with 12,810 additions and 51 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ node/**/node_modules/
node/**/build/
node/**/dist/

theia/**/node_modules/
theia/**/lib/
theia/**/src-gen/
theia/**/gen-webpack.*.js

# Java build artifacts
java/**/target/
30 changes: 30 additions & 0 deletions .github/workflows/cd-monitor-theia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "[THEIA] Publish monitor-theia"

on:
push:
branches:
- main
paths:
- "theia/yarn.lock"
- "theia/extensions/monitor-theia/**"
# Publish when a workflow has changed (this is needed to detect version updates)
- ".github/workflows/cd-monitor-theia.yml"
- ".github/workflows/reusable-theia-extension.yml"
release:
types:
- published

permissions:
contents: read
id-token: write

jobs:
run:
uses: ./.github/workflows/reusable-theia-extension.yml
permissions:
contents: read
id-token: write
with:
package_workspace: extensions/monitor-theia
secrets:
npm-token: ${{ secrets.NPM_TOKEN }}
32 changes: 0 additions & 32 deletions .github/workflows/ci-monitor-theia.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/ci-theia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Builds all theia extensions as well as the example extensions and example browser app.
name: "[THEIA] CI"

on:
push:
branches:
- main
paths:
- ".github/workflows/ci-theia.yml"
- "theia/**/*"
- "!theia/**/*.md"
pull_request:
branches:
- main
paths:
- ".github/workflows/ci-theia.yml"
- "theia/**/*"
- "!theia/**/*.md"

permissions:
contents: read

jobs:
build:
name: Build & Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./theia

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
cache-dependency-path: theia/yarn.lock

- name: Install dependencies
run: |
sudo apt-get install libsecret-1-dev
yarn --frozen-lockfile
- name: Build
run: yarn build

- name: Lint
run: yarn lint
12 changes: 11 additions & 1 deletion .github/workflows/eclipse-npm-license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
distribution: "adopt"
java-version: ${{ matrix.java }}

- name: Run dash-licenses
- name: Run node dash-licenses
shell: bash
run: |
sudo apt-get install libsecret-1-dev
Expand All @@ -51,3 +51,13 @@ jobs:
npm run license:check
env:
DASH_TOKEN: ${{ secrets.DASH_LICENSES_PAT }}

- name: Run theia dash-licenses
shell: bash
run: |
sudo apt-get install libsecret-1-dev
cd theia
yarn --frozen-lockfile --ignore-scripts
yarn license:check
env:
DASH_TOKEN: ${{ secrets.DASH_LICENSES_PAT }}
65 changes: 65 additions & 0 deletions .github/workflows/reusable-theia-extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Reusable workflow for publishing theia extensions

on:
workflow_call:
inputs:
package_workspace:
required: true
type: string
description: The package's workspace path relative to the node directory.
secrets:
npm-token:
required: true

permissions:
contents: read
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'release'
defaults:
run:
working-directory: ./theia
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Check version (only for push events)
if: github.event_name == 'push'
id: version_check
run: |
VERSION=$(cd extensions/${{ inputs.package_workspace }} && node --print "require('./package.json').version")
echo "Package version: ${VERSION}"
if [[ $VERSION == *"-next" ]]; then
echo "is_next_version=true" >> $GITHUB_OUTPUT
else
echo "is_next_version=false" >> $GITHUB_OUTPUT
fi
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: |
sudo apt-get install libsecret-1-dev
yarn --frozen-lockfile
# Publish the package to the npm registry. The publish command also builds the package via the prepublishOnly lifecycle script.
- name: Publish next version
if: github.event_name == 'push' && steps.version_check.outputs.is_next_version == 'true'
run: npm run publish:next -w ${{ inputs.package_workspace }}
env:
NODE_AUTH_TOKEN: ${{ secrets.npm-token }}
NPM_CONFIG_PROVENANCE: true

- name: Publish latest version
if: github.event_name == 'release'
run: npm run publish:latest -w ${{ inputs.package_workspace }}
env:
NODE_AUTH_TOKEN: ${{ secrets.npm-token }}
NPM_CONFIG_PROVENANCE: true
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,25 @@
"request": "attach",
"hostName": "localhost",
"port": 5005
},
{
"type": "node",
"request": "launch",
"name": "Debug Theia Example Browser Backend",
"program": "${workspaceRoot}/theia/examples/browser-app/src-gen/backend/main.js",
"args": ["--loglevel=debug", "--port=3000", "--no-cluster"],
"env": {
"NODE_ENV": "development"
},
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/theia/node_modules/@theia/*/lib/**/*.js",
"${workspaceRoot}/theia/*/lib/**/*.js",
"${workspaceRoot}/theia/examples/browser-app/src-gen/**/*.js"
],
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "std"
}
],
"inputs": [
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## [1.1.0] - estimated 2025-02

- [theia] Introduce new folder `theia` for all theia extensions and an example app to test these [#389](https://github.com/eclipse-theia/theia-cloud/pull/389)
- [node/monitor-theia] Move Theia monitor extension to `theia/extensions/monitor-theia` [#389](https://github.com/eclipse-theia/theia-cloud/pull/389)
- [theia/extensions/monitor-theia] Update Theia dependencies to `^1.55.0` [#389](https://github.com/eclipse-theia/theia-cloud/pull/389)
- [ci] Add Theia CI workflow, add reusable Theia extension publish workflow [#389](https://github.com/eclipse-theia/theia-cloud/pull/388)

## [1.0.0] - 2024-11-29

- [java/operator] Add Theia Cloud Labels on Resources created by operator [#362](https://github.com/eclipse-theia/theia-cloud/pull/362)
Expand Down
10 changes: 5 additions & 5 deletions demo/dockerfiles/demo-theia-monitor-theia/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:20-bookworm as build-stage
FROM node:20-bookworm AS build-stage
RUN apt-get update && apt-get install -y libxkbfile-dev libsecret-1-dev
WORKDIR /home/theia
ADD demo/dockerfiles/demo-theia-monitor-theia/package.json ./package.json

## Link package from local
ADD node ./node
WORKDIR /home/theia/node
RUN npm ci && npm run build -w monitor-theia
ADD theia ./theia
WORKDIR /home/theia/theia
RUN yarn --frozen-lockfile --ignore-scripts && yarn build:workspace @eclipse-theiacloud/monitor-theia
WORKDIR /home/theia

RUN yarn --pure-lockfile && \
Expand All @@ -21,7 +21,7 @@ RUN yarn --pure-lockfile && \
yarn autoclean --force && \
yarn cache clean

FROM node:20-bookworm-slim as production-stage
FROM node:20-bookworm-slim AS production-stage

# Use fixed user id 101 to guarantee it matches the app definition
RUN adduser --system --group --uid 101 theia
Expand Down
2 changes: 1 addition & 1 deletion demo/dockerfiles/demo-theia-monitor-theia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@theia/variable-resolver": "1.56.0",
"@theia/vsx-registry": "1.56.0",
"@theia/workspace": "1.56.0",
"@eclipse-theiacloud/monitor-theia": "file:node/monitor-theia"
"@eclipse-theiacloud/monitor-theia": "file:theia/extensions/monitor-theia"
},
"devDependencies": {
"@theia/cli": "1.56.0"
Expand Down
2 changes: 1 addition & 1 deletion node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
},
"workspaces": [
"common",
"config-store",
"landing-page",
"monitor-theia",
"testing-page"
]
}
7 changes: 1 addition & 6 deletions node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
"compilerOptions": {
"baseUrl": "."
},
"include": [
"common/src",
"landing-page/src",
"monitor/src",
"monitor-theia/src"
],
"include": ["common/src", "config-store/src", "landing-page/src", "monitor/src"],
"exclude": ["node_modules"]
}
18 changes: 18 additions & 0 deletions theia/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
extends: [
'./configs/base.eslintrc.json',
'./configs/warnings.eslintrc.json',
'./configs/errors.eslintrc.json',
],
parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.json',
},
settings: {
"react": {
"version": "detect"
}
}
};
2 changes: 2 additions & 0 deletions theia/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
lib
19 changes: 19 additions & 0 deletions theia/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
$schema: 'http://json.schemastore.org/prettierrc',
singleQuote: true,
jsxSingleQuote: true,
arrowParens: 'avoid',
trailingComma: 'none',
endOfLine: 'lf',
printWidth: 120,
tabWidth: 2,
overrides: [
{
files: ['*.json', '*.yml'],
options: {
printWidth: 100,
tabWidth: 2
}
}
]
};
Loading

0 comments on commit 5133b8e

Please sign in to comment.