Skip to content

Commit

Permalink
Merge branch 'dev' into feature/#64_introduce_docker_compose_for_bco_…
Browse files Browse the repository at this point in the history
…dist
  • Loading branch information
LukBelter authored May 16, 2024
2 parents a87a857 + 7b08c24 commit db53ede
Show file tree
Hide file tree
Showing 541 changed files with 46,368 additions and 12,866 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/auto-branch-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Autoupdate PR branches"

on:
push:
branches:
- dev
- "epic/**"

jobs:
autoupdate:
name: autoupdate
runs-on: ubuntu-22.04
steps:
- uses: docker://chinthakagodawita/autoupdate-action:v1
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
MERGE_CONFLICT_ACTION: "ignore"
113 changes: 79 additions & 34 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Build and Test

on:
push:
branches:
- dev
pull_request:
branches:
- dev
Expand All @@ -12,75 +9,123 @@ on:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
build:
name: "Build"
timeout-minutes: 10
check:
name: "Check"

if: github.event.pull_request.draft == false

runs-on: ubuntu-latest
outputs:
testing_needed: ${{ steps.check.outputs.testing_needed }}

steps:
- name: "Checkout Branch"
uses: actions/checkout@v2
uses: actions/checkout@v3

### Checks if there are any file changes that are not in the .github/ or doc/ directories
- name: "Check for changes outside CI and docs"
id: check
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
changed_files=$(gh pr diff --name-only ${{ github.event.pull_request.number }})
changesOutsideDocsCI=false
for file in $changed_files; do
if [[ $file -ne ".github/"* && $file -ne "doc/"* ]]; then
echo "file: $file is not part of CI or docs"
echo "Start testing pipeline."
changesOutsideDocsCI=true
break
else
echo "file: $file is part of CI or docs"
fi
done
if [[ $changesOutsideDocsCI == true ]]; then
echo "testing_needed=true" >> "$GITHUB_OUTPUT"
else
echo "testing_needed=false" >> "$GITHUB_OUTPUT"
echo "No need for the build and test pipeline to run. Exiting."
fi
build:
name: "Build"
timeout-minutes: 10
needs: check
if: |
(github.event.pull_request.draft == false)
&& (needs.check.outputs.worth_testing == true)
runs-on: ubuntu-latest

steps:
- name: "Checkout Branch"
uses: actions/checkout@v3

- name: "Setup Java"
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'

- name: Setup Gradle cache
uses: actions/cache@v2.1.2
uses: actions/cache@v3
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('build.gradle') }}
restore-keys: |
${{ runner.os }}-gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('versions.properties') }}-${{ github.sha }}

- name: "prepare libs for build"
run: ./prepare.sh

- name: "build backend"
run: ./gradlew build -x test
run: ./gradlew --build-cache build -x test

- name: Upload Gradle reports
uses: actions/upload-artifact@v2.2.4
if: ${{ failure() }}
- name: Upload build reports
uses: actions/upload-artifact@v3
if: ${{ failure() || contains(github.event.pull_request.labels.*.name, 'force reports') }}
with:
name: Build Backend Reports
name: Build Reports
path: "**/build/reports"

test:
name: "Test"
timeout-minutes: 30

if: github.event.pull_request.draft == false
timeout-minutes: 120
needs: build
if: |
(github.event.pull_request.draft == false)
&& (needs.check.outputs.testing_needed == true)
runs-on: ubuntu-latest

steps:
- name: "Checkout Branch"
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: "Setup Java"
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'

- name: Setup Gradle cache
uses: actions/cache@v2.1.2
uses: actions/cache@v3
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('build.gradle') }}
restore-keys: |
${{ runner.os }}-gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('versions.properties') }}-${{ github.sha }}

- name: "prepare libs for tests"
run: ./prepare.sh

- name: "test backend"
run: ./gradlew check
env:
RUN_LONG_INTEGRATION_TESTS: false
run: ./gradlew --build-cache check

- name: Upload Gradle reports
uses: actions/upload-artifact@v2.2.4
if: ${{ failure() }}
- name: Upload test reports
uses: actions/upload-artifact@v3
if: ${{ failure() || contains(github.event.pull_request.labels.*.name, 'force reports') }}
with:
name: Test Backend Reports
path: "**/build/reports"
name: Test Reports
path: "**/build/reports"

4 changes: 4 additions & 0 deletions .github/workflows/deploy-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
pull_request:
branches:
- dev
- beta
types: [opened, labeled, synchronize, reopened, ready_for_review]

jobs:
Expand All @@ -33,6 +34,7 @@ jobs:
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=raw,value=review,enable=${{ contains(github.event.pull_request.labels.*.name, 'prebuild docker image') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
Expand Down Expand Up @@ -82,6 +84,7 @@ jobs:
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=raw,value=review,enable=${{ contains(github.event.pull_request.labels.*.name, 'prebuild docker image') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
Expand Down Expand Up @@ -115,6 +118,7 @@ jobs:
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=raw,value=review,enable=${{ contains(github.event.pull_request.labels.*.name, 'prebuild docker image') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
Expand Down
103 changes: 0 additions & 103 deletions .github/workflows/detekt-analysis.yml

This file was deleted.

12 changes: 7 additions & 5 deletions .github/workflows/publish-jars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ jobs:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v2
- name: "Checkout Branch"
uses: actions/checkout@v3
- name: "Setup Java"
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
distribution: 'temurin'
java-version: 17
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Publish Packages
Expand Down
11 changes: 7 additions & 4 deletions build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ WHITE='\033[0;37m'

APP_NAME='docker images'
APP_NAME=${BLUE}${APP_NAME}${NC}
echo -e "=== ${APP_NAME} are building${WHITE}${NC}" &&
docker build -f docker/Dockerfile -t openbaseorg/bco:local .
docker build -f docker/device-manager/openhab/Dockerfile -t openbaseorg/bco-device-manager-openhab:local --build-arg BCO_BASE_IMAGE_VERSION=local docker/device-manager/openhab
docker build -f docker/bco-demo/Dockerfile -t openbaseorg/bco-demo:local --build-arg BCO_BASE_IMAGE_VERSION=local docker/bco-demo
IMAGE_TAG=${1:-local}

echo -e "=== ${APP_NAME} build docker image...${WHITE}${NC}"

docker build -f docker/Dockerfile -t openbaseorg/bco:${IMAGE_TAG} .
docker build -f docker/device-manager/openhab/Dockerfile -t openbaseorg/bco-device-manager-openhab:${IMAGE_TAG} --build-arg BCO_BASE_IMAGE_VERSION=${IMAGE_TAG} docker/device-manager/openhab
docker build -f docker/bco-demo/Dockerfile -t openbaseorg/bco-demo:${IMAGE_TAG} --build-arg BCO_BASE_IMAGE_VERSION=${IMAGE_TAG} docker/bco-demo

# use this for debugging purpose: DOCKER_BUILDKIT=0 docker build -f docker/Dockerfile --progress=plain .
echo -e "=== ${APP_NAME} were ${GREEN}successfully${NC} build.${NC}"
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
Expand All @@ -12,3 +14,10 @@ nexusPublishing {
}
}
}


tasks.withType(KotlinCompile::class).all {
kotlinOptions {
jvmTarget = "17"
}
}
6 changes: 2 additions & 4 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ dependencies {
implementation("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:_")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.adarshr:gradle-test-logger-plugin:_")
}

tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
jvmTarget = "17"
}
}


2 changes: 1 addition & 1 deletion buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginManagement {
plugins {
id("de.fayard.refreshVersions") version "0.40.1"
id("de.fayard.refreshVersions") version "0.40.2"
}
}

Expand Down
Loading

0 comments on commit db53ede

Please sign in to comment.