diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..42c425c --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,9 @@ +name: Pull Requests + +on: + pull_request: + +jobs: + run: + uses: hiconic-os/hiconic.ci.workflows/.github/workflows/pr.yaml@main + secrets: inherit \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7909cae..896c0a8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ **/.Trashes **/ehthumbs.db **/Thumbs.db +.gradle diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index c3a7d8c..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,5 +0,0 @@ -@Library('main') _ -runCiPipeline([ - jenkinsfile: this, - projectBaseName: 'core' -]) \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..f5ad2bc --- /dev/null +++ b/build.gradle @@ -0,0 +1,36 @@ +buildscript { + ext.configureBuildscript = { c -> buildscript c } + apply from: 'buildscript.gradle' + + dependencies { + classpath 'com.braintribe.devrock.cicd:devrock-cicd-steps-plugin:1.0+' + classpath 'com.braintribe.devrock.cicd:devrock-cicd-steps:1.0+' + classpath 'com.braintribe.devrock.cicd:github-notification:1.0+' + } +} + +apply plugin: 'devrock-cicd-steps' + +import devrock.cicd.model.api.* + +defaultTasks 'build-artifacts' + +steps { + + step InitializeExchange.T + + step EnrichExchangeContext.T + + step AnalyzeCodebase.T + + step BuildArtifacts.T, { equip { handler = { ant it.folderName, 'install', 'candidateInstall' } } } + + step CheckLinking.T, { equip { handler = { ant it.folderName, 'check-linking' } } } + + step RunTests.T, { equip { handler = { ant it.folderName, 'test' } } } + + step RaiseAndMergeArtifacts.T // commit + merge + + step PublishArtifacts.T + +} \ No newline at end of file diff --git a/buildscript.gradle b/buildscript.gradle new file mode 100644 index 0000000..96065fd --- /dev/null +++ b/buildscript.gradle @@ -0,0 +1,39 @@ +// setup buildscript dependencies based on the libFolder to make RepositoryConfigurations helper available on classpath +buildscript { + // Determines devrock sdk home directory either by environment variable or by assuming that + // the projectDir lies relatively like that DEVROCK_SDK_HOME/env/dev-env/git/group + String devrockSdkRootVar = System.getenv('DEVROCK_SDK_HOME') + ext.devrockSdkRoot = devrockSdkRootVar != null? + new File(devrockSdkRootVar): + new File(projectDir, '../../../..').toPath().toAbsolutePath().normalize().toFile() + + File libFolder = new File(devrockSdkRoot, 'tools/ant-libs'); + dependencies { classpath files(fileTree(dir: libFolder.absolutePath, include: '*.jar')) } +} + +// load and check the repository configuration +File repoConfig = new File(devrockSdkRoot, 'conf/repository-configuration-devrock.yaml'); +def configMaybe = devrock.repository.configuration.RepositoryConfigurations.load repoConfig + +if (configMaybe.unsatisfied) + throw new GradleException("Error while loading repository configuration for buildscript: " + configMaybe.whyUnsatisfied().stringify()) + +// transpose the repository configuration to gradle style and pass to to the callers buildscript +configureBuildscript { + + repositories { + for (def repo: configMaybe.get().getRepositories()) { + if (repo instanceof com.braintribe.devrock.model.repository.MavenHttpRepository) + maven { + url repo.url + if (repo.user != null) credentials { + username repo.user + password repo.password + } + } + else if (repo instanceof com.braintribe.devrock.model.repository.MavenFileSystemRepository) + maven { url uri("file://${repo.rootPath}") } + } + } + +} diff --git a/repository-configuration-ci.yaml b/repository-configuration-ci.yaml new file mode 100644 index 0000000..1e48c91 --- /dev/null +++ b/repository-configuration-ci.yaml @@ -0,0 +1,27 @@ +!com.braintribe.devrock.model.repository.RepositoryConfiguration { + cachePath: "${config.dir}/../repo", + + installRepository: &install-repo !com.braintribe.devrock.model.repository.MavenFileSystemRepository { + name: "install", + rootPath: "${config.dir}/../inst", + dominanceFilter: !com.braintribe.devrock.model.repository.filters.AllMatchingArtifactFilter {}, + cachable: false, + }, + + uploadRepository: &hiconic-dev !com.braintribe.devrock.model.repository.IndexedMavenHttpRepository { + name: "hiconic-dev", + url: "https://maven.pkg.github.com/hiconic-os/maven-repo-dev", + user: "${env.DEVROCK_PIPELINE_UPLOAD_USER}", + password: "${env.DEVROCK_PIPELINE_UPLOAD_PASSWORD}", + dominanceFilter: !com.braintribe.devrock.model.repository.filters.AllMatchingArtifactFilter {}, + }, + + repositories: [ + *install-repo, + *hiconic-dev, + !com.braintribe.devrock.model.repository.MavenHttpRepository { + name: "third-party", + url: "https://repo1.maven.org/maven2/", + }, + ] +} \ No newline at end of file