From 9f94eb084aa5942e49ff9774fef62270a2d5516b Mon Sep 17 00:00:00 2001 From: aaurandt Date: Thu, 27 Jul 2023 18:19:56 -0400 Subject: [PATCH 1/2] Delete old travis pipeline --- .travis.yml | 90 ----------------------------------------- Dockerfile | 54 ------------------------- Makefile-dockerenv | 64 ----------------------------- buildspec.yml | 38 ----------------- git-setup.sh | 26 ------------ repository/#site.xml# | 9 ----- repository/.gitignore | 2 - repository/category.xml | 29 ------------- repository/pom.xml | 32 --------------- 9 files changed, 344 deletions(-) delete mode 100644 .travis.yml delete mode 100644 Dockerfile delete mode 100644 Makefile-dockerenv delete mode 100644 buildspec.yml delete mode 100755 git-setup.sh delete mode 100644 repository/#site.xml# delete mode 100644 repository/.gitignore delete mode 100644 repository/category.xml delete mode 100644 repository/pom.xml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e31e69bf8..000000000 --- a/.travis.yml +++ /dev/null @@ -1,90 +0,0 @@ -sudo: true -dist: bionic -services: -- xvfb -language: java -jdk: -- openjdk8 -cache: - directories - - $HOME/.m2 - -addons: - apt: - packages: - - curl - - lmodern - - python - - python-pip - - python3 - - python3-pip - - texlive-full - - texlive-xetex - - texlive-luatex - - texlive-fonts-recommended - - wget - -env: - global: - - DISPLAY=:99.0 - - secure: m6iZc/uFRBN1OTPbalMh6c3BxVApQDWVM6yk7J3WPuJgLzs3GlxsXAsTBN+mnB6PxzVhPXCE19O/pr/L3h/fA+kHXwAyd771f77bbCZQgGw5fHaJw/m+oUMqNBd+EBtsAruGqM1dJoNZnb3vaJeBh8r+MX+pr0slrPIoD6tC20LmyIrX9iT1LPvJ9+L4OMNxtkPJQmBoOHtLKeF9CUN3Kjh23GvMYh0iXCRF5Yy2rXOXzQOr9tmsRA3NpDUNYn5CCbad7oPpmJ8gUWhI0cHKDexx2WtHGmy3mulQmhIrKihF/a12x8Re/ufET7bl0DyaXXUx8FEhR806a6AFmGWqYuT2sh95dYp0qR+/2t5QswqSZ6BWiFE9T7OcjpY9WY5KRjQTMZEzW0q4nhYBaerPH60BDTO68O/Dp3/iEy48yNg5cRUFWO7hJpodQBFglgjkoDTnL5R8rPyCl5+PvxnED244/rpknt2LranRB8BtLjTkfO0JW++6i3giByCBSnWmY0XB86wM3VCjI9/QgCHTVqPZ7CI7xfxB4RBIKPL+6/Bn+LAsJ1sdtcknuwG8lGaeyvfFaz11/mvBkrkQ7j5ipkTt8x1b9PzBkma7FGu7P6Huj4uOKphMDImo/tFJzKZCRYInUIkPysZAGCGrZdSuSdc+zwY5vd/HD6dhpcN1W5g= - -branches: - except: - - master-support-osate-2.9.0 - -before_install: -- pip2 install --user --upgrade pip -- pip2 install --user pandocfilters -- pip3 install --user --upgrade pip -- pip3 install --user testresources -- pip3 install --user --upgrade setuptools setuptools_rust -- pip3 install --user boto3 GitPython github3.py mako pandocfilters -- wget https://github.com/jgm/pandoc/releases/download/2.12/pandoc-2.12-1-amd64.deb -- sudo dpkg -i pandoc-2.12-1-amd64.deb -- wget -O - https://github.com/lierdakil/pandoc-crossref/releases/download/v0.3.10.0/pandoc-crossref-Linux.tar.xz | sudo tar -C /bin -xJ -- ls -la /bin/pandoc* -- "./git-setup.sh" - -install: /bin/true - -script: -- mvn -Dmaven.agree.docs.build=true clean verify - -before_deploy: -- rm -rf s3-tools && git clone --depth 1 https://github.com/loonwerks/s3-tools.git -- export RELEASE_PKG_FILE=$(ls repository/target/com.rockwellcollins.atc.agree.repository-*.zip) -- echo "deploying $RELEASE_PKG_FILE to GitHub releases" -- export SNAPSHOT_NUMBER=$(ls repository/target/repository/plugins/com.rockwellcollins.atc.agree_*.jar - | grep -o "[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\.[0-9]\\{12\\}") -- echo "deploying snapshot number $SNAPSHOT_NUMBER" - -deploy: -- provider: releases - api-key: "$GH_TOKEN" - file: - - "${RELEASE_PKG_FILE}" - - "com.rockwellcollins.atc.agree.doc/src-gen/AGREE Users Guide.docx" - - "com.rockwellcollins.atc.agree.doc/src-gen/AGREE Users Guide.pdf" - name: Continuous Integration Build ($SNAPSHOT_NUMBER) - body: Automated AGREE integration build of $TRAVIS_BRANCH ($TRAVIS_COMMIT) built - by Travis CI on $(date +'%F %T %Z'). - prerelease: true - overwrite: false - skip_cleanup: true - target_commitish: "$TRAVIS_COMMIT" - on: - branch: master -- provider: script - script: python3 .travis/manage_daily_builds.py "Continuous Integration Build" - on: - branch: master -- provider: script - script: python3 s3-tools/s3tools/DeployToP2CompositeRepository.py --path repository/target/repository --prefix p2/snapshots/agree --child-name agree_$SNAPSHOT_NUMBER --logging DEBUG - skip_cleanup: true - on: - branch: master -- provider: script - script: python3 s3-tools/s3tools/ManageSnapshots.py --prefix p2/snapshots/agree --logging=DEBUG - on: - branch: master diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 87ea2347e..000000000 --- a/Dockerfile +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (c) 2021, Collins Aerospace. -# Developed with the sponsorship of Defense Advanced Research Projects Agency (DARPA). -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of this data, -# including any software or models in source or binary form, as well as any drawings, specifications, -# and documentation (collectively "the Data"), to deal in the Data without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Data, and to permit persons to whom the Data is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all copies or -# substantial portions of the Data. -# -# THE DATA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS, SPONSORS, DEVELOPERS, CONTRIBUTORS, OR COPYRIGHT HOLDERS BE LIABLE -# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE DATA OR THE USE OR OTHER DEALINGS IN THE DATA. - -ARG BASE_IMG=maven:3-eclipse-temurin-17-focal -#ARG BASE_IMG=maven:3.6.3-jdk-11 -#ARG BASE_IMG=ubuntu:18.04 -FROM $BASE_IMG - -ARG UID -ARG UNAME -ARG GID -ARG GROUP - -RUN groupadd -fg "${GID}" "${GROUP}" \ - && groupmod -g "${GID}" "${GROUP}" \ - && useradd -u "${UID}" -g "${GID}" "${UNAME}" \ - && passwd -d "${UNAME}" \ - && mkdir "/home/${UNAME}" \ - && chown -R "${UNAME}":"${GROUP}" "/home/${UNAME}" \ - && chmod -R ug+rw "/home/${UNAME}" - -VOLUME /home/${UNAME} - -RUN apt-get -q update \ - && apt-get -y -q install curl sudo texlive-xetex texlive-luatex vim wget \ - && apt-get install -y --no-install-recommends xvfb openjfx \ - && apt-get clean autoclean \ - && apt-get autoremove --purge --yes \ - && rm -rf /var/lib/apt/lists/* - -RUN wget https://github.com/jgm/pandoc/releases/download/2.12/pandoc-2.12-1-amd64.deb \ - && sudo dpkg -i pandoc-2.12-1-amd64.deb - -WORKDIR /bin - -RUN wget -O - https://github.com/lierdakil/pandoc-crossref/releases/download/v0.3.10.0/pandoc-crossref-Linux.tar.xz | tar -xJ - -WORKDIR /host diff --git a/Makefile-dockerenv b/Makefile-dockerenv deleted file mode 100644 index eb8ebd381..000000000 --- a/Makefile-dockerenv +++ /dev/null @@ -1,64 +0,0 @@ -#! /usr/bin/make -# -# Copyright (c) 2021, Collins Aerospace. -# Developed with the sponsorship of Defense Advanced Research Projects Agency (DARPA). -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of this data, -# including any software or models in source or binary form, as well as any drawings, specifications, -# and documentation (collectively "the Data"), to deal in the Data without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Data, and to permit persons to whom the Data is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all copies or -# substantial portions of the Data. -# -# THE DATA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS, SPONSORS, DEVELOPERS, CONTRIBUTORS, OR COPYRIGHT HOLDERS BE LIABLE -# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE DATA OR THE USE OR OTHER DEALINGS IN THE DATA. - -# Extra vars -DOCKER_BUILD ?= docker build -DOCKER_FLAGS ?= --force-rm=true -ifndef EXEC - EXEC := bash - DOCKER_RUN_FLAGS += -it -endif - -# Volumes -DOCKER_VOLUME_HOME ?= $(shell whoami)-home - -# Interactive images -HOST_DIR ?= $(shell pwd) -USER_IMG := user_agree_build-$(shell whoami) -EXTRA_DOCKER_RUN_ARGS := -u $(shell id -u):$(shell id -g) - -.PHONY: user -user: build_user user_run - -.PHONY: -build_user: - $(DOCKER_BUILD) $(DOCKER_FLAGS) \ - --build-arg=UNAME=$(shell whoami) \ - --build-arg=UID=$(shell id -u) \ - --build-arg=GID=$(shell id -g) \ - --build-arg=GROUP=$(shell id -gn) \ - -f Dockerfile \ - -t $(USER_IMG) \ - . - -.PHONY: user_run -user_run: - docker run \ - $(DOCKER_RUN_FLAGS) \ - --hostname in-container \ - --rm \ - $(EXTRA_DOCKER_RUN_ARGS) \ - --group-add sudo \ - -v $(HOST_DIR):/host:z \ - -v $(DOCKER_VOLUME_HOME):/home/$(shell whoami) \ - -v /etc/localtime:/etc/localtime:ro \ - $(USER_IMG) $(EXEC) - diff --git a/buildspec.yml b/buildspec.yml deleted file mode 100644 index 2f121e291..000000000 --- a/buildspec.yml +++ /dev/null @@ -1,38 +0,0 @@ -version: 0.2 - -phases: - install: - runtime-versions: - java: corretto11 - pre_build: - commands: - - echo Nothing to do in the pre_build phase... - build: - on-failure: ABORT - commands: - - echo Build started on `date` - - mvn clean verify - post_build: - on-failure: ABORT - commands: - - echo Build completed on `date` - - export RELEASE_PKG_FILE=$(ls repository/target/com.rockwellcollins.atc.agree.repository-*.zip) - - echo "Release package file is $RELEASE_PKG_FILE" - - echo "CODEBUILD_BUILD_ARN = $CODEBUILD_BUILD_ARN" - - | - if expr "${CODEBUILD_BUILD_ARN}" : ".*agree-devops-tooling-pipeline-stable" >/dev/null ; then - export SNAPSHOT_NUMBER=$(ls repository/target/repository/plugins/com.rockwellcollins.atc.agree_*.jar | grep -o "[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\.[0-9]\\{12\\}") && - echo "deploying snapshot number $SNAPSHOT_NUMBER" && - rm -rf s3-tools && git clone --depth 1 https://github.com/loonwerks/s3-tools.git && - pip3 install --user mako && - python3 s3-tools/s3tools/DeployToP2CompositeRepository.py --path repository/target/repository --prefix p2/snapshots/agree --child-name agree_$SNAPSHOT_NUMBER --logging=INFO && - python3 s3-tools/s3tools/ManageSnapshots.py --prefix p2/snapshots/agree --logging=INFO && - echo Deploy completed on `date` - fi -artifacts: - files: - - repository/target/repository/**/* -cache: - paths: - - '/root/.m2/**/*' - diff --git a/git-setup.sh b/git-setup.sh deleted file mode 100755 index f3ae82398..000000000 --- a/git-setup.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2021, Collins Aerospace. -# Developed with the sponsorship of Defense Advanced Research Projects Agency (DARPA). -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of this data, -# including any software or models in source or binary form, as well as any drawings, specifications, -# and documentation (collectively "the Data"), to deal in the Data without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Data, and to permit persons to whom the Data is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all copies or -# substantial portions of the Data. -# -# THE DATA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS, SPONSORS, DEVELOPERS, CONTRIBUTORS, OR COPYRIGHT HOLDERS BE LIABLE -# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE DATA OR THE USE OR OTHER DEALINGS IN THE DATA. - -git config --global user.email "travis@travis-ci.org" -git config --global user.name "Travis CI" - -git remote add origin-with-token https://${GH_TOKEN}@github.com/loonwerks/AGREE.git > /dev/null 2>&1 - diff --git a/repository/#site.xml# b/repository/#site.xml# deleted file mode 100644 index 86f42b2f3..000000000 --- a/repository/#site.xml# +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - adsf - - - \ No newline at end of file diff --git a/repository/.gitignore b/repository/.gitignore deleted file mode 100644 index 66cc71077..000000000 --- a/repository/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target/ - diff --git a/repository/category.xml b/repository/category.xml deleted file mode 100644 index 055b2bbed..000000000 --- a/repository/category.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/repository/pom.xml b/repository/pom.xml deleted file mode 100644 index 5a736c66d..000000000 --- a/repository/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - 4.0.0 - - com.rockwellcollins.atc.agree - com.rockwellcollins.atc.agree.parent - 2.10.1-SNAPSHOT - - com.rockwellcollins.atc.agree.repository - 2.9.2-SNAPSHOT - eclipse-repository - - - - - org.eclipse.tycho - tycho-p2-repository-plugin - ${tycho.version} - - - assemble-repository - package - - assemble-repository - - - - - - - - From 245d659aacdfee870372381b04e670ca5362061a Mon Sep 17 00:00:00 2001 From: aaurandt Date: Thu, 27 Jul 2023 18:21:27 -0400 Subject: [PATCH 2/2] Add new CI/CD pipeline --- .github/workflows/build_and_test.yml | 25 +++ .github/workflows/release.yml | 131 ++++++++++++++ .github/workflows/snapshot.yml | 163 ++++++++++++++++++ README.md | 121 +++++-------- com.rockwellcollins.atc.agree.site/.project | 17 ++ .../org.eclipse.core.resources.prefs | 2 + .../.settings/org.eclipse.m2e.core.prefs | 4 + .../org.eclipse.xtend.core.Xtend.prefs | 7 + .../category.xml | 29 ++++ .../packaging-p2composite.ant | 154 +++++++++++++++++ com.rockwellcollins.atc.agree.site/pom.xml | 30 ++++ pom.xml | 70 +++++++- 12 files changed, 668 insertions(+), 85 deletions(-) create mode 100644 .github/workflows/build_and_test.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/snapshot.yml create mode 100644 com.rockwellcollins.atc.agree.site/.project create mode 100644 com.rockwellcollins.atc.agree.site/.settings/org.eclipse.core.resources.prefs create mode 100644 com.rockwellcollins.atc.agree.site/.settings/org.eclipse.m2e.core.prefs create mode 100644 com.rockwellcollins.atc.agree.site/.settings/org.eclipse.xtend.core.Xtend.prefs create mode 100644 com.rockwellcollins.atc.agree.site/category.xml create mode 100644 com.rockwellcollins.atc.agree.site/packaging-p2composite.ant create mode 100644 com.rockwellcollins.atc.agree.site/pom.xml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 000000000..65e1b84c7 --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,25 @@ +name: Build and Test Project + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + types: [opened, reopened, edited] + +jobs: + verify: + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set Up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install Dependencies + run: sudo apt-get install -y pandoc + - name: Compile and Test Maven Project + run: mvn clean verify \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..605e90c34 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,131 @@ +name: Push and publish release to GitHub + +on: + push: + tags: + - '*' + +jobs: + parse_tag: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.tag_ref.outputs._0 }} + suffix: ${{ steps.tag_ref.outputs._1 }} + steps: + - name: Get version number + uses: jungwinter/split@v2 + id: tag_ref + with: + msg: ${{ github.ref_name }} + separator: '-' + + verify: + runs-on: ubuntu-latest + needs: parse_tag + if: ${{ needs.parse_tag.outputs.suffix == 'RELEASE' }} + steps: + - uses: actions/checkout@v3 + - name: Set Up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install Dependencies + run: sudo apt-get install -y pandoc + - name: Build release + run: mvn verify -Pbuild-release + - name: Upload p2 repo artifact + uses: actions/upload-artifact@v3 + with: + name: p2-artifact + path: ${{ github.workspace }}/com.rockwellcollins.atc.agree.site/target/repository/ + + parse_version: + runs-on: ubuntu-latest + needs: verify + outputs: + version: ${{ env.RELEASE_VERSION }} + steps: + - name: Download p2 repo artifact + uses: actions/download-artifact@v3 + with: + name: p2-artifact + path: ${{ github.workspace }}/p2-artifact + - name: Parse version number + run: echo "RELEASE_VERSION=$(ls ${{ github.workspace }}/p2-artifact/features/com.rockwellcollins.atc.agree.feature_*.jar | grep -o "[0-9]\\+\\.[0-9]\\+\\.[0-9]")" >> $GITHUB_ENV + + publish: + runs-on: ubuntu-latest + needs: [verify, parse_tag, parse_version] + if: ${{ needs.parse_tag.outputs.version == needs.parse_version.outputs.version }} + steps: + - uses: actions/checkout@v3 + - name: Set Up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install Eclipse + run: sudo snap install --classic eclipse + - name: Checkout current update site + uses: actions/checkout@v3 + with: + repository: loonwerks/AGREE-Updates + path: AGREE-Updates + ssh-key: ${{ secrets.DEPLOY_KEY }} + persist-credentials: true + - name: Download p2 repo artifact + uses: actions/download-artifact@v3 + with: + name: p2-artifact + path: ${{ github.workspace }}/p2-artifact + - name: Rename p2-artifact and move to release directory + run: | + mv ${{ github.workspace }}/p2-artifact ${{ github.workspace }}/${{ needs.parse_tag.outputs.version }} + mkdir -p ${{ github.workspace }}/AGREE-Updates/releases + mv ${{ github.workspace }}/${{ needs.parse_tag.outputs.version }} ${{ github.workspace }}/AGREE-Updates/releases + - name: Build with Ant + run: java -jar $(find /snap/eclipse -name org.eclipse.equinox.launcher_*.jar) -application org.eclipse.ant.core.antRunner -buildfile ${{ github.workspace }}/com.rockwellcollins.atc.agree.site/packaging-p2composite.ant p2.composite.add.release -Dcomposite.base.dir=${{ github.workspace }}/AGREE-Updates -Dfull.version=${{ needs.parse_tag.outputs.version }} + - name: Push new release to AGREE-Updates + run: | + cd AGREE-Updates + git config --global user.name 'GitHub Actions' + git config --global user.email 'GH_Actions@users.noreply.github.com' + git add . + git commit -m 'Release ${{ needs.parse_tag.outputs.version }}' + git push + + release: + runs-on: ubuntu-latest + needs: [verify, parse_tag, parse_version] + if: ${{ needs.parse_tag.outputs.version == needs.parse_version.outputs.version }} + steps: + - name: Get current date + id: date + run: echo "date=$(date +'%B %e, %Y')" >> $GITHUB_ENV + - name: Download p2 repo artifact + uses: actions/download-artifact@v3 + with: + name: p2-artifact + - name: Zip Release + uses: thedoctor0/zip-release@0.7.1 + with: + type: 'zip' + filename: 'com.rockwellcollins.atc.agree.repository-${{ needs.parse_tag.outputs.version }}.zip' + - name: Create Release + uses: ncipollo/release-action@v1 + with: + name: Release ${{ needs.parse_tag.outputs.version }} + artifacts: 'com.rockwellcollins.atc.agree.repository-${{ needs.parse_tag.outputs.version }}.zip' + body: | + # Version ${{ needs.parse_tag.outputs.version }} + + - GIT tag: ${{ github.ref_name }} + - Release date: ${{ env.date }} + - OSATE version: 2.12.0 + - Eclipse base version: 2022-06 + - Java version: Java 17 + - Eclipse Update-Site: https://loonwerks.github.io/AGREE-Updates/releases/${{ needs.parse_tag.outputs.version }} + generateReleaseNotes: true \ No newline at end of file diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml new file mode 100644 index 000000000..1c3c97226 --- /dev/null +++ b/.github/workflows/snapshot.yml @@ -0,0 +1,163 @@ +name: Push snapshot to Github Pages + +on: + workflow_run: + workflows: [Build and Test Project] + types: [completed] + branches: [master] + +jobs: + verify: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success'}} + steps: + - uses: actions/checkout@v3 + - name: Set Up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install Dependencies + run: sudo apt-get install -y pandoc + - name: Build snapshot + run: mvn verify -Pbuild-snapshot + - name: Upload p2 repo artifact + uses: actions/upload-artifact@v3 + with: + name: p2-artifact + path: ${{ github.workspace }}/com.rockwellcollins.atc.agree.site/target/repository/ + + publish: + runs-on: ubuntu-latest + needs: verify + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Install Eclipse + run: sudo snap install --classic eclipse + - name: Checkout current update site + uses: actions/checkout@v3 + with: + repository: loonwerks/AGREE-Updates + path: AGREE-Updates + ssh-key: ${{ secrets.DEPLOY_KEY }} + persist-credentials: true + - name: Download p2 repo artifact + uses: actions/download-artifact@v3 + with: + name: p2-artifact + path: ${{ github.workspace }}/p2-artifact + - name: Parse version number + run: echo "SNAPSHOT_VERSION=$(ls ${{ github.workspace }}/p2-artifact/features/com.rockwellcollins.atc.agree.feature_*.jar | grep -o "[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\.[0-9]\\{12\\}")" >> $GITHUB_ENV + - name: Rename p2-artifact and move to snapshot directory + run: | + mv ${{ github.workspace }}/p2-artifact ${{ github.workspace }}/${{ env.SNAPSHOT_VERSION }} + mkdir -p ${{ github.workspace }}/AGREE-Updates/snapshots + mv ${{ github.workspace }}/${{ env.SNAPSHOT_VERSION }} ${{ github.workspace }}/AGREE-Updates/snapshots + - name: Build with Ant + run: java -jar $(find /snap/eclipse -name org.eclipse.equinox.launcher_*.jar) -application org.eclipse.ant.core.antRunner -buildfile ${{ github.workspace }}/com.rockwellcollins.atc.agree.site/packaging-p2composite.ant p2.composite.add.snapshot -Dcomposite.base.dir=${{ github.workspace }}/AGREE-Updates -Dfull.version=${{ env.SNAPSHOT_VERSION }} + - name: Push new snapshot to AGREE-Updates + run: | + cd AGREE-Updates + git config --global user.name 'GitHub Actions' + git config --global user.email 'GH_Actions@users.noreply.github.com' + git add . + git commit -m 'Snapshot ${{ env.SNAPSHOT_VERSION }}' + git push + + find_snapshots_to_delete: + runs-on: ubuntu-latest + needs: publish + outputs: + delete_snapshots: ${{ steps.python_script.outputs.delete_snapshots }} + matrix: ${{ steps.python_script.outputs.snapshots_to_delete }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set Up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Checkout current update site + uses: actions/checkout@v3 + with: + repository: loonwerks/AGREE-Updates + path: AGREE-Updates + - name: Install GitPython + run: pip install GitPython + - name: Run python script + uses: jannekem/run-python-script-action@v1 + id: python_script + with: + script: | + import os + import git + import json + repo = git.Repo(os.getcwd()) + tags = str(repo.tags).split(",") + path = os.path.join(os.getcwd(), "AGREE-Updates/snapshots") + snapshots = sorted([f for f in os.listdir(path) if os.path.isdir(os.path.join(path, f))]) + snapshots_to_delete = list() + for i in range(len(snapshots)-10): + tag_protected = False + for tag in tags: + tag = tag[tag.find("\"refs/tags/")+11:tag.rfind("\"")] + if (snapshots[i] + "-SNAPSHOT") == tag: + tag_protected = True + break + if not tag_protected: + set_output("delete_snapshots", "true") + snapshots_to_delete.append(snapshots[i]) + set_output("snapshots_to_delete", json.dumps(snapshots_to_delete)) + + delete_snapshots: + runs-on: ubuntu-latest + needs: find_snapshots_to_delete + if: ${{ needs.find_snapshots_to_delete.outputs.delete_snapshots == 'true' }} + strategy: + matrix: + version: ${{ fromJson(needs.find_snapshots_to_delete.outputs.matrix) }} + max-parallel: 1 + steps: + - uses: actions/checkout@v3 + - name: Set Up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install Eclipse + run: sudo snap install --classic eclipse + - name: Checkout current update site + uses: actions/checkout@v3 + with: + repository: loonwerks/AGREE-Updates + path: AGREE-Updates + ssh-key: ${{ secrets.DEPLOY_KEY }} + persist-credentials: true + - name: Install git filter repo + run: sudo apt-get install git-filter-repo + - name: Push changes to git + run: | + cd AGREE-Updates + git config --global user.name 'GitHub Actions' + git config --global user.email 'GH_Actions@users.noreply.github.com' + java -jar $(find /snap/eclipse -name org.eclipse.equinox.launcher_*.jar) -application org.eclipse.ant.core.antRunner -buildfile ${{ github.workspace }}/com.rockwellcollins.atc.agree.site/packaging-p2composite.ant p2.composite.remove.snapshot -Dcomposite.base.dir=${{ github.workspace }}/AGREE-Updates -Dfull.version=${{ matrix.version }} + git add . + git commit -m 'Delete Snapshot ${{ matrix.version }}' + git push + git filter-repo --invert-paths --path snapshots/${{ matrix.version }} --force + git remote add origin git@github.com:loonwerks/AGREE-Updates + git push origin --force --all + \ No newline at end of file diff --git a/README.md b/README.md index ec6738cce..5f55ce4f4 100644 --- a/README.md +++ b/README.md @@ -138,83 +138,44 @@ the issue base the branch might be named 'fix-issue-x' where x is the sequence number assigned to the issue. Tags are typically reserved for releases, but may be used to mark -special points in the development process. - -### Continuous Integration / Continuous Deployment - -AGREE continuous integration is carried out at -[Amazon CodeBuild](https://aws.amazon.com). Builds of developmental -snapshots are uploaded to the AWS bucket -[AGREE snapshots](http://ca-trustedsystems-dev-us-east-1.s3-website-us-east-1.amazonaws.com/p2/snapshots/agree/) page. -Additionally, CodeBuild conducts builds and tests in response to pull -requests against the AGREE repository. - -### Releases (Updated!) - -Since AGREE has converted to the [Semantic -Versioning](https://semver.org/) model, each of the plugins that -compose the AGREE, TCG, and AADL Simulator features now have -individual version numbers that reflect the updates to that plugin. -Thus, they are no longer synchronized to the feature versions. - -The AGREE code base has been modified to enable Eclipse plugin API -analysis which will result in error messages and warnings (in the -"Problems" tab of the IDE) to guide developers as to how and when to -update version numbers and apply API tags such as @since to added or -modified elements. The Oomph version management analysis has also -been enabled to assist with version number markings. - -The process for a release updates master branch with the release -version number, commits the master branch version number updates, -builds the release version, updates the version numbering to the new -development snapshot numbers, and finally commits the master branch -with the new development version numbering. To accomplish the release -preparation, the AGREE release process applies the [Tycho Release -Workflow](https://wiki.eclipse.org/Tycho/Release_Workflow) to help -automate the process. The steps in the release workflow are as -follows: - -1. Prepare for the release by running the release workflow plugin: - - `mvn release:prepare` - - During this process maven will ask to confirm all of the plugin and - feature versions and for the tag to applied to the - release. Release tags shall be of the form 'x.y.z-RELEASE' where - `x` is the major version number, `y` is the minor version number, - and `z` is the patch version number. - -1. Ordinarily one would expect to actually perform the release using - the customary `mvn release:perform -Dgoals="clean verify"` command. - However, this appears to run into difficulty fetching the appropriate - tag to build. Instead do the following: - - `git checkout x.x.x-RELEASE` - `mvn clean verify` - - where `x.x.x` is the version number to be released. - -1. Commit the release binaries into the companion releases repository at - git@github.com:loonwerks/AGREE-Updates.git: - - `cp -r /repository/target/repository agree-` - - Update the contents of the compositeArtifacts.xml and compositeContent.xml files. - - `git add ...` - - `git commit -m "Add AGREE "` - -1. Finally, push the update stable branch to the origin repository: - - `git push` - -Note that the previous instructions assume that the developer has set -up appropriate ssh keys such that interactive query for authentication -is necessary. If this is not done, the `release:prepare` and -`release:perform` steps will apparently just hang when such -interaction is required as they are in fact headless operations. -Alternatively to setting up ssh keys, the developer may add necessary -authenication information to the maven settings as described in [Tycho -Release Workflow -- Configure the -SCM](https://wiki.eclipse.org/Tycho/Release_Workflow#Configure_the_SCM). +special points in the development process (i.e. snapshot tags). + +## Continuous Integration / Continuous Deployment +The CI/CD pipeline is carried out via GitHub actions. There are three different workflows defined. They are as follows: + 1. "Build and Test Project" (defined in [.github/workflows/build_and_test.yml](https://github.com/loonwerks/AGREE/blob/main/.github/workflows/build_and_test.yml)) + - Trigger(s): + * push is made to master + * pull request is opened, reopened, or editted + - Job(s): + * *verify*: verifies that the project builds without errors and all tests pass by running the command `mvn clean verify` + 2. "Push snapshot to Github Pages" (defined in [.github/workflows/snapshot.yml](https://github.com/loonwerks/AGREE/blob/main/.github/workflows/snapshot.yml)) + - Trigger(s): + * "Build and Test Project" successfully completes on master branch + - Job(s): + * *verify*: verifies that the project builds without errors all tests pass, and build is a snapshot by running the command `mvn verify -Pbuild-snapshot` + * *publish*: publishes the p2 repo of the current build to [AGREE-Updates/snapshots/x.x.x.yyyyMMddHHmm](https://github.com/loonwerks/AGREE-Updates) + * *find_snapshots_to_delete*: finds snapshots that should be deleted; the repo only keeps the 10 latest snapshots and those that have a tag + * *delete_snapshots*: deletes the snapshots indicated in *find_snapshots_to_delete* + 3. "Push and publish release to GitHub" (defined in [.github/workflows/release.yml](https://github.com/loonwerks/AGREE/blob/main/.github/workflows/release.yml)) + - Trigger(s): + * a tag was pushed + - Job(s): + * *parse_tag*: parses the tag "x.x.x-RELEASE" into "x.x.x" and "RELEASE" + * *verify*: if the suffix of tag is "-RELEASE", verifies that the project builds without errors all tests pass, and build is a release by running the command `mvn verify -Pbuild-release` + * *parse_version*: parses the version from the built p2 repo + * *publish*: if the tag and version of the built p2 repo match, publishes the p2 repo of the current build to [AGREE-Updates/releases/x.x.x](https://github.com/loonwerks/AGREE-Updates) + * *release*: if the tag and version of the built p2 repo match, generates a release on the AGREE repo and attaches the p2 repo as an artifact + +**Important Details about Snapshot Tags** +- The tag should be in the format x.x.x.yyyyMMddHHmm-SNAPSHOT where x is the major version number, y is the minor version number, and z is the patch version number. +- Make the tag by using the following git commands: + 1. `git tag x.x.x.yyyyMMddHHmm-SNAPSHOT` + 2. `git push origin x.x.x.yyyyMMddHHmm-SNAPSHOT` +- The tag number should match an already existing snapshot. + +**Important Details about Release Tags** +- The tag should be in the format x.x.x-RELEASE where x is the major version number, y is the minor version number, and z is the patch version number. +- Make the tag by using the following git commands: + 1. `git tag x.x.x-RELEASE` + 2. `git push origin x.x.x-RELEASE` +- The version number of com.rockwellcollins.atc.agree needs to match the tag number when triggering a release. diff --git a/com.rockwellcollins.atc.agree.site/.project b/com.rockwellcollins.atc.agree.site/.project new file mode 100644 index 000000000..4aaabba5b --- /dev/null +++ b/com.rockwellcollins.atc.agree.site/.project @@ -0,0 +1,17 @@ + + + com.rockwellcollins.atc.agree.site + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/com.rockwellcollins.atc.agree.site/.settings/org.eclipse.core.resources.prefs b/com.rockwellcollins.atc.agree.site/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000..99f26c020 --- /dev/null +++ b/com.rockwellcollins.atc.agree.site/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/com.rockwellcollins.atc.agree.site/.settings/org.eclipse.m2e.core.prefs b/com.rockwellcollins.atc.agree.site/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 000000000..a75e3af42 --- /dev/null +++ b/com.rockwellcollins.atc.agree.site/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles=>build-release, build-snapshot +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/com.rockwellcollins.atc.agree.site/.settings/org.eclipse.xtend.core.Xtend.prefs b/com.rockwellcollins.atc.agree.site/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 000000000..fdf3191a5 --- /dev/null +++ b/com.rockwellcollins.atc.agree.site/.settings/org.eclipse.xtend.core.Xtend.prefs @@ -0,0 +1,7 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/main/java.directory=xtend-gen +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=xtend-gen +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true diff --git a/com.rockwellcollins.atc.agree.site/category.xml b/com.rockwellcollins.atc.agree.site/category.xml new file mode 100644 index 000000000..055b2bbed --- /dev/null +++ b/com.rockwellcollins.atc.agree.site/category.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/com.rockwellcollins.atc.agree.site/packaging-p2composite.ant b/com.rockwellcollins.atc.agree.site/packaging-p2composite.ant new file mode 100644 index 000000000..692e41dab --- /dev/null +++ b/com.rockwellcollins.atc.agree.site/packaging-p2composite.ant @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + version=1.0.0 + metadata.repository.factory.order=compositeContent.xml,\! + artifact.repository.factory.order=compositeArtifacts.xml,\! + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/com.rockwellcollins.atc.agree.site/pom.xml b/com.rockwellcollins.atc.agree.site/pom.xml new file mode 100644 index 000000000..81fe5873b --- /dev/null +++ b/com.rockwellcollins.atc.agree.site/pom.xml @@ -0,0 +1,30 @@ + + 4.0.0 + + com.rockwellcollins.atc.agree + com.rockwellcollins.atc.agree.parent + 2.10.1-SNAPSHOT + + + com.rockwellcollins.atc.agree.site + 2.9.2-SNAPSHOT +eclipse-repository + + + + org.eclipse.tycho + tycho-p2-repository-plugin + ${tycho.version} + + + assemble-repository + package + + assemble-repository + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 83f4b8d38..e64ef793a 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ edu.uah.rsesc.aadlsimulator.xtext.ui com.rockwellcollins.atc.tcg com.rockwellcollins.atc.tcg.feature - repository + com.rockwellcollins.atc.agree.site @@ -94,11 +94,71 @@ --add-modules=ALL-SYSTEM + + build-release + + false + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0 + + + enforce-no-snapshots + + enforce + + + + + No Snapshots Allowed! + + + true + + + + + + + + - build-update-site - - update-site - + build-snapshot + + false + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0 + + + enforce-no-releases + + enforce + + + + + No Releases Allowed! + + + true + + + + + + +