forked from unibo-oop/sample-gradle-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/APICe-at-DISI/sample-grad…
- Loading branch information
Showing
7 changed files
with
316 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
set -e | ||
CUSTOM_BUILD_SCRIPT=${CUSTOM_BUILD_SCRIPT:-.github/scripts/build} | ||
if [ -x $CUSTOM_BUILD_SCRIPT ]; then | ||
echo 'Detected custom build instructions' | ||
$CUSTOM_BUILD_SCRIPT | ||
elif [ -x 'gradlew' ]; then | ||
echo 'Detected gradle wrapper, checking for known tasks' | ||
if ./gradlew tasks | grep '^assemble\s'; then | ||
echo 'Detected assemble task' | ||
./gradlew assemble --parallel | ||
elif ./gradlew tasks | grep '^build\s'; then | ||
echo 'Detected build task' | ||
./gradlew build --parallel | ||
else | ||
echo 'No known tasks, fall back to the default tasks' | ||
./gradlew | ||
fi | ||
elif [ -f 'pom.xml' ]; then | ||
echo 'Detected Maven pom.xml, running mvn package' | ||
mvn package -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | ||
else | ||
echo 'No valid configuration detected, failing' | ||
echo "To fix, provide an *executable* build script in $CUSTOM_BUILD_SCRIPT" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
set -e | ||
CUSTOM_BUILD_SCRIPT=${CUSTOM_BUILD_SCRIPT:-.github/scripts/check} | ||
if [ -x $CUSTOM_BUILD_SCRIPT ]; then | ||
echo 'Detected custom check instructions' | ||
$CUSTOM_BUILD_SCRIPT | ||
elif [ -x 'gradlew' ]; then | ||
echo 'Detected gradle wrapper, checking for known tasks' | ||
if ./gradlew tasks | grep '^check\s'; then | ||
echo 'Detected check task' | ||
./gradlew check --parallel | ||
if ./gradlew tasks | grep '^jacocoTestReport\s'; then | ||
./gradlew jacocoTestReport --parallel | ||
fi | ||
else | ||
echo 'No known check tasks' | ||
fi | ||
else | ||
echo 'No valid configuration detected, skipping checks' | ||
echo "To fix, provide an *executable* build script in $CUSTOM_BUILD_SCRIPT" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
if [ -x .github/scripts/compatibility_check ]; then | ||
.github/scripts/compatibility_check | ||
else | ||
COMPATIBLE=true | ||
echo "COMPATIBLE=$COMPATIBLE" | ||
echo "COMPATIBLE=$COMPATIBLE" >> $GITHUB_ENV | ||
REFERENCE=$([ "$OS" = 'ubuntu' ] && [ "$JAVA_VERSION" = 8 ] && echo 'true' || echo 'false') | ||
echo "REFERENCE=$REFERENCE" | ||
echo "REFERENCE=$REFERENCE" >> $GITHUB_ENV | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -e | ||
CUSTOM_BUILD_SCRIPT=${CUSTOM_BUILD_SCRIPT:-.github/scripts/deploy} | ||
if [ -x $CUSTOM_BUILD_SCRIPT ]; then | ||
echo 'Detected custom deploy instructions' | ||
$CUSTOM_BUILD_SCRIPT | ||
elif [ -x 'gradlew' ]; then | ||
echo 'Detected gradle wrapper, checking for known tasks' | ||
if ./gradlew tasks | grep '^deploy\s'; then | ||
echo 'Detected deploy task' | ||
./gradlew deploy --parallel | ||
elif ./gradlew tasks | grep '^publish\s'; then | ||
echo 'Detected publish task' | ||
./gradlew publish --parallel | ||
else | ||
echo 'No deploy task' | ||
fi | ||
elif [ -f 'pom.xml' ]; then | ||
echo 'Detected Maven pom.xml, running mvn deploy' | ||
mvn deploy -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | ||
else | ||
echo 'No valid configuration detected, failing' | ||
echo "To fix, provide an *executable* build script in $CUSTOM_BUILD_SCRIPT" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
COMPATIBLE=$([ "$JAVA_VERSION" -ge 11 ] && echo 'true' || echo 'false') | ||
echo "COMPATIBLE=$COMPATIBLE" | ||
echo "COMPATIBLE=$COMPATIBLE" >> $GITHUB_ENV | ||
REFERENCE=$([ "$OS" = 'ubuntu' ] && [ "$JAVA_VERSION" = 11 ] && echo 'true' || echo 'false') | ||
echo "REFERENCE=$REFERENCE" | ||
echo "REFERENCE=$REFERENCE" >> $GITHUB_ENV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
name: CI | ||
on: | ||
push: | ||
schedule: | ||
- cron: '0 3 * * SUN' | ||
|
||
jobs: | ||
Build: | ||
strategy: | ||
matrix: | ||
os: [windows, macos, ubuntu] | ||
jvm_version: [8, 11, 14] | ||
runs-on: ${{ matrix.os }}-latest | ||
env: | ||
JAVA_VERSION: ${{ matrix.jvm_version }} | ||
OS: ${{ matrix.os }} | ||
TERM: dumb | ||
steps: | ||
# Checkout the repository | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
- name: Fetch tags | ||
shell: bash | ||
run: git fetch --tags -f | ||
- name: Populate TAG and BRANCH environment variables | ||
shell: bash | ||
run: | | ||
TAG=$(git describe --tags --exact-match HEAD || echo '') | ||
echo "Current tag is: '$TAG' (setup in the TAG environment variable)" | ||
echo "TAG=$TAG" >> $GITHUB_ENV | ||
BRANCH=$([ -z "$TAG" ] && echo ${GITHUB_REF#refs/heads/} || echo $TAG) | ||
echo "Current tag is: '$BRANCH' (setup in BRANCH TAG environment variable)" | ||
echo "BRANCH=$BRANCH" >> $GITHUB_ENV | ||
# Check if the configuration is supported | ||
# COMPATIBLE means the build can run on this matrix combination | ||
# REFERENCE means this is the combination that produces the reference artifacts | ||
# (hence, artifacts from REFERENCE configuration shall be deployed) | ||
# Only one matrix entry should be REFERENCE=true | ||
# If REFERENCE=true, then also COMPATIBLE=true | ||
- shell: bash | ||
run: .github/build-steps/compatibility_check.sh | ||
# Install the JDK | ||
- uses: joschi/[email protected] | ||
if: ${{ env.COMPATIBLE == 'true' }} | ||
with: | ||
java-version: ${{ matrix.jvm_version }} | ||
server-id: ossrh | ||
server-username: MAVEN_CENTRAL_USERNAME | ||
server-password: MAVEN_CENTRAL_PASSWORD | ||
gpg-private-key: ${{ secrets.SIGNING_KEY }} | ||
gpg-passphrase: SIGNING_PASSWORD | ||
# Install additional packages | ||
- name: Configure Linux | ||
shell: bash | ||
if: ${{ env.COMPATIBLE == 'true' && contains(matrix.os, 'ubuntu') }} | ||
run: | | ||
if [ -x .github/scripts/configure_linux ]; then | ||
.github/scripts/configure_linux | ||
fi | ||
- name: Configure MacOS X | ||
shell: bash | ||
if: ${{ env.COMPATIBLE == 'true' && contains(matrix.os, 'macos') }} | ||
run: | | ||
if [ -f .github/scripts/configure_macos ]; then | ||
.github/scripts/configure_macos | ||
fi | ||
- name: Configure the Windows Pagefile | ||
if: ${{ env.COMPATIBLE == 'true' && contains(matrix.os, 'windows') }} | ||
uses: al-cheb/[email protected] | ||
- name: Configure Windows | ||
shell: bash | ||
if: ${{ env.COMPATIBLE == 'true' && contains(matrix.os, 'windows') }} | ||
run: | | ||
if [ -f .github/scripts/configure_windows ]; then | ||
.github/scripts/configure_windows | ||
fi | ||
- name: Build | ||
if: ${{ env.COMPATIBLE == 'true' }} | ||
shell: bash | ||
run: .github/build-steps/build.sh || .github/build-steps/build.sh | ||
- name: Check | ||
if: ${{ env.COMPATIBLE == 'true' }} | ||
shell: bash | ||
run: .github/build-steps/check.sh || .github/build-steps/check.sh | ||
- name: CodeCov | ||
if: ${{ env.REFERENCE == 'true' }} | ||
uses: codecov/codecov-action@v1 | ||
- name: Deploy | ||
if: ${{ env.REFERENCE == 'true' }} | ||
shell: bash | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
githubToken: ${{ secrets.AUTOMERGE_TOKEN }} | ||
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} | ||
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} | ||
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | ||
MAVEN_CENTRAL_USERNAME: danysk | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | ||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} | ||
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | ||
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} | ||
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | ||
run: .github/build-steps/deploy.sh || .github/build-steps/deploy.sh | ||
Build-Success: | ||
runs-on: ubuntu-latest | ||
needs: Build | ||
steps: | ||
- shell: bash | ||
run: touch ok | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: success | ||
path: ok | ||
CI-Complete: | ||
needs: Build-Success | ||
if: always() | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: success | ||
- shell: bash | ||
run: '[ -f ok ]' | ||
Automerge: | ||
needs: CI-Complete | ||
runs-on: ubuntu-latest | ||
if: always() | ||
steps: | ||
- name: automerge | ||
uses: "DanySK/yaagha@master" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.AUTOMERGE_TOKEN }}" | ||
MERGE_FORKS: "false" | ||
MERGE_LABELS: "version-upgrade" | ||
BLOCK_LABELS: "blocked, wontfix, invalid" | ||
MERGE_METHOD: "rebase" | ||
CLOSE_ON_CONFLICT: "true" | ||
DELETE_BRANCH_ON_CLOSE: "true" | ||
GIT_USER_NAME: "Danilo Pianini" | ||
GIT_USER_EMAIL: "[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Pull Request CI | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
Build-Foreign-Pull-Request: | ||
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} | ||
strategy: | ||
matrix: | ||
os: [windows, macos, ubuntu] | ||
jvm_version: [8, 11, 14] | ||
runs-on: ${{ matrix.os }}-latest | ||
env: | ||
JAVA_VERSION: ${{ matrix.jvm_version }} | ||
OS: ${{ matrix.os }} | ||
TERM: dumb | ||
steps: | ||
# Checkout the repository | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
- name: Fetch tags | ||
shell: bash | ||
run: git fetch --tags -f | ||
- name: Populate TAG and BRANCH environment variables | ||
shell: bash | ||
run: | | ||
TAG=$(git describe --tags --exact-match HEAD || echo '') | ||
echo "Current tag is: '$TAG' (setup in the TAG environment variable)" | ||
echo "TAG=$TAG" >> $GITHUB_ENV | ||
BRANCH=$([ -z "$TAG" ] && echo ${GITHUB_REF#refs/heads/} || echo $TAG) | ||
echo "Current tag is: '$BRANCH' (setup in BRANCH TAG environment variable)" | ||
echo "BRANCH=$BRANCH" >> $GITHUB_ENV | ||
# Check if the configuration is supported | ||
# COMPATIBLE means the build can run on this matrix combination | ||
# REFERENCE means this is the combination that produces the reference artifacts | ||
# (hence, artifacts from REFERENCE configuration shall be deployed) | ||
# Only one matrix entry should be REFERENCE=true | ||
# If REFERENCE=true, then also COMPATIBLE=true | ||
- shell: bash | ||
run: .github/build-steps/compatibility_check.sh | ||
# Install the JDK | ||
- uses: joschi/[email protected] | ||
if: ${{ env.COMPATIBLE }} | ||
with: | ||
java-version: ${{ matrix.jvm_version }} | ||
# Install additional packages | ||
- name: Configure Linux | ||
shell: bash | ||
if: ${{ env.COMPATIBLE && contains(matrix.os, 'ubuntu') }} | ||
run: | | ||
if [ -x .github/scripts/configure_linux ]; then | ||
.github/scripts/configure_linux | ||
fi | ||
- name: Configure MacOS X | ||
shell: bash | ||
if: ${{ env.COMPATIBLE && contains(matrix.os, 'macos') }} | ||
run: | | ||
if [ -f .github/scripts/configure_macos ]; then | ||
.github/scripts/configure_macos | ||
fi | ||
- name: Configure the Windows Pagefile | ||
if: ${{ env.COMPATIBLE == 'true' && contains(matrix.os, 'windows') }} | ||
uses: al-cheb/[email protected] | ||
- name: Configure Windows | ||
shell: bash | ||
if: ${{ env.COMPATIBLE && contains(matrix.os, 'windows') }} | ||
run: | | ||
if [ -f .github/scripts/configure_windows ]; then | ||
.github/scripts/configure_windows | ||
fi | ||
- name: Build | ||
if: ${{ env.COMPATIBLE == 'true' }} | ||
shell: bash | ||
run: .github/build-steps/build.sh | ||
- name: Check | ||
if: ${{ env.COMPATIBLE == 'true' }} | ||
shell: bash | ||
run: .github/build-steps/check.sh | ||
- name: CodeCov | ||
if: ${{ env.REFERENCE == 'true' }} | ||
uses: codecov/codecov-action@v1 |