Skip to content

Commit

Permalink
Merge pull request #173 from SpineEventEngine/testlib-module
Browse files Browse the repository at this point in the history
Migration to `TemplateString` API, and `testlib` module
  • Loading branch information
alexander-yevsyukov authored Jan 5, 2025
2 parents 3c6dc55 + 28732d4 commit 300b55e
Show file tree
Hide file tree
Showing 226 changed files with 4,073 additions and 1,974 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build-on-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: zulu
Expand All @@ -24,14 +24,15 @@ jobs:

# See: https://github.com/marketplace/actions/junit-report-action
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3.7.6
uses: mikepenz/action-junit-report@v4.0.3
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/**/TEST-*.xml'
require_tests: true # will fail workflow if test reports not found

- name: Upload code coverage report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
9 changes: 5 additions & 4 deletions .github/workflows/build-on-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: zulu
cache: gradle

# See: https://github.com/al-cheb/configure-pagefile-action
- name: Configure Pagefile
uses: al-cheb/configure-pagefile-action@v1.2
uses: al-cheb/configure-pagefile-action@v1.3

- name: Build project and run tests
shell: cmd
Expand All @@ -28,7 +29,7 @@ jobs:

# See: https://github.com/marketplace/actions/junit-report-action
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3.7.6
uses: mikepenz/action-junit-report@v4.0.3
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/**/TEST-*.xml'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ensure-reports-updated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Configure the checkout of all branches, so that it is possible to run the comparison.
fetch-depth: 0
# Check out the `config` submodule to fetch the required script file.
submodules: true

- name: Check that `pom.xml` and `license-report.md` are modified
- name: Check that both `pom.xml` and license report files are modified
shell: bash
run: chmod +x ./config/scripts/ensure-reports-updated.sh && ./config/scripts/ensure-reports-updated.sh
4 changes: 2 additions & 2 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout latest code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/actions/wrapper-validation@v4
4 changes: 2 additions & 2 deletions .github/workflows/increment-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: zulu
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: zulu
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/remove-obsolete-artifacts-from-packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#
# Periodically removes obsolete artifacts from GitHub Packages.
#
# Only non-release artifacts—those containing "SNAPSHOT" in their version name—are eligible
# for removal. The latest non-release artifacts will be retained, with the exact number determined
# by the `VERSION_COUNT_TO_KEEP` environment variable.
#
# Please note the following details:
#
# 1. An artifact cannot be deleted if it is public and has been downloaded more than 5,000 times.
# In this scenario, contact GitHub support for further assistance.
#
# 2. This workflow only applies to artifacts published from this repository.
#
# 3. A maximum of 100 artifacts can be removed per run from each package;
# if there are more than 100 obsolete artifacts, either manually restart the workflow
# or wait for the next scheduled removal.
#
# 4. When artifacts with version `x.x.x-SNAPSHOT` are published, GitHub automatically appends
# the current timestamp, resulting in versions like `x.x.x-SNAPSHOT.20241024.173759`.
# All such artifacts are grouped into one package and treated as a single package
# in GitHub Packages with the version `x.x.x-SNAPSHOT`. Consequently, it is not possible
# to remove obsolete versions within a package; only the entire package can be deleted.
#

name: Remove obsolete Maven artifacts from GitHub Packages

on:
schedule:
- cron: '0 0 * * *' # Run every day at midnight.

env:
VERSION_COUNT_TO_KEEP: 5 # Number of most recent SNAPSHOT versions to retain.

jobs:
retrieve-package-names:
name: Retrieve the package names published from this repository
runs-on: ubuntu-latest
outputs:
package-names: ${{ steps.request-package-names.outputs.package-names }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'

- name: Retrieve the names of packages
id: request-package-names
shell: bash
run: |
repoName=$(echo ${{ github.repository }} | cut -d '/' -f2)
chmod +x ./config/scripts/request-package-names.sh
./config/scripts/request-package-names.sh ${{ github.token }} \
$repoName ${{ github.repository_owner }} ./package-names.json
echo "package-names=$(<./package-names.json)" >> $GITHUB_OUTPUT
delete-obsolete-artifacts:
name: Remove obsolete artifacts published from this repository to GitHub Packages
needs: retrieve-package-names
runs-on: ubuntu-latest
strategy:
matrix:
package-name: ${{ fromJson(needs.retrieve-package-names.outputs.package-names) }}
steps:
- name: Remove obsolete artifacts from '${{ matrix.package-name }}' package
uses: actions/delete-package-versions@v5
with:
owner: ${{ github.repository_owner }}
package-name: ${{ matrix.package-name }}
package-type: 'maven'
token: ${{ github.token }}
min-versions-to-keep: ${{ env.VERSION_COUNT_TO_KEEP }}
# Ignores artifacts that do not contain the word "SNAPSHOT".
ignore-versions: '^(?!.+SNAPSHOT).*$'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

# Gradle build files
**/build/**
!**/src/**/build/**

# Build files produced by the IDE
**/out/**
Expand Down
2 changes: 1 addition & 1 deletion .idea/copyright/TeamDev_Open_Source.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 29 additions & 23 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2023, TeamDev. All rights reserved.
* Copyright 2025, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and/or binary forms, with or without
* modification, must retain the above copyright notice and the following
Expand All @@ -26,24 +26,27 @@

@file:Suppress("RemoveRedundantQualifierName")

import io.spine.internal.dependency.Dokka
import io.spine.internal.dependency.JUnit
import io.spine.internal.dependency.Jackson
import io.spine.internal.dependency.Spine
import io.spine.internal.dependency.Validation
import io.spine.internal.gradle.publish.PublishingRepos
import io.spine.internal.gradle.publish.spinePublishing
import io.spine.internal.gradle.report.coverage.JacocoConfig
import io.spine.internal.gradle.report.license.LicenseReporter
import io.spine.internal.gradle.report.pom.PomGenerator
import io.spine.internal.gradle.standardToSpineSdk
import io.spine.dependency.build.Dokka
import io.spine.dependency.lib.Jackson
import io.spine.dependency.local.Base
import io.spine.dependency.local.Logging
import io.spine.dependency.local.Reflect
import io.spine.dependency.local.ToolBase
import io.spine.dependency.local.Validation
import io.spine.dependency.test.JUnit
import io.spine.gradle.publish.PublishingRepos
import io.spine.gradle.publish.spinePublishing
import io.spine.gradle.report.coverage.JacocoConfig
import io.spine.gradle.report.license.LicenseReporter
import io.spine.gradle.report.pom.PomGenerator
import io.spine.gradle.standardToSpineSdk

buildscript {
standardSpineSdkRepositories()
doForceVersions(configurations)

dependencies {
classpath(io.spine.internal.dependency.Spine.McJava.pluginLib)
classpath(io.spine.dependency.local.McJava.pluginLib)
}

configurations {
Expand All @@ -52,12 +55,14 @@ buildscript {
exclude(group = "io.spine", module = "spine-logging-backend")

resolutionStrategy {
val validation = io.spine.internal.dependency.Validation
val jackson = io.spine.internal.dependency.Jackson
val logging = io.spine.internal.dependency.Spine.Logging
val validation = io.spine.dependency.local.Validation
val jackson = io.spine.dependency.lib.Jackson
val logging = io.spine.dependency.local.Logging
force(
io.spine.internal.dependency.Spine.base,
io.spine.dependency.local.Base.lib,
io.spine.dependency.local.Reflect.lib,
logging.lib,
logging.middleware,
validation.runtime,
jackson.annotations,
jackson.bom,
Expand All @@ -84,12 +89,11 @@ plugins {
spinePublishing {
modules = setOf(
"time",
"testutil-time"
"time-testlib"
)
destinations = with(PublishingRepos) {
setOf(
gitHub("time"),
cloudRepo,
cloudArtifactRegistry
)
}
Expand All @@ -115,9 +119,11 @@ allprojects {
exclude(group = "io.spine", module = "spine-flogger-api")
resolutionStrategy {
force(
Spine.base,
Spine.toolBase,
Spine.Logging.lib,
Reflect.lib,
Base.lib,
ToolBase.lib,
Logging.lib,
Logging.middleware,
Validation.runtime,
Dokka.BasePlugin.lib,
Jackson.databind,
Expand Down
Loading

0 comments on commit 300b55e

Please sign in to comment.