Skip to content

Commit 9c8d0c1

Browse files
committed
working repo
working
1 parent 3862fa1 commit 9c8d0c1

19 files changed

Lines changed: 856 additions & 102 deletions

File tree

.ci/jenkins/dsl/jobs.groovy

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* This file is describing all the Jenkins jobs in the DSL format (see https://plugins.jenkins.io/job-dsl/)
3+
* needed by the Kogito pipelines.
4+
*
5+
* The main part of Jenkins job generation is defined into the https://github.com/kiegroup/kogito-pipelines repository.
6+
*
7+
* This file is making use of shared libraries defined in
8+
* https://github.com/kiegroup/kogito-pipelines/tree/main/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl.
9+
*/
10+
11+
import org.kie.jenkins.jobdsl.model.Environment
12+
import org.kie.jenkins.jobdsl.KogitoJobUtils
13+
14+
Map getMultijobPRConfig() {
15+
return [
16+
parallel: true,
17+
buildchain: true,
18+
jobs : [
19+
[
20+
id: 'optaweb-employee-rostering',
21+
primary: true,
22+
]
23+
],
24+
]
25+
}
26+
27+
List environments = Environment.getActiveEnvironments(this)
28+
environments.retainAll { it != Environment.NATIVE } // There is no requirement for Native support.
29+
environments.retainAll { it != Environment.MANDREL } // There is no requirement for Native Mandrel support.
30+
KogitoJobUtils.createPerEnvPerRepoPRJobs(this, environments) { jobFolder -> getMultijobPRConfig() }

.ci/jenkins/dsl/test.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash -e
2+
3+
script_dir_path=$(cd `dirname "${BASH_SOURCE[0]}"`; pwd -P)
4+
5+
export DSL_DEFAULT_MAIN_CONFIG_FILE_REPO=kiegroup/optaplanner
6+
export DSL_DEFAULT_MAIN_CONFIG_FILE_REF=main
7+
export DSL_DEFAULT_MAIN_CONFIG_FILE_PATH=.ci/jenkins/config/main.yaml
8+
9+
file=$(mktemp)
10+
# For more usage of the script, use ./test.sh -h
11+
curl -o ${file} https://raw.githubusercontent.com/kiegroup/kogito-pipelines/main/dsl/seed/scripts/seed_test.sh
12+
chmod u+x ${file}
13+
${file} $@

.github/pull_request_template.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<!--
2+
Thank you for submitting this pull request.
3+
4+
Please provide all relevant information as outlined below. Feel free to delete
5+
a section if that type of information is not available.
6+
-->
7+
8+
### JIRA
9+
10+
<!-- Add a JIRA ticket link if it exists. -->
11+
<!-- Example: https://issues.redhat.com/browse/PLANNER-1234 -->
12+
13+
### Referenced pull requests
14+
15+
<!-- Add URLs of all referenced pull requests if they exist. This is only required when making
16+
changes that span multiple kiegroup repositories and depend on each other. -->
17+
<!-- Example:
18+
- https://github.com/kiegroup/droolsjbpm-build-bootstrap/pull/1234
19+
- https://github.com/kiegroup/drools/pull/3000
20+
- https://github.com/kiegroup/optaplanner/pull/899
21+
- etc.
22+
-->
23+
24+
<details>
25+
<summary>
26+
How to replicate CI configuration locally?
27+
</summary>
28+
29+
Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use [build-chain tool](https://github.com/kiegroup/github-action-build-chain) to handle cross repository builds and be sure that we always use latest version of the code for each repository.
30+
31+
[build-chain tool](https://github.com/kiegroup/github-action-build-chain) is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See [local execution](https://github.com/kiegroup/github-action-build-chain#local-execution) details to get more information about it.
32+
</details>
33+
34+
35+
<details>
36+
<summary>
37+
How to retest this PR or trigger a specific build:
38+
</summary>
39+
40+
- for <b>pull request checks</b>
41+
Please add comment: <b>Jenkins retest this</b>
42+
43+
- for a <b>specific pull request check</b>
44+
please add comment: <b>Jenkins (re)run [optaweb-employee-rostering] tests</b>
45+
46+
- for a <b>full downstream build</b>
47+
- for <b>jenkins</b> job:
48+
please add comment: <b>Jenkins run fdb</b>
49+
- for <b>github actions</b> job:
50+
add the label `run_fdb`
51+
52+
- for a <b>compile downstream build</b>
53+
please add comment: <b>Jenkins run cdb</b>
54+
55+
- for a <b>full production downstream build</b>
56+
please add comment: <b>Jenkins execute product fdb</b>
57+
58+
- for an <b>upstream build</b>
59+
please add comment: <b>Jenkins run upstream</b>
60+
61+
- for <b>quarkus branch checks</b>
62+
Run checks against Quarkus current used branch
63+
Please add comment: <b>Jenkins run quarkus-branch</b>
64+
65+
- for a <b>quarkus branch specific check</b>
66+
Run checks against Quarkus current used branch
67+
Please add comment: <b>Jenkins (re)run [optaweb-employee-rostering] quarkus-branch</b>
68+
69+
- for <b>quarkus main checks</b>
70+
Run checks against Quarkus main branch
71+
Please add comment: <b>Jenkins run quarkus-main</b>
72+
73+
- for a <b>specific quarkus main check</b>
74+
Run checks against Quarkus main branch
75+
Please add comment: <b>Jenkins (re)run [optaweb-employee-rostering] quarkus-branch</b>
76+
77+
<!-- - for <b>native checks</b>
78+
Run native checks
79+
Please add comment: <b>Jenkins run native</b>
80+
81+
- for a <b>specific native check</b>
82+
Run native checks
83+
Please add comment: <b>Jenkins (re)run [optaweb-employee-rostering] native</b>
84+
85+
- for <b>mandrel checks</b>
86+
Run native checks against Mandrel image
87+
Please add comment: <b>Jenkins run mandrel</b>
88+
89+
- for a <b>specific mandrel check</b>
90+
Run native checks against Mandrel image
91+
Please add comment: <b>Jenkins (re)run [optaweb-employee-rostering] mandrel</b> -->
92+
</details>
93+
94+
### CI Status
95+
96+
You can check OptaPlanner repositories CI status from [Chain Status webpage](https://kiegroup.github.io/optaplanner/).
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build Chain
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
branches:
7+
- main
8+
paths-ignore:
9+
- 'LICENSE*'
10+
- '.gitignore'
11+
- '*.md'
12+
- '*.adoc'
13+
- '*.txt'
14+
- 'runOnOpenShift.sh'
15+
- 'ide-configuration/**'
16+
17+
jobs:
18+
build-chain:
19+
if: contains(github.event.pull_request.labels.*.name, 'run_fdb')
20+
concurrency:
21+
group: fdb-${{ github.head_ref }}
22+
cancel-in-progress: true
23+
strategy:
24+
matrix:
25+
os: [ubuntu-latest]
26+
java-version: [11]
27+
maven-version: ['3.8.1']
28+
fail-fast: false
29+
runs-on: ${{ matrix.os }}
30+
name: Full downstream build
31+
steps:
32+
- name: Clean Disk Space
33+
uses: kiegroup/kogito-pipelines/.ci/actions/ubuntu-disk-space@main
34+
if: ${{ matrix.os == 'ubuntu-latest' }}
35+
- name: Support long paths
36+
if: ${{ matrix.os == 'windows-latest' }}
37+
uses: kiegroup/kogito-pipelines/.ci/actions/long-paths@main
38+
- name: Java and Maven Setup
39+
uses: kiegroup/kogito-pipelines/.ci/actions/maven@main
40+
with:
41+
java-version: ${{ matrix.java-version }}
42+
maven-version: ${{ matrix.maven-version }}
43+
cache-key-prefix: ${{ runner.os }}-${{ matrix.java-version }}-maven${{ matrix.maven-version }}
44+
- name: Build Chain
45+
uses: kiegroup/kogito-pipelines/.ci/actions/build-chain@main
46+
with:
47+
annotations-prefix: ${{ runner.os }}-${{ matrix.java-version }}/${{ matrix.maven-version }}
48+
github-token: "${{ secrets.GITHUB_TOKEN }}"
49+
flow-type: full-downstream
50+
- name: Surefire Report
51+
uses: kiegroup/kogito-pipelines/.ci/actions/surefire-report@main
52+
if: ${{ always() }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This workflow will build a Java project with Maven
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
name: Jenkins Tests
4+
on:
5+
pull_request:
6+
paths:
7+
- '.ci/jenkins/**'
8+
9+
jobs:
10+
dsl-tests:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: DSL tests
14+
uses: kiegroup/kogito-pipelines/.ci/actions/dsl-tests@main
15+
with:
16+
main-config-file-repo: kiegroup/optaplanner
17+
main-config-file-ref: main
18+
main-config-file-path: .ci/jenkins/config/main.yaml

.github/workflows/pull_request.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build Chain
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- 'LICENSE*'
9+
- '.gitignore'
10+
- '*.md'
11+
- '*.adoc'
12+
- '*.txt'
13+
- 'runOnOpenShift.sh'
14+
- 'ide-configuration/**'
15+
jobs:
16+
build-chain:
17+
concurrency:
18+
group: pull_request-${{ github.event_name }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.java-version }}
19+
cancel-in-progress: true
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest]
23+
java-version: [11, 17, 18]
24+
maven-version: ['3.8.1']
25+
fail-fast: false
26+
runs-on: ${{ matrix.os }}
27+
name: ${{ matrix.os }} - Java ${{ matrix.java-version }} - Maven
28+
steps:
29+
- name: Clean Disk Space
30+
uses: kiegroup/kogito-pipelines/.ci/actions/ubuntu-disk-space@main
31+
if: ${{ matrix.os == 'ubuntu-latest' }}
32+
- name: Support long paths
33+
if: ${{ matrix.os == 'windows-latest' }}
34+
uses: kiegroup/kogito-pipelines/.ci/actions/long-paths@main
35+
- name: Java and Maven Setup
36+
uses: kiegroup/kogito-pipelines/.ci/actions/maven@main
37+
with:
38+
java-version: ${{ matrix.java-version }}
39+
maven-version: ${{ matrix.maven-version }}
40+
cache-key-prefix: ${{ runner.os }}-${{ matrix.java-version }}-maven${{ matrix.maven-version }}
41+
- name: Build Chain
42+
uses: kiegroup/kogito-pipelines/.ci/actions/build-chain@main
43+
with:
44+
definition-file: https://raw.githubusercontent.com/kiegroup/kogito-pipelines/%{process.env.GITHUB_BASE_REF.replace(/(\d*)\.(.*)\.(.*)/g, (m, n1, n2, n3) => `${+n1-7}.${n2}.${n3}`)}/.ci/pull-request-config.yaml
45+
annotations-prefix: ${{ runner.os }}-${{ matrix.java-version }}/${{ matrix.maven-version }}
46+
github-token: "${{ secrets.GITHUB_TOKEN }}"
47+
- name: Surefire Report
48+
uses: kiegroup/kogito-pipelines/.ci/actions/surefire-report@main
49+
if: ${{ always() }}
50+
- name: Check uncommitted changes
51+
if: ${{ always() }}
52+
# Check that Git working tree is clean after running `npm install` via the frontend-maven-plugin.
53+
# The `git` command exits with 1 and fails the build if there are any uncommitted changes.
54+
run: git diff HEAD --exit-code
55+
working-directory: kiegroup_optaweb_employee_rostering/optaweb-employee-rostering

.github/workflows/sonarcloud.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Runs SonarCloud analysis of the main branch after a PR is merged.
2+
name: SonarCloud analysis
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
paths-ignore:
9+
- 'LICENSE*'
10+
- 'CODEOWNERS'
11+
- '.gitignore'
12+
- '.gitattributes'
13+
- '**.md'
14+
- '**.adoc'
15+
- '**.txt'
16+
- 'runOnOpenShift.sh'
17+
- 'runLocally.sh'
18+
- '.ci/**'
19+
20+
defaults:
21+
run:
22+
shell: bash
23+
24+
jobs:
25+
sonarcloud-analysis:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Check out repository code
30+
uses: actions/checkout@v2
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Set up JDK
35+
uses: actions/setup-java@v1
36+
with:
37+
java-version: 11
38+
39+
# See https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven#caching-dependencies
40+
- name: Cache Maven packages
41+
uses: actions/cache@v2
42+
with:
43+
path: ~/.m2
44+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
45+
restore-keys: ${{ runner.os }}-m2
46+
47+
- name: Build with Maven to measure code coverage
48+
run: mvn -B --fail-at-end clean install -Prun-code-coverage
49+
- name: Run SonarCloud analysis
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
53+
run: mvn -B --fail-at-end validate -Psonarcloud-analysis -Dsonar.login=${{ env.SONARCLOUD_TOKEN }}

README.adoc

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
:projectKey: optaweb-employee-rostering
2-
3-
*This project is no longer maintained.*
4-
Visit https://github.com/kiegroup/optaplanner-quickstarts/tree/stable/use-cases/employee-scheduling[OptaPlanner Employee Rostering Quickstart] to see how to integrate https://www.optaplanner.org/[OptaPlanner] in your application.
5-
2+
:sonarBadge: image:https://sonarcloud.io/api/project_badges/measure?project={projectKey}
3+
:sonarLink: link="https://sonarcloud.io/dashboard?id={projectKey}"
64

75
= Employee Rostering Optimization as a Service
86

7+
image:https://img.shields.io/badge/stackoverflow-ask_question-orange.svg?logo=stackoverflow&style=for-the-badge["Ask question on Stack Overflow", link="https://stackoverflow.com/questions/tagged/optaweb-employee-rostering"]
98
image:https://img.shields.io/badge/zulip-join_chat-brightgreen.svg?logo=zulip&style=for-the-badge[
109
"Join Zulip Chat", link="https://kie.zulipchat.com/#narrow/stream/232679-optaplanner"]
10+
image:https://img.shields.io/github/commit-activity/m/kiegroup/optaweb-employee-rostering?label=commits&style=for-the-badge["Commit Activity", link="https://github.com/kiegroup/optaweb-employee-rostering/pulse"]
1111
image:https://img.shields.io/github/license/kiegroup/optaweb-employee-rostering?style=for-the-badge&logo=apache["License", link="https://www.apache.org/licenses/LICENSE-2.0"]
12+
image:https://img.shields.io/badge/JVM-11-green?style=for-the-badge["JVM support", link="https://github.com/dupliaka/optaweb-employee-rostering/actions"]
13+
image:https://img.shields.io/badge/Maven-3.x-blue?style=for-the-badge["Maven",link="https://maven.apache.org/install.html"]
14+
15+
{sonarBadge}&metric=alert_status["Quality Gate Status", {sonarLink}]
16+
{sonarBadge}&metric=reliability_rating["Reliability Rating", {sonarLink}]
17+
{sonarBadge}&metric=security_rating["Security Rating", {sonarLink}]
18+
{sonarBadge}&metric=sqale_rating["Maintainability Rating", {sonarLink}]
19+
{sonarBadge}&metric=ncloc["Lines of Code", {sonarLink}]
20+
{sonarBadge}&metric=coverage["Coverage", {sonarLink}]
1221

1322
An end-to-end https://www.optaplanner.org/[OptaPlanner] web application ready to deploy on https://www.openshift.com/[OpenShift 4].
1423

24+
See https://youtu.be/3CvadujUN1k[the video demo].
25+
1526
== Building
1627

1728
Build the project with maven in the project's root directory:

0 commit comments

Comments
 (0)