Skip to content

Commit

Permalink
ci: use existing node installation on CI (#18612)
Browse files Browse the repository at this point in the history
  • Loading branch information
teleivo committed Sep 19, 2024
1 parent a8b83aa commit 7d5f2ee
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 49 deletions.
141 changes: 96 additions & 45 deletions dhis-2/dhis-web/dhis-web-apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,56 +18,107 @@

<build>
<finalName>dhis-web-apps</finalName>
</build>

<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<installDirectory>target</installDirectory>
<environmentVariables>
<BUILD_DIR>${project.build.directory}</BUILD_DIR>
<ARTIFACT_ID>${project.artifactId}</ARTIFACT_ID>
<APPS>./apps-to-bundle.json</APPS>
<DEFAULT_BRANCH>master</DEFAULT_BRANCH>
</environmentVariables>
</configuration>
<executions>

<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-resources</phase>
<profiles>
<!-- nodejs is downloaded locally to clone bundled apps -->
<profile>
<id>local</id>
<activation>
<property>
<name>env.CI</name>
<value>false</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.15.0</version>
<configuration>
<nodeVersion>v16.13.2</nodeVersion>
<installDirectory>target</installDirectory>
<environmentVariables>
<BUILD_DIR>${project.build.directory}</BUILD_DIR>
<ARTIFACT_ID>${project.artifactId}</ARTIFACT_ID>
<APPS>./apps-to-bundle.json</APPS>
<DEFAULT_BRANCH>master</DEFAULT_BRANCH>
</environmentVariables>
</configuration>
</execution>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<nodeVersion>v20.17.0</nodeVersion>
</configuration>
</execution>

<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
</execution>

<execution>
<id>clone apps</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<execution>
<id>bundle-apps</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>run bundle-apps</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- nodejs is present on CI (GitHub, Jenkins) to clone bundled apps -->
<profile>
<id>ci</id>
<activation>
<property>
<name>env.CI</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<arguments>run bundle-apps</arguments>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>bundle-apps</argument>
</arguments>
<environmentVariables>
<BUILD_DIR>${project.build.directory}</BUILD_DIR>
<ARTIFACT_ID>${project.artifactId}</ARTIFACT_ID>
<APPS>./apps-to-bundle.json</APPS>
<DEFAULT_BRANCH>master</DEFAULT_BRANCH>
</environmentVariables>
</configuration>
</execution>

</executions>
</plugin>

</plugins>
</build>
<executions>
<execution>
<id>bundle-apps</id>
<goals>
<goal>exec</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
14 changes: 10 additions & 4 deletions dhis-2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<properties>
<!-- Build Properties -->
<rootDir/>
<!-- Custom source directory property, as <build><sourceDirectory> cannot
<!-- Custom source directory property, as <build><sourceDirectory> cannot
be set in a profile. See https://github.com/awhitford/lombok.maven/issues/17#issuecomment-136606104 -->
<sourceDir>${project.basedir}/src/main/java</sourceDir>

Expand All @@ -79,7 +79,7 @@
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<surefireArgLine>-Xmx2024m --illegal-access=permit</surefireArgLine>

<!-- Needed so we can disable running tests when the default profile
<!-- Needed so we can disable running tests when the default profile
is used (activated by default). It does not honor -DskipTests otherwise https://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-tests.html -->
<skipTests>false</skipTests>

Expand Down Expand Up @@ -229,6 +229,7 @@
<!-- Maven plugin versions -->
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-exec-plugin.version>3.4.1</maven-exec-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M7</maven-failsafe-plugin.version>
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
Expand Down Expand Up @@ -1642,8 +1643,8 @@
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<!-- Depend only on mockito-inline (includes mockito-core already)
if you must use mockStatic (can you rewrite your code, so it's not necessary
<!-- Depend only on mockito-inline (includes mockito-core already)
if you must use mockStatic (can you rewrite your code, so it's not necessary
;)), otherwise depend on mockito-core only -->
<dependency>
<groupId>org.mockito</groupId>
Expand Down Expand Up @@ -1888,6 +1889,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${maven-exec-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
Expand Down

0 comments on commit 7d5f2ee

Please sign in to comment.