Skip to content

Commit

Permalink
Move monitor-theia extension to theia folder and setup Theia CI
Browse files Browse the repository at this point in the history
- Move monitor-theia extension from node/ to theia/extensions/
- Add monitor-theia to Theia example app
- Adapt monitor theia Demo docker file
- Add Theia CI workflow to build all Theia extensions and the example app
- Add reusable theia extension publish workflow
- Adapt monitor extension workflow to only do the publishing
  • Loading branch information
lucas-koehler committed Dec 20, 2024
1 parent b389707 commit a569e94
Show file tree
Hide file tree
Showing 31 changed files with 814 additions and 64 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
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

## [1.1.0] - estimated 2025-02

- [theia] Introduce new folder `theia` for all theia extensions and an example app to test these.
- [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
1 change: 0 additions & 1 deletion node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"common",
"config-store",
"landing-page",
"monitor-theia",
"testing-page"
]
}
8 changes: 1 addition & 7 deletions node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
"compilerOptions": {
"baseUrl": "."
},
"include": [
"common/src",
"config-store/src",
"landing-page/src",
"monitor/src",
"monitor-theia/src"
],
"include": ["common/src", "config-store/src", "landing-page/src", "monitor/src"],
"exclude": ["node_modules"]
}
1 change: 1 addition & 0 deletions theia/examples/browser-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@theia/terminal": "1.55.0",
"@theia/workspace": "1.55.0",
"@eclipse-theiacloud/config-store": "^1.0.0",
"@eclipse-theiacloud/monitor-theia": "^1.0.0",
"config-store-example": "0.0.0"
},
"devDependencies": {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@
"src"
],
"peerDependencies": {
"@theia/core": "^1.34.0",
"@theia/plugin-ext": "^1.34.0"
"@theia/core": "^1.55.0",
"@theia/plugin-ext": "^1.55.0"
},
"devDependencies": {
"rimraf": "^3.0.2"
"@theia/core": "^1.55.0",
"@theia/plugin-ext": "^1.55.0",
"rimraf": "^6.0.1",
"typescript": "~5.4.5"
},
"scripts": {
"prepare": "npm run clean && npm run build",
"clean": "rimraf lib",
"build": "tsc",
"watch": "tsc -w",
"lint": "eslint -c ../.eslintrc.js --ext .ts ./src",
"lint": "eslint -c ../../.eslintrc.js --ext .ts ./src",
"prepublishOnly": "npm run build",
"publish:next": "npm pkg set version=`node --print \"require('./package.json').version\"`.`git rev-parse --short HEAD` && npm publish --tag next",
"publish:latest": "npm publish --tag latest"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../tsconfig.json",
"extends": "../../tsconfig.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib"
Expand Down
8 changes: 6 additions & 2 deletions theia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
},
"scripts": {
"prepare": "lerna run prepare --loglevel=verbose",
"build": "lerna run clean && lerna run build",
"build": "yarn clean && lerna run build",
"build:workspace": "lerna run build --scope",
"clean": "lerna run clean",
"clean:workspace": "lerna run clean --scope",
"example-app": "yarn --cwd examples/browser-app",
"lint": "lerna run lint",
"start": "yarn example-app start",
Expand All @@ -34,7 +37,8 @@
"workspaces": [
"examples/browser-app",
"examples/config-store-example",
"extensions/config-store"
"extensions/config-store",
"extensions/monitor-theia"
],
"resolutions": {
"inversify": "6.0.3"
Expand Down
3 changes: 2 additions & 1 deletion theia/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
},
"include": [
"examples/config-store-example/src",
"extensions/config-store/src"
"extensions/config-store/src",
"extensions/monitor-theia/src"
],
"exclude": ["node_modules"]
}
Loading

0 comments on commit a569e94

Please sign in to comment.