Add buildArm64 step to CI workflow #4
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
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
jobs: | ||
assemble: | ||
runs-on: ubuntu-latest | ||
env: | ||
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: 17 | ||
distribution: 'adopt' | ||
- name: Cache Gradle dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle/versions.gradle') }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle-${{ hashFiles('**/gradle/versions.gradle') }} | ||
${{ runner.os }}-gradle- | ||
- name: Assemble | ||
run: ./gradlew --no-daemon clean compileJava compileTestJava assemble | ||
- name: Upload workspace | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: workspace | ||
path: | | ||
./ | ||
!./.git/** | ||
unitTests: | ||
needs: assemble | ||
runs-on: ubuntu-latest | ||
env: | ||
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: 17 | ||
distribution: 'adopt' | ||
- name: Cache Gradle dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle/versions.gradle') }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle-${{ hashFiles('**/gradle/versions.gradle') }} | ||
${{ runner.os }}-gradle- | ||
- name: Download workspace | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: workspace | ||
- name: Build | ||
run: ./gradlew --no-daemon build | ||
- name: Store distribution artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: distributions | ||
path: build/distributions | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
architecture: "amd64" | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
- name: Check Dockerfile syntax | ||
run: | | ||
docker run --rm -i hadolint/hadolint < docker/openjdk-17/Dockerfile | ||
docker run --rm -i hadolint/hadolint < docker/openjdk-17-debug/Dockerfile | ||
docker run --rm -i hadolint/hadolint < docker/openjdk-latest/Dockerfile | ||
docker run --rm -i hadolint/hadolint < docker/graalvm/Dockerfile | ||
- name: Build Docker Image | ||
run: | | ||
./gradlew --no-daemon dockerDist | ||
# - name: Test Docker Image | ||
# run: | | ||
# mkdir -p docker/reports | ||
# curl -L https://github.com/goss-org/goss/releases/download/v0.3.22/goss-linux-amd64 -o ./docker/tests/goss-linux-amd64 | ||
# ./gradlew --no-daemon dockerTest | ||
buildArm64: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
architecture: [ arm64 ] | ||
env: | ||
architecture: "arm64" | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
architecture: aarch64 | ||
- name: Check Dockerfile syntax | ||
run: | | ||
docker run --rm -i hadolint/hadolint < docker/openjdk-17/Dockerfile | ||
docker run --rm -i hadolint/hadolint < docker/openjdk-17-debug/Dockerfile | ||
docker run --rm -i hadolint/hadolint < docker/openjdk-latest/Dockerfile | ||
docker run --rm -i hadolint/hadolint < docker/graalvm/Dockerfile | ||
- name: Build Docker Image | ||
run: | | ||
./gradlew --no-daemon dockerDist | ||
# - name: Test Docker Image | ||
# run: | | ||
# mkdir -p docker/reports | ||
# curl -L https://github.com/goss-org/goss/releases/download/v0.3.22/goss-linux-arm64 -o ./docker/tests/goss-linux-arm64 | ||
# ./gradlew --no-daemon dockerTest | ||
publishDocker: | ||
needs: build | ||
if: github.event_name == 'push' | ||
runs-on: ubuntu-latest | ||
env: | ||
architecture: "amd64" | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
- name: Login to Docker Hub for self hosted | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USER_RW }} | ||
password: ${{ secrets.DOCKER_PAT_RW }} | ||
- name: Publish Docker Image | ||
run: | | ||
./gradlew --no-daemon dockerUpload | ||
publishDockerArm64: | ||
needs: buildArm64 | ||
if: github.event_name == 'push' | ||
runs-on: ubuntu-latest | ||
env: | ||
architecture: "arm64" | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
architecture: aarch64 | ||
- name: Login to Docker Hub for self hosted | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USER_RW }} | ||
password: ${{ secrets.DOCKER_PAT_RW }} | ||
- name: Publish Docker Image | ||
run: | | ||
./gradlew --no-daemon dockerUpload | ||
publishManifest: | ||
needs: ubuntu-latest | ||
if: github.event_name == 'push' | ||
runs-on: ubuntu-latest | ||
env: | ||
architecture: "amd64" | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
- name: Login to Docker Hub for self hosted | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USER_RW }} | ||
password: ${{ secrets.DOCKER_PAT_RW }} | ||
- name: Publish Multi-arch Docker Image | ||
run: | | ||
./gradlew --no-daemon dockerManifest |