Skip to content

Commit

Permalink
Merge pull request #11 from LEEWAILUN/master
Browse files Browse the repository at this point in the history
try use new build.gradle and ci.yml
  • Loading branch information
Chua123Yun authored Sep 4, 2024
2 parents be6fca4 + 0f70380 commit 266bff3
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 30 deletions.
42 changes: 12 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: CI

on:
push:
branches: [ master ]
Expand All @@ -14,39 +13,22 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
distribution: 'adopt'
java-version: '17'
node-version: '18'

- name: Build with Gradle
run: gradle build
- name: Install dependencies
run: npm install

- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: build/libs/**
- name: Build TypeScript
run: npm run build

- name: Run Unit Test
run: gradle test
- name: Run TypeScript tests
run: npm test

- name: Upload Test Reports
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-reports
path: build/reports/tests/**

- name: Generate code coverage report
run: gradle jacocoTestReport

- name: Upload code coverage report
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: build/reports/jacoco/test/html/**

- name: Run Deployment
run: java -jar build/libs/unleash-main.jar

name: test-results
path: ./build/test-results
41 changes: 41 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,45 @@

plugins {
id 'base'
id 'com.github.node-gradle.node' version '3.4.0' // Ensure you have the Node plugin applied
}

node {
version = '18.17.1' // Match this with your project's Node.js version
npmVersion = '8.15.0'
download = true
}

task installDependencies(type: NpmTask) {
description = 'Install Node.js dependencies'
group = 'build'
args = ['install']
}

task buildTypeScript(type: NpmTask) {
description = 'Build TypeScript files'
group = 'build'
args = ['run', 'build:backend']
}

task testTypeScript(type: NpmTask) {
description = 'Run TypeScript tests'
group = 'verification'
args = ['run', 'test']
}

task clean(type: NpmTask) {
description = 'Clean TypeScript build artifacts'
group = 'build'
args = ['run', 'clean']
}

build.dependsOn installDependencies
build.dependsOn buildTypeScript
test.dependsOn testTypeScript
clean.dependsOn ['clean']
=======

apply plugin: 'java'
apply plugin:'jacoco'
jacoco {
Expand Down

0 comments on commit 266bff3

Please sign in to comment.