Skip to content

Commit

Permalink
ci: expect node.js on build machine (#18892)
Browse files Browse the repository at this point in the history
  • Loading branch information
teleivo authored Oct 23, 2024
1 parent cc992ed commit 900f131
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 144 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ on:
branches:
- master
schedule:
- cron: '0 12 * * *'
- cron: "0 12 * * *"
concurrency:
group: ${{ github.workflow}}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow}}-${{ github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze
Expand All @@ -27,7 +27,7 @@ jobs:
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: [ 'java' ]
language: ["java"]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

Expand Down Expand Up @@ -58,9 +58,9 @@ jobs:
config-file: ./.github/codeql/codeql-config.yml

- name: Build core
run: mvn clean install -f ./dhis-2/pom.xml --batch-mode --no-transfer-progress -Pdev -DskipTests=true -Dmaven.javadoc.skip=true -V
run: mvn clean install -f ./dhis-2/pom.xml --batch-mode --no-transfer-progress -DskipTests=true -Dmaven.javadoc.skip=true -V
- name: Build web
run: mvn clean install -f ./dhis-2/dhis-web/pom.xml --batch-mode --no-transfer-progress -Pdev -DskipTests=true -Dmaven.javadoc.skip=true -V
run: mvn clean install -f ./dhis-2/dhis-web/pom.xml --batch-mode --no-transfer-progress -DskipTests=true -Dmaven.javadoc.skip=true -V

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
19 changes: 9 additions & 10 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
- master
pull_request:
concurrency:
group: ${{ github.workflow}}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow}}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-test:
runs-on: ubuntu-latest
Expand All @@ -21,8 +21,8 @@ jobs:
java-version: 11
distribution: temurin
cache: maven
- name: Test core # NOTE: dhis-2/pom.xml needs to be installed as built artifacts are needed by dhis-web
run: mvn clean install --threads 2C --batch-mode --no-transfer-progress --update-snapshots -f ./dhis-2/pom.xml -pl -dhis-web-embedded-jetty
- name: Run unit tests # NOTE: dhis-2/pom.xml needs to be installed as built artifacts are needed by dhis-web
run: mvn clean install --threads 2C --batch-mode --no-transfer-progress --update-snapshots -f ./dhis-2/pom.xml -pl -dhis-web-embedded-jetty --activate-profiles unit-test
timeout-minutes: 30
- name: Report coverage to codecov
uses: codecov/codecov-action@v3
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
distribution: temurin
cache: maven
- name: Run integration tests
run: mvn clean verify --threads 2C --batch-mode --no-transfer-progress -Pintegration -f ./dhis-2/pom.xml -pl -dhis-web-embedded-jetty
run: mvn clean test --threads 2C --batch-mode --no-transfer-progress -f ./dhis-2/pom.xml -pl -dhis-web-embedded-jetty --activate-profiles integration-test
timeout-minutes: 30
- uses: actions/upload-artifact@v4
name: Upload test logs on failure
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
distribution: temurin
cache: maven
- name: Run integration h2 tests
run: mvn clean verify --threads 2C --batch-mode --no-transfer-progress -PintegrationH2 -f ./dhis-2/pom.xml -pl -dhis-web-embedded-jetty
run: mvn clean test --threads 2C --batch-mode --no-transfer-progress -f ./dhis-2/pom.xml -pl -dhis-web-embedded-jetty --activate-profiles integration-h2-test
timeout-minutes: 30
- uses: actions/upload-artifact@v4
name: Upload test logs on failure
Expand Down Expand Up @@ -167,12 +167,11 @@ jobs:
contains(needs.*.result, 'failure') &&
github.ref == 'refs/heads/master'
needs: [ unit-test, integration-test, integration-h2-test ]
needs: [unit-test, integration-test, integration-h2-test]
steps:
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_BACKEND_WEBHOOK }}
SLACK_CHANNEL: 'team-backend'
SLACK_CHANNEL: "team-backend"
SLACK_MESSAGE: "Latest test run on master failed and needs investigation :detective-duck:. \n Commit message: ${{ github.event.head_commit.message }}"
SLACK_COLOR: '#ff0000'

SLACK_COLOR: "#ff0000"
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ You'll need the following software to run DHIS2 on your machine:

- Java 8
- Maven
- Node.js at least v20 (used to bundle web apps)
- Tomcat

## Fork
Expand Down
4 changes: 2 additions & 2 deletions dhis-2/build-nocompr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# Requires maven to be on the classpath
# Invokes the dev profile which skips tests and disables compression of war artifacts for a speedy build

mvn clean install --batch-mode --no-transfer-progress -Pdev
mvn clean install --batch-mode --no-transfer-progress -Pdev -f dhis-web/pom.xml -U
mvn clean install --batch-mode --no-transfer-progress
mvn clean install --batch-mode --no-transfer-progress -f dhis-web/pom.xml -U
2 changes: 1 addition & 1 deletion dhis-2/dhis-test-coverage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
<goals>
<goal>report-aggregate</goal>
</goals>
<phase>verify</phase>
<phase>test</phase>
</execution>
</executions>
</plugin>
Expand Down
67 changes: 33 additions & 34 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,55 @@

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

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- this template is only needed by bundle-apps.js to generate the dhis-web-apps/index.html -->
<packagingExcludes>dhis-web-apps/template.html</packagingExcludes>
<archive>
<compress>true</compress>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<!-- nodejs is expected to be present to clone bundled apps -->
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<installDirectory>target</installDirectory>
<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>
<ARTIFACT_ID>dhis-web-apps</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>
<configuration>
<nodeVersion>v16.13.2</nodeVersion>
</configuration>
</execution>

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

<execution>
<id>clone apps</id>
<id>bundle-apps</id>
<goals>
<goal>npm</goal>
<goal>exec</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>run bundle-apps</arguments>
</configuration>
<phase>prepare-package</phase>
</execution>

</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 900f131

Please sign in to comment.