Skip to content

Commit

Permalink
CLDR-16522 deps add .node-version file @ v18.15.0 (#2823)
Browse files Browse the repository at this point in the history
- add a .node-version file, defacto format defined at https://github.com/shadowspawn/node-version-usage
- mvn/ant code to use the .node-version file within frontend-maven-plugin, workaround for eirslett/frontend-maven-plugin#1047
- use the nodenv/actions/node-version@v3 action which reads .node-version in relevant places
- turn on webpack's persistent cache, and cache it across builds
- also, move some maven plugin dependencies up to tools/pom.xml
I'm keeping package dependencies (such as mysql) in cldr-apps/pom.xml
  • Loading branch information
srl295 authored Mar 30, 2023
1 parent 71e4ea0 commit 20acac3
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 11 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ jobs:
restore-keys: |
${{ runner.os }}-nodetr-
nodetr-
- uses: actions/setup-node@v3
with:
node-version: '16'
- uses: nodenv/actions/node-version@v3 # setup using .node-version
- name: Run TR archiver
# Note: will update ToC if out of date
run: 'cd tools/scripts/tr-archive/ && npm ci && npm run build'
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ name: JavaScript Tests
on:
push:
paths:
- '.node-version'
- 'tools/cldr-apps/js/**'
- '.github/workflows/js.yml'
pull_request:
paths:
- '.node-version'
- 'tools/cldr-apps/js/**'
- '.github/workflows/js.yml'

Expand All @@ -17,6 +19,15 @@ jobs:
- uses: actions/checkout@v3
with:
lfs: false # not needed for this job, as we don’t currently do a Java build
- uses: nodenv/actions/node-version@v3 # setup using .node-version
- name: Cache webpack
uses: actions/cache@v3
with:
path: tools/cldr-apps/target/webpack_cache
key: ${{ runner.os }}-webpack-${{ hashFiles('tools/cldr-apps/package*') }}-${{ hashFiles('tools/cldr-apps/src/**') }}
restore-keys: |
${{ runner.os }}-webpack-
webpack-
- name: Cache npm repository
uses: actions/cache@v3
with:
Expand All @@ -31,5 +42,5 @@ jobs:
# stopgap: fail this if it takes too long
timeout-minutes: 10
run: (cd tools/cldr-apps/js && npm t)
- name: Run Webpack build
- name: Run Webpack production build
run: (cd tools/cldr-apps/js && npm run build)
8 changes: 8 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ jobs:
restore-keys: |
${{ runner.os }}-node-
node-
- name: Cache webpack
uses: actions/cache@v3
with:
path: tools/cldr-apps/target/webpack_cache
key: ${{ runner.os }}-webpack-${{ hashFiles('tools/cldr-apps/package*') }}-${{ hashFiles('tools/cldr-apps/src/**') }}
restore-keys: |
${{ runner.os }}-webpack-
webpack-
- name: Lint GitHub Actions
run: npx yaml-lint .github/workflows/*.yml
- name: Build with Maven
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.15.0
4 changes: 4 additions & 0 deletions tools/cldr-apps/js/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module.exports = (env, argv) => {
const DEV = (mode === 'development');
return {
entry: "./src/index.js",
cache: {
type: 'filesystem',
cacheDirectory: path.resolve(__dirname, '../target/webpack_cache'),
},
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "..", "src", "main", "webapp", "dist"),
Expand Down
46 changes: 39 additions & 7 deletions tools/cldr-apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,44 @@
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<configuration>
<target>
<concat append="no" destfile="${project.basedir}/target/node-version.properties">node.version=</concat>
<concat append="yes" destfile="${project.basedir}/target/node-version.properties">
<fileset dir="${project.basedir}/../..">
<include name=".node-version" />
</fileset>
</concat>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/target/node-version.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
</plugin>
Expand All @@ -166,7 +204,6 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>3.2.3</version>
<configuration>
<archive>
<manifestEntries>
Expand All @@ -181,7 +218,6 @@
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<serverName>cldr</serverName>
<copyDependencies>
Expand All @@ -196,7 +232,6 @@
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
Expand All @@ -219,7 +254,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<systemPropertyVariables>
<http.port>${default.http.port}</http.port>
Expand Down Expand Up @@ -248,7 +282,6 @@
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.1</version>
<executions>
<execution>
<id>install node and npm</id>
Expand Down Expand Up @@ -284,8 +317,7 @@
</execution>
</executions>
<configuration>
<nodeVersion>v16.17.1</nodeVersion>
<npmVersion>8.15.0</npmVersion>
<nodeVersion>${node.version}</nodeVersion>
<!-- run in project sourcedir -->
<workingDirectory>${project.basedir}/js</workingDirectory>
</configuration>
Expand Down
29 changes: 29 additions & 0 deletions tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,26 @@
<argLine>-Xmx6g -enableassertions</argLine>
</configuration>
</plugin>
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.5.1</version>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.1.0</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
Expand All @@ -204,6 +224,15 @@
<artifactId>maven-install-plugin</artifactId>
<version>3.0.1</version>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>3.2.3</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
Expand Down

0 comments on commit 20acac3

Please sign in to comment.