From fa2339a47b0ffc6f61f53b04030141d474b91542 Mon Sep 17 00:00:00 2001 From: Olivier Debenath Date: Wed, 22 Jan 2025 09:07:31 +0000 Subject: [PATCH] Added build P2 yaml --- .github/workflows/build-p2-site.yaml | 41 +++++++++++++++++++++ .github/workflows/maven.yaml | 55 ---------------------------- .github/workflows/pre-commit.yaml | 17 --------- 3 files changed, 41 insertions(+), 72 deletions(-) create mode 100644 .github/workflows/build-p2-site.yaml delete mode 100644 .github/workflows/maven.yaml delete mode 100644 .github/workflows/pre-commit.yaml diff --git a/.github/workflows/build-p2-site.yaml b/.github/workflows/build-p2-site.yaml new file mode 100644 index 0000000000..9cd785395b --- /dev/null +++ b/.github/workflows/build-p2-site.yaml @@ -0,0 +1,41 @@ +name: Build P2 Site + +env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + DEPLOY_SECRET: ${{ secrets.SSH_PRIVATE_KEY_ED25519_BASE64 }} + DOCKER_BUILD_IMAGE: ghcr.io/elexis/docker-build:2022-09-java17 + +on: + push: + workflow_dispatch: + +jobs: + build: + runs-on: [self-hosted, Linux, x64, Docker] + steps: + - uses: actions/checkout@v4 + - name: pull docker image ${{ env.DOCKER_BUILD_IMAGE }} + run: docker pull ${{ env.DOCKER_BUILD_IMAGE }} + - name: build using docker image ${{ env.DOCKER_BUILD_IMAGE }} + run: docker run --rm --init -v "$(pwd)":/usr/src/mymaven -v "$(eval echo ~$USER)/m2-${{ env.BRANCH_NAME }}":/root/.m2 -w /usr/src/mymaven ${{ env.DOCKER_BUILD_IMAGE }} xvfb-run mvn -V -T 1C clean verify -B -Dgit.core.branch=${{ env.BRANCH_NAME }} + - name: upload artifacts + run: | + eval $(ssh-agent -s) + ssh-add <(echo "${{ env.DEPLOY_SECRET }}" | base64 -d) + rsync -aiv --delete --mkpath -e ssh ch.elexis.base.p2site/target/repository/ deploy@download.medelexis.ch:download.elexis.info/elexis/${{ env.BRANCH_NAME }}/p2/elexis-3-base/ + eval $(ssh-agent -k) + - name: Trigger elexis-3-server Workflow + run: | + curl -X POST \ + --fail \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.TRIGGER_WORKFLOW_TOKEN }}" \ + https://api.github.com/repos/elexis/elexis-server/actions/workflows/build-p2-site.yaml/dispatches \ + -d '{"ref":"${{ env.BRANCH_NAME }}"}' + - name: Trigger gitlab medelexis-3-application Workflow + run: | + curl -X POST \ + --fail \ + -F token=${{ secrets.GITLAB_MEDELEXIS_3_APPLICATION_PIPELINE_TRIGGER_TOKEN }} \ + -F ref=${{ env.BRANCH_NAME }} \ + https://gitlab.medelexis.ch/api/v4/projects/13/trigger/pipeline diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml deleted file mode 100644 index bbe6f3a156..0000000000 --- a/.github/workflows/maven.yaml +++ /dev/null @@ -1,55 +0,0 @@ -# This workflow will build the Eclipse RCP application with Maven -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven - -name: Java CI with Maven - -on: - push: - pull_request: - workflow_dispatch: - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set locale de_CH.UTF-8 - run: | - sudo locale-gen de_CH.UTF-8 - sudo update-locale LANG=de_CH.UTF-8 - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - java-version: 17 - distribution: 'adopt' - - name: Install xvfb - run: sudo apt-get install xvfb - - name: Cache local Maven repository - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Build with Maven - run: | - HTTP_STATUS=`curl -LI https://download.elexis.info/elexis/${GITHUB_REF##*/}/p2/elexis-3-core/p2.index -o /dev/null -w '%{http_code}\n' -s` - echo for branch ${GITHUB_REF##*/} the HTTP_STATUS was ${HTTP_STATUS} - if [ "${HTTP_STATUS}" == "200" ]; then - echo Using ${GITHUB_REF##*/} - export BRANCH=${GITHUB_REF##*/} - else - export BRANCH=master - echo bad branch name. Trying master - fi - xvfb-run mvn -V clean verify -Dgit.core.branch=${BRANCH} - env: - LC_ALL: de_CH.UTF-8 - LANG: en_US.UTF-8 - - name: Publish Unit Test Results - uses: EnricoMi/publish-unit-test-result-action@v1 - if: always() - with: - files: ./tests/**/target/surefire-reports/TEST-*.xml diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml deleted file mode 100644 index 832b5a0f27..0000000000 --- a/.github/workflows/pre-commit.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: pre_commit -on: - pull_request: - push: - branches-ignore: [ '3.6', '3.7', '3.8'] - -jobs: - build: - name: Enforce-Eclipse-Format - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.3 - - run: pre-commit run --all-files - - run: pre-commit run --hook-stage manual enforce-eclipse-format --show-diff-on-failure --verbose --all-files