From 13b6effdb5c57eeb7a1fd221bb322b4a57aa7c4d Mon Sep 17 00:00:00 2001 From: jaguililla Date: Thu, 5 Sep 2024 19:54:07 +0200 Subject: [PATCH] Add nightly build to :CI --- .github/workflows/nightly.yml | 43 +++++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 18 +++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..95c9f79 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,43 @@ + +name: Nightly Build +on: + push: +# schedule: +# - cron: "59 23 * * *" + +permissions: read-all + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: SDKMAN Cache + uses: actions/cache@v4 + with: + path: ~/.sdkman + key: "${{ runner.os }}-sdkman-${{ hashFiles('.sdkmanrc') }}" + restore-keys: "${{ runner.os }}-sdkman-" + - name: Maven Cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: "${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}" + restore-keys: "${{ runner.os }}-maven-" + - name: Install SDKMAN + run: curl -s "https://get.sdkman.io?rcupdate=false" | bash + - name: Build Application + run: | + source "$HOME/.sdkman/bin/sdkman-init.sh" + sdk env install + + ./mvnw -P pitest + - name: Build Client + run: | + export CLIENT_PATH='target/generated-sources/openapi' + export CONTROLLERS_PATH='com/github/jaguililla/appointments/http/controllers' + + rm -rf "${CLIENT_PATH}/src/main/java/${CONTROLLERS_PATH}" + mvn -f "${CLIENT_PATH}/pom.xml" clean install diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d2e8f33..85edb28 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -75,3 +75,21 @@ release: release: tag_name: ${POM_VERSION} description: Release ${POM_VERSION} + +nightly: + stage: build + image: ubuntu:24.04 + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + cache: + key: build-cache + paths: + - .m2/repository + before_script: + - apt update + - apt -y install curl zip unzip + - curl -s "https://get.sdkman.io?rcupdate=false" | bash + - source "$HOME/.sdkman/bin/sdkman-init.sh" + script: + - sdk env install + - ./mvnw -P pitest