diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 8d231502..d1f61b59 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -21,13 +21,14 @@ jobs: JAVA_VERSION: ${{ matrix.java-version }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: ${{ matrix.java-version }} + distribution: 'temurin' - name: Cache local Maven repository - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} diff --git a/bamboo-specs/bamboo.yml b/bamboo-specs/bamboo.yml new file mode 100644 index 00000000..4a1709b1 --- /dev/null +++ b/bamboo-specs/bamboo.yml @@ -0,0 +1,171 @@ +--- +version: 2 +plan: + project-key: AS + key: ASML + name: Appointments Scheduling Module Latest + description: Runs unit test and deploys artifacts to maven repo. More details of the release in https://wiki.openmrs.org/x/i4DTAw +stages: +- Build and Test: + manual: false + final: false + jobs: + - Build and Test JDK 8 +- Deploy: + manual: false + final: false + jobs: + - Deploy to Maven +- Release: + manual: true + final: false + jobs: + - Release to Maven +Build and Test JDK 8: + key: BTJ8 + tasks: + - checkout: + force-clean-build: false + description: Checkout default repository + - script: + interpreter: SHELL + scripts: + - |- + #!/bin/bash -eu + + set -x + + docker run -v m2-repo:/root/.m2/repository -v ${PWD}:/module --rm -w="/module" maven:3.9.9-amazoncorretto-8 bash -c 'mvn clean package -B' + description: Build and test + artifact-subscriptions: [] +Deploy to Maven: + key: DTM + tasks: + - checkout: + force-clean-build: false + description: Checkout default repository + - script: + interpreter: SHELL + scripts: + - |- + #!/bin/bash -eu + + set -x + + docker pull ${bamboo.build.docker.image.id} + + docker run -v m2-repo:/root/.m2/repository -v ~/.m2/settings.xml:/.m2/settings.xml:ro -v ${PWD}:/module --rm -w="/module" ${bamboo.build.docker.image.id} bash -c 'mvn deploy -B -DskipTests --settings /.m2/settings.xml' + description: Deploy + artifact-subscriptions: [] +Release to Maven: + key: RTM + tasks: + - checkout: + force-clean-build: false + description: Checkout Default Repository + - checkout: + repository: openmrs-module-appointmentscheduling + path: release-scripts + force-clean-build: false + description: Checkout Release Scripts Repository + - script: + interpreter: SHELL + scripts: + - |- + #!/bin/bash -eu + + set -x + + docker pull ${bamboo.build.docker.image.id} + + docker run \ + -v m2-repo:/root/.m2/repository \ + -v ~/.m2/settings.xml:/root/.m2/settings.xml:ro \ + -v ${PWD}:/module \ + -v ~/.ssh/github:/root/.ssh:ro \ + -e GIT_USER_NAME=$GIT_USER_NAME \ + -e GIT_USER_EMAIL=$GIT_USER_EMAIL \ + -e GIT_SSH_COMMAND='ssh -i /root/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \ + --rm \ + -w='/module' \ + ${bamboo.build.docker.image.id} \ + bash -c ' + yum -y install git && + yum clean all && + git config --global user.email "$GIT_USER_EMAIL" && + git config --global user.name "$GIT_USER_NAME" && + git config --global --add safe.directory /module && + ./release-scripts/release-prepare-perform.sh \ + -r ${bamboo.maven.release.version} \ + -d ${bamboo.maven.development.version} \ + -e ${bamboo.planRepository.repositoryUrl} + ' + environment: GIT_USER_NAME=${bamboo.git.user.name} GIT_USER_EMAIL=${bamboo.git.user.email} + description: Release prepare perform + - any-task: + plugin-key: com.atlassian.bamboo.plugins.variable.updater.variable-updater-generic:variable-extractor + configuration: + variable: maven.release.version + removeSnapshot: 'true' + variableScope: PLAN + description: Save next release version + - any-task: + plugin-key: com.atlassian.bamboo.plugins.variable.updater.variable-updater-generic:variable-extractor + configuration: + variable: maven.development.version + variableScope: JOB + description: Retrieve next snaphot version + - command: + executable: Bash + argument: release-scripts/distro-update.sh -r "${bamboo.maven.release.version}" -d "${bamboo.maven.development.version}" -p "${bamboo.refapp.distro.property}" -s "${bamboo.refapp.distro.scm}" -b "${bamboo.refapp.distro.dev.branch}" -n "${bamboo.preparing.refapp.distro.release}" + environment: MAVEN_HOME="${bamboo.capability.system.builder.mvn3.Maven 3}" + description: Update distro with the new version + artifact-subscriptions: [] +variables: + build.docker.image.id: maven:3.9.9-amazoncorretto-8 + maven.development.version: 2.2.0-SNAPSHOT + maven.release.version: 2.1.0 + refapp.distro.property: appointmentschedulingVersion +repositories: +- openmrs-module-appointmentscheduling: + scope: global +- Release scripts: + scope: global +triggers: +- polling: + period: '180' + repositories: + - openmrs-module-appointmentscheduling +branches: + create: manually + delete: never + link-to-jira: true +notifications: +- events: + - job-failed + recipients: + - committers + - emails: + - dev-refapp@openmrs.org +labels: +- refapp +dependencies: + require-all-stages-passing: false + enabled-for-branches: true + block-strategy: none + plans: + - ASU-ASUML +other: + concurrent-build-plugin: + number-of-concurrent-builds: system-default + execution-strategy: block-triggering +--- +version: 2 +plan: + key: AS-ASML +plan-permissions: +- roles: + - anonymous + permissions: + - view +...