diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..08d94e95 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +name: CI Build + +on: + pull_request: + + push: + branches: + - 'master' + - 'develop' # gitflow mainly on hosted runner + + workflow_dispatch: + inputs: + ref: + description: git tag reference to build + required: true + type: string + + workflow_call: + inputs: + ref: + description: git tag reference to build + required: true + type: string + +jobs: + deploy: + runs-on: + - ${{ github.repository_owner != github.actor && 'ubuntu-latest' || 'self-hosted' }} + + steps: + + - name: Checkout Commit + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + + - name: Install pnpm + run: | + corepack enable + corepack prepare pnpm@next-8 --activate + + - name: Install dependencies + run: pnpm install + + - name: Build + run: pnpm build + + - name: Test + run: pnpm run test diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..91512745 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +name: CI Build + +on: + pull_request: + + push: + branches: + - 'master' + - 'develop' # gitflow mainly on hosted runner + + workflow_dispatch: + inputs: + ref: + description: git tag reference to build + required: true + type: string + + workflow_call: + inputs: + ref: + description: git tag reference to build + required: true + type: string + +jobs: + deploy: + runs-on: + - ${{ github.repository_owner != github.actor && 'ubuntu-latest' || 'self-hosted' }} + + steps: + + - name: Checkout Commit + uses: actions/checkout@v3 + with: + fetch-depth: 0 diff --git a/.gitmodules b/.gitmodules index 5e131bc9..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "make.d"] - path = make.d - url = https://github.com/nuxeo/nos-jx-make.d.git diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..2edeafb0 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +20 \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index d79b99c0..00000000 --- a/Jenkinsfile +++ /dev/null @@ -1,122 +0,0 @@ -/* - * (C) Copyright 2021 Nuxeo (http://nuxeo.com/) and others. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Contributors: - * Nuxeo - */ - -def volumeName = env.JOB_NAME.replaceAll('/','-').toLowerCase() - -def containerScript = "" - -bootstrapTemplate = readTrusted('Jenkinsfile-pod.yaml') -env.setProperty('POD_TEMPLATE', bootstrapTemplate) - -pipeline { - options { - skipDefaultCheckout() - disableConcurrentBuilds() - buildDiscarder(logRotator(daysToKeepStr: '60', numToKeepStr: '60', artifactNumToKeepStr: '1')) - } - agent { - kubernetes { - yamlMergeStrategy override() - yaml "${POD_TEMPLATE}" - defaultContainer 'maven' - } - } - environment { - ORG = 'nuxeo' - APP_NAME = 'nuxeo-browser-extension' - } - stages { - stage('Prepare workspace') { - steps { - container('jnlp') { - script { - def scmvars = checkout scm: [ - $class: 'GitSCM', - branches: scm.branches, - doGenerateSubmoduleConfigurations: false, - extensions: [[$class: 'LocalBranch', localBranch: '**'], - [$class: 'CloneOption', noTags: false], - [$class: 'SubmoduleOption', - disableSubmodules: false, - parentCredentials: true, - recursiveSubmodules: true, - reference: '', - trackingSubmodules: false]], - submoduleCfg: [], - userRemoteConfigs: scm.userRemoteConfigs - ] - scmvars.each { key, val -> env.setProperty(key, val) } - } - } - container('maven') { - sh 'jx gitops git setup' - sh 'rm -fr .tmp && make workspace' - } - } - } - stage('Install, run lint and build') { - steps { - gitStatusWrapper(credentialsId: 'pipeline-git-github', - gitHubContext: 'install-lint-build', - description: 'install, run lint and build', - successDescription: 'install, run lint and build', - failureDescription: 'install, run lint and build failed') { - container('maven') { - sh "make install-and-build" - } - } - } - } - /*stage('Run tests') { - steps { - gitStatusWrapper(credentialsId: 'pipeline-git-github', - gitHubContext: 'run-tests', - description: 'run tests', - successDescription: 'run tests', - failureDescription: 'run tests failed') { - container('maven') { - sh "make test" - } - } - } - }*/ - stage('Publish release') { - when { - buildingTag() - } - steps { - gitStatusWrapper(credentialsId: 'pipeline-git-github', - gitHubContext: 'publish-release', - description: 'release and publish released artifacts', - successDescription: 'release and publish released artifacts', - failureDescription: 'release and publish released artifacts failed') { - sh 'make release' - sh 'make publish-release-gh' - } - } - } - } -} - -def notifyIfMaster() { - if (BRANCH_NAME != 'master') { - return - } - step([$class: 'JiraIssueUpdater', issueSelector: [$class: 'DefaultIssueSelector'], scm: scm]) -} diff --git a/Jenkinsfile-pod.yaml b/Jenkinsfile-pod.yaml deleted file mode 100644 index ca4e93a0..00000000 --- a/Jenkinsfile-pod.yaml +++ /dev/null @@ -1,163 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - labels: - jenkins: slave - resource: pod - usage: build - name: bde-builder -spec: - containers: - - args: - - | - mkdir -p /data/upper - mkdir -p /data/work - mount -t overlay -o lowerdir=/data/lower,upperdir=/data/upper,workdir=/data/work overlay /home/jenkins/.m2 - chown -R 1000:412 /home/jenkins/.m2 - tail -f /dev/null - command: - - /bin/ash - - -e - - -x - - -c - - -- - image: busybox:glibc - lifecycle: - preStop: - exec: - command: - - umount - - /home/jenkins/.m2 - name: m2-settings-overlay - resources: - requests: - cpu: 0.1 - memory: 32Mi - securityContext: - privileged: true - runAsUser: 0 - volumeMounts: - - mountPath: /data - name: m2-settings-overlay-data - - mountPath: /data/lower - name: jenkins-m2-settings - - mountPath: /home/jenkins/.m2 - mountPropagation: Bidirectional - name: m2-settings-overlay - - name: maven - env: - - name: MAVEN_OPTS - value: -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - - name: M2_SETTINGS - valueFrom: - secretKeyRef: - key: M2_SETTINGS - name: nuxeo-nos-slave-boot-builder - - name: M2_SETTINGS_SECURITY - valueFrom: - secretKeyRef: - key: M2_SETTINGS_SECURITY - name: nuxeo-nos-slave-boot-builder - - name: M2_LOCAL_REPOSITORY - value: /home/jenkins/agent/m2-repository - - name: M2_TEAM_URL - value: http://nexus.jx.svc.cluster.local - - name: M2_CREDENTIALS_TEAM_USERNAME - valueFrom: - secretKeyRef: - key: M2_CREDENTIALS_TEAM_USERNAME - name: nuxeo-nos-slave-boot-builder - - name: M2_CREDENTIALS_TEAM_PASSWORD - valueFrom: - secretKeyRef: - key: M2_CREDENTIALS_TEAM_PASSWORD - name: nuxeo-nos-slave-boot-builder - - name: M2_PACKAGES_URL - valueFrom: - secretKeyRef: - key: M2_TEAM_URL - name: nuxeo-nos-slave-boot-builder - - name: M2_CREDENTIALS_PACKAGES_USERNAME - valueFrom: - secretKeyRef: - key: M2_CREDENTIALS_PACKAGES_USERNAME - name: nuxeo-nos-slave-boot-builder - - name: M2_CREDENTIALS_PACKAGES_PASSWORD - valueFrom: - secretKeyRef: - key: M2_CREDENTIALS_PACKAGES_PASSWORD - name: nuxeo-nos-slave-boot-builder - - name: GIT_AUTHOR_EMAIL - value: nos+jx@nuxeo.com - - name: GIT_COMMITTER_EMAIL - value: nos+jx@nuxeo.com - - name: GIT_COMMITTER_NAME - value: nuxeo-nos-jx - - name: GIT_AUTHOR_NAME - value: nuxeo-nos-jx - - name: XDG_CONFIG_HOME - value: /home/jenkins/.config - - name: JAVA_TOOL_OPTIONS - value: -Dsun.zip.disableMemoryMapping=true -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode - -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=90 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+UnlockExperimentalVMOptions - -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=3 - - name: MY_NODE_NAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - - name: MY_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: MY_POD_SERVICE_ACCOUNT - valueFrom: - fieldRef: - fieldPath: spec.serviceAccountName - - name: MY_POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - image: gcr.io/build-jx-prod/nuxeo/nos-builder-java8:0.0.28 - resources: - requests: - cpu: "1" - memory: 1Gi - tty: true - volumeMounts: - - mountPath: /home/jenkins/.m2 - mountPropagation: HostToContainer - name: m2-settings-overlay - - mountPath: /home/jenkins/agent - name: workspace-volume - - name: jnlp - image: jenkins/jnlp-slave - env: - - name: "JENKINS_TUNNEL" - value: "jenkins-operator-slave-master:50000" - volumeMounts: - - mountPath: /home/jenkins/agent - name: workspace-volume - priority: 0 - restartPolicy: Never - serviceAccountName: builder - securityContext: - runAsUser: 1000 - fsGroup: 412 # Group ID of docker group on k8s nodes. - volumes: - - name: git-credentials - secret: - secretName: pipeline-git-github - - name: jenkins-m2-settings - secret: - items: - - key: M2_SETTINGS_SECURITY - path: settings-security.xml - - key: M2_SETTINGS - path: settings.xml - secretName: nuxeo-nos-slave-boot-builder - - emptyDir: {} - name: m2-settings-overlay - - emptyDir: {} - name: m2-settings-overlay-data - - emptyDir: {} - name: workspace-volume \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 81eee69c..00000000 --- a/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -include make.d/make.mk -include make.d/version.mk -include make.d/nexus.mk - -in-ci ?= $(in-cluster) - - - -workspace: ## setup workspace, including npm and environment variables - -install-and-build: install build - -install: - npm $(if $(filter false,$(in-ci)),install,ci) - -.PHONY:install - -build: - npm run build - -.PHONY:build - -test: - npm run test - -.PHONY:test - -gulp-command = npx gulp - -release: ## Make release -release: version~print create-release - -create-release: export TAG_VERSION=$(version) - -create-release: - @: $(info Create release $(version-tag)) - $(gulp-command) release - -publish-release-gh: export GITHUB_USER=$(git-github-username) -publish-release-gh: export GITHUB_TOKEN=$(git-github-password) - -publish-release-gh: - gh release create $(version-tag) ./package/*/*.zip --title 'Nuxeo Browser Extension ${version-tag}' -n ' Release Note - Browser Developer Extensions - Version $(version-tag)' \ No newline at end of file diff --git a/ftest/itests.xml b/ftest/itests.xml deleted file mode 100644 index 842369db..00000000 --- a/ftest/itests.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ftest/pom.xml b/ftest/pom.xml deleted file mode 100644 index 182260f6..00000000 --- a/ftest/pom.xml +++ /dev/null @@ -1,251 +0,0 @@ - - 4.0.0 - - org.nuxeo.ecm.distribution - nuxeo-distribution - 11.1-SNAPSHOT - - - - nuxeo-browser-extension-ftest - Functional Tests for Nuxeo Browser Extension - - - ${nuxeo.platform.version} - - - - - org.nuxeo.ecm.distribution - nuxeo-server-tomcat - ${nuxeo.tested.version} - zip - provided - - - org.nuxeo.web.ui - nuxeo-web-ui-marketplace - 3.0.0-SNAPSHOT - zip - test - - - - - - default - - true - - - v10.16.3 - 6.11.3 - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - org.nuxeo.build - ant-assembly-maven-plugin - - ${basedir}/itests.xml - - - - start-tomcat - pre-integration-test - - build - - - - prepare-environment - start - - - - - stop-tomcat - post-integration-test - - build - verify - - - - stop - cleanup-environment - - true - ${project.build.directory}/${jsReportsDir} - ${project.build.directory}/${jsReportsDir}/js-summary.xml - - - - - - - com.github.eirslett - frontend-maven-plugin - 1.6 - - .. - target - ${nodeVersion} - ${npmVersion} - - - - install node and npm - - install-node-and-npm - - - - npm install - - npm - - - - npm gulp - - npm - - package - - run build - - - - npm test - - npm - - integration-test - - run test - - ${connectUsr} - ${connectPsw} - - - - - - - - - - - public - http://maven.nuxeo.org/nexus/content/groups/public - - true - - - false - - - - public-snapshot - http://maven.nuxeo.org/nexus/content/groups/public-snapshot - - false - - - always - true - - - - hotfix-releases - https://mavenin.nuxeo.com/nexus/content/repositories/hotfix-releases - - true - - - false - - - - hotfix-snapshots - https://mavenin.nuxeo.com/nexus/content/repositories/hotfix-snapshots - - false - - - always - true - - - - internal-snapshots - http://mavenin.nuxeo.com/nexus/content/groups/internal-snapshots - - false - - - true - never - - - - - - - public - http://maven.nuxeo.org/nexus/content/groups/public - Nuxeo virtual release repository - - true - - - false - - - - public-snapshot - http://maven.nuxeo.org/nexus/content/groups/public-snapshot - Nuxeo virtual snapshot repository - - false - - - always - true - - - - hotfix-releases - https://mavenin.nuxeo.com/nexus/content/repositories/hotfix-releases - - true - - - false - - - - hotfix-snapshots - https://mavenin.nuxeo.com/nexus/content/repositories/hotfix-snapshots - - false - - - always - true - - - - - diff --git a/ftest/src/test/resources/cors-config.xml b/ftest/src/test/resources/cors-config.xml deleted file mode 100644 index 42e275b5..00000000 --- a/ftest/src/test/resources/cors-config.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - /nuxeo/.* - - - diff --git a/make.d b/make.d deleted file mode 160000 index 237fe6fe..00000000 --- a/make.d +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 237fe6fe5eb9a10dad032716a265a9f46e5029e6