GitHub ci #87
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: "Container Images" | |
on: | |
push: | |
branches: [ main, release-* ] | |
pull_request: | |
jobs: | |
buildX64Docker: | |
runs-on: [self-hosted, X64, Linux] | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
steps: | |
- name: export runner UID | |
run: echo "runner_uid=$UID" >> $GITHUB_ENV | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: adopt | |
java-version: 17 | |
cache: gradle | |
- name: hadoLint_openjdk_11 | |
run: docker run --rm -i hadolint/hadolint < docker/openjdk-11/Dockerfile | |
- name: hadoLint_openjdk_11_debug | |
run: docker run --rm -i hadolint/hadolint < docker/openjdk-11-debug/Dockerfile | |
- name: hadoLint_openjdk_latest | |
run: docker run --rm -i hadolint/hadolint < docker/openjdk-latest/Dockerfile | |
- name: hadoLint_graalvm | |
run: docker run --rm -i hadolint/hadolint < docker/graalvm/Dockerfile | |
- name: distDocker | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: distDocker | |
- name: test image | |
run: | | |
mkdir -p docker/reports | |
curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.9/goss-linux-amd64 -o ./docker/tests/goss-linux-amd64 | |
- name: distDocker | |
uses: gradle/gradle-build-action@v2 | |
env: | |
architecture: amd64 | |
with: | |
arguments: testDocker | |
- name: Login to DockerHub | |
if: ${{ github.actor != 'dependabot[bot]' && (contains('refs/heads/release-', github.ref) || github.ref == 'refs/heads/main') }} | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USER_RW }} | |
password: ${{ secrets.DOCKER_PASSWORD_RW }} | |
- name: publish | |
if: ${{ github.actor != 'dependabot[bot]' && (contains('refs/heads/release-', github.ref) || github.ref == 'refs/heads/main') }} | |
run: ./gradlew --no-daemon "-Pbranch=${{ github.head_ref || github.ref_name }}" dockerUpload | |
- name: Correct Ownership in GITHUB_WORKSPACE directory | |
uses: peter-murray/reset-workspace-ownership-action@v1 | |
with: | |
user_id: ${{ env.runner_uid }} | |
buildArm64Docker: | |
runs-on: [self-hosted, ARM64, Linux] | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
steps: | |
- name: export runner UID | |
run: echo "runner_uid=$UID" >> $GITHUB_ENV | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
architecture: arm64 | |
java-version: 17 | |
cache: gradle | |
- name: Docker login | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: buildDocker | |
uses: gradle/gradle-build-action@v2 | |
env: | |
architecture: arm64 | |
with: | |
arguments: distDocker | |
- name: download image test binary | |
run: | | |
mkdir -p docker/reports | |
curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.9/goss-linux-arm -o ./docker/tests/goss-linux-arm64 | |
- name: testDocker | |
uses: gradle/gradle-build-action@v2 | |
env: | |
architecture: arm64 | |
with: | |
arguments: testDocker | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
if: ${{ github.actor != 'dependabot[bot]' && (contains('refs/heads/release-', github.ref) || github.ref == 'refs/heads/main') }} | |
with: | |
username: ${{ secrets.DOCKER_USER_RW }} | |
password: ${{ secrets.DOCKER_PASSWORD_RW }} | |
- name: publish | |
if: ${{ github.actor != 'dependabot[bot]' && (contains('refs/heads/release-', github.ref) || github.ref == 'refs/heads/main') }} | |
uses: gradle/gradle-build-action@v2 | |
env: | |
architecture: arm64 | |
with: | |
arguments: "-Pbranch=${{ github.head_ref || github.ref_name }} dockerUpload" | |
- name: Correct Ownership in GITHUB_WORKSPACE directory | |
uses: peter-murray/reset-workspace-ownership-action@v1 | |
with: | |
user_id: ${{ env.runner_uid }} |