Skip to content

Commit 951362b

Browse files
committed
Add new GitHub Actions pipeline for frontend CI
1 parent 473ccc2 commit 951362b

File tree

10 files changed

+78
-54
lines changed

10 files changed

+78
-54
lines changed

.github/renovate.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
"matchDatasources": ["npm"],
1313
"addLabels": ["javascript"],
1414
"automerge": false
15-
},
16-
{
17-
"matchPackageNames": ["node"],
18-
"allowedVersions": "/22.[0-9]+.[0-9]+(.[0-9]+)?$/"
1915
}
2016
],
2117
"customManagers": [

.github/workflows/frontend.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: frontend
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
ci:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Extract versions from pom.xml
15+
id: extract_versions
16+
run: |
17+
NODE_VERSION=$(sed -n 's/.*<node.version>\(.*\)<\/node.version>.*/\1/p' pom.xml)
18+
NPM_VERSION=$(sed -n 's/.*<npm.version>\(.*\)<\/npm.version>.*/\1/p' pom.xml)
19+
echo "NODE_VERSION=$NODE_VERSION" >> "$GITHUB_ENV"
20+
echo "NPM_VERSION=$NPM_VERSION" >> "$GITHUB_ENV"
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: "${{ env.NODE_VERSION }}"
24+
cache: "npm"
25+
- run: npm install --global 'npm@${{ env.NPM_VERSION }}'
26+
- run: npm ci
27+
- run: npm run lint
28+
- run: npm run build
29+
- run: npm test

.github/workflows/jenkins-security-scan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
pull_request:
8-
types: [ opened, synchronize, reopened ]
8+
types: [opened, synchronize, reopened]
99
workflow_dispatch:
1010

1111
permissions:
@@ -17,5 +17,5 @@ jobs:
1717
security-scan:
1818
uses: jenkins-infra/jenkins-security-scan/.github/workflows/jenkins-security-scan.yaml@v2
1919
with:
20-
java-cache: 'maven' # Optionally enable use of a build dependency cache. Specify 'maven' or 'gradle' as appropriate.
20+
java-cache: "maven" # Optionally enable use of a build dependency cache. Specify 'maven' or 'gradle' as appropriate.
2121
# java-version: 21 # Optionally specify what version of Java to set up for the build, or remove to use a recent default.

.prettierignore

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
/*
2-
!/src
31
/src/*
4-
!/src/main
2+
!/src/main/
53
/src/main/*
6-
!/src/main/frontend
7-
!/package.json
8-
!/tsconfig.json
9-
!/.prettierrc.json
10-
!/eslint.config.js
11-
!/vite.config.ts
12-
!/vitest.config.ts
4+
!/src/main/frontend/
5+
6+
/.mvn/
7+
/Jenkinsfile
8+
/pom.xml

CONTRIBUTING.md

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Contributing
22

3-
**Never report security issues on GitHub, public Jira issues or other public channels (Gitter/Twitter/etc.),
4-
follow the instruction from [Jenkins Security](https://www.jenkins.io/security/#reporting-vulnerabilities) to
3+
**Never report security issues on GitHub, public Jira issues or other public channels (Gitter/Twitter/etc.),
4+
follow the instruction from [Jenkins Security](https://www.jenkins.io/security/#reporting-vulnerabilities) to
55
report it on [Jenkins Jira](https://issues.jenkins.io/)**
66

77
In the Jenkins project we appreciate any kind of contributions: code, documentation, design, etc.
@@ -11,68 +11,69 @@ Check out [this page](https://jenkins.io/participate/) for more information and
1111
Many plugins and components also define their own contributing guidelines and communication channels.
1212
There is also a big number of [mailing lists](https://jenkins.io/mailing-lists/) and [chats](https://jenkins.io/chat/).
1313

14-
1514
## Newcomers
1615

1716
If you are a newcomer contributor and have any questions, please do not hesitate to ask in the [Newcomers Gitter channel](https://gitter.im/jenkinsci/newcomer-contributors).
1817

1918
## Useful links
2019

21-
* [Jenkins: Participate and Contribute](https://jenkins.io/participate/)
22-
* [Slides: Contributing to Jenkins - it is all about you](https://docs.google.com/presentation/d/1JHgVzWZAx95IsUAZp8OoyCQGGkrCjzUd7eblwd1Y-hA/edit?usp=sharing)
20+
- [Jenkins: Participate and Contribute](https://jenkins.io/participate/)
21+
- [Slides: Contributing to Jenkins - it is all about you](https://docs.google.com/presentation/d/1JHgVzWZAx95IsUAZp8OoyCQGGkrCjzUd7eblwd1Y-hA/edit?usp=sharing)
2322

2423
### Source code contribution ways of working
2524

2625
- For larger contributions create an issue for any required discussion
2726
- Implement solution on a branch in your fork
2827
- Make sure to include issue ID (if created) in commit message, and make the message speak for itself
2928
- Once you're done create a pull request and ask at least one of the maintainers for review
30-
- Remember to title your pull request properly as it is used for release notes
29+
- Remember to title your pull request properly as it is used for release notes
3130

3231
## Run Locally
3332

3433
Prerequisites: _Java_ and _Maven_.
3534

3635
- Ensure Java 17 or 21 is available.
3736

38-
```console
37+
```console
3938
$ java -version
4039
openjdk 17.0.13 2024-10-15
4140
OpenJDK Runtime Environment (build 17.0.13+11-Ubuntu-2ubuntu124.04)
4241
OpenJDK 64-Bit Server VM (build 17.0.13+11-Ubuntu-2ubuntu124.04, mixed mode, sharing)
43-
```
42+
```
4443

4544
- Ensure Maven >= 3.9.9 is installed and included in the PATH environment variable.
4645

4746
```console
48-
$ mvn --version
49-
```
47+
mvn --version
48+
```
5049

5150
### IDE configuration
5251

5352
See [IDE configuration](https://jenkins.io/doc/developer/development-environment/ide-configuration/)
5453

5554
### CLI
5655

57-
```console
58-
$ mvn hpi:run
59-
```
56+
```console
57+
mvn hpi:run
58+
```
6059

61-
```text
62-
...
63-
INFO: Jenkins is fully up and running
60+
```text
61+
...
62+
INFO: Jenkins is fully up and running
6463
```
6564

6665
### Building frontend code
6766

6867
To work on the frontend code, two processes are needed at the same time:
6968

7069
On one terminal, start a development server that will not process frontend assets:
70+
7171
```sh
7272
mvn hpi:run -Dskip.npm -P quick-build
7373
```
7474

7575
On another terminal, start a [vite](https://vite.dev/) build command that automatically rebuilds on code changes:
76+
7677
```sh
7778
npm run build:dev
7879
```
@@ -81,11 +82,20 @@ It's recommended that you set up the above terminal commands in your IDE of choi
8182

8283
### Build and package
8384

84-
To generate the hpi package and run the test you can use:
85+
To generate the hpi package and run the plugin tests (except frontend tests) you can use:
86+
8587
```sh
8688
mvn package
8789
```
88-
For a quicker build without the tests run:
90+
91+
To run the frontend tests, you can use:
92+
93+
```sh
94+
npm test
95+
```
96+
97+
For a quicker build without the plugin tests run:
98+
8999
```sh
90100
mvn package -P quick-build
91101
```
@@ -94,10 +104,10 @@ mvn package -P quick-build
94104

95105
Code style will be enforced by GitHub pull request checks.
96106

97-
For frontend code we use [prettier](https://prettier.io/).
107+
For frontend code we use [eslint](https://eslint.org) and [prettier](https://prettier.io/).
98108

99109
You can automatically fix issues with `npm run lint:fix`
100110

101111
For java code we use [spotless](https://github.com/diffplug/spotless).
102112

103-
You can automatically fix issues with `mvn spotless:apply`
113+
You can automatically fix issues with `mvn spotless:apply`

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
77

88
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
99

10-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ This plugin aims to bring the best of Blue Ocean into the regular Jenkins UI.
3434

3535
That means functionality like:
3636

37-
* [x] Pipeline graph
38-
* [x] Summary of runs in a job (like [Pipeline Stage View Plugin](https://github.com/jenkinsci/pipeline-stage-view-plugin/), but simpler, more modern and more performant)
39-
* [x] Modern logs viewing
37+
- [x] Pipeline graph
38+
- [x] Summary of runs in a job (like [Pipeline Stage View Plugin](https://github.com/jenkinsci/pipeline-stage-view-plugin/), but simpler, more modern and more performant)
39+
- [x] Modern logs viewing
4040

4141
The plugin should be lightweight, using or providing extension points where possible rather than building everything into one plugin.
4242

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
{
22
"name": "pipeline-graph-view-plugin",
3-
"version": "1.0.0",
3+
"version": "0.0.0-development",
44
"description": "Pipeline Graph visualization for Jenkins pipelines",
55
"private": true,
66
"type": "module",
77
"scripts": {
88
"mvnbuild": "npm run build",
9-
"mvntest": "npm test",
9+
"mvntest": "echo \"Use 'npm test' instead\"",
1010
"build": "vite build --mode production",
1111
"build:dev": "vite build --mode development --watch",
12-
"lint": "tsc && eslint && prettier --check .",
13-
"lint:fix": "eslint --fix && prettier --write .",
14-
"test": "vitest --watch=false --reporter default --reporter junit && npm run lint",
12+
"format:check": "prettier --check .",
13+
"format": "prettier --write .",
14+
"lint": "tsc && eslint && npm run format:check",
15+
"lint:fix": "eslint --fix && npm run format",
16+
"test": "vitest --watch=false",
1517
"test:dev": "vitest --watch"
1618
},
1719
"repository": {

pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@
3838
<node.version>22.15.0</node.version>
3939
<npm.version>11.3.0</npm.version>
4040
<spotless.check.skip>false</spotless.check.skip>
41-
42-
<!-- Opt in to Jenkins handling eslint results -->
43-
<maven.test.failure.ignore>false</maven.test.failure.ignore>
44-
<frontend.testFailureIgnore>${maven.test.failure.ignore}</frontend.testFailureIgnore>
4541
</properties>
4642

4743
<dependencyManagement>

vitest.config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import { defineConfig } from "vitest/config";
2-
import path from "node:path";
32

43
export default defineConfig({
54
test: {
65
root: "src/main/frontend",
76
globals: true,
87
environment: "jsdom",
98
setupFiles: ["setupTests.ts"],
10-
outputFile: path.resolve(
11-
import.meta.dirname,
12-
"target/surefire-reports/vitest-junit.xml",
13-
),
149
},
1510
});

0 commit comments

Comments
 (0)