Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7ba7807
HDDS-11813. Reduce duplication in CI workflow
adoroszlai Nov 27, 2024
53c9187
remove unused install_diffoscope
adoroszlai Nov 27, 2024
f1f9660
restore set -u -o pipefail
adoroszlai Nov 27, 2024
2569248
replace leftover github.job
adoroszlai Nov 27, 2024
7c53cf0
Merge remote-tracking branch 'origin/master' into HDDS-11813
adoroszlai Dec 8, 2024
41cb54e
Merge remote-tracking branch 'origin/master' into HDDS-11813
adoroszlai Dec 9, 2024
e09f4e3
set default for needs-maven-cache to true
adoroszlai Dec 9, 2024
60c8cea
Merge remote-tracking branch 'origin/master' into HDDS-11813
adoroszlai Dec 12, 2024
303e3bf
add MAVEN_ARGS in check.yml, too
adoroszlai Dec 12, 2024
a780d45
Merge remote-tracking branch 'origin/master' into HDDS-11813
adoroszlai Jan 15, 2025
9bf7218
Merge remote-tracking branch 'origin/master' into HDDS-11813
adoroszlai Feb 10, 2025
d14612a
adopt HDDS-12082
adoroszlai Feb 10, 2025
26ae971
HDDS-12304. Bump GitHub Actions runner to ubuntu-24.04
adoroszlai Feb 10, 2025
205fce1
acceptance (s3a) requires java
adoroszlai Feb 11, 2025
f05bbc5
Revert "acceptance (s3a) requires java"
adoroszlai Feb 11, 2025
1d4e4d3
Revert "HDDS-12304. Bump GitHub Actions runner to ubuntu-24.04"
adoroszlai Feb 11, 2025
4917226
Merge remote-tracking branch 'origin/master' into HDDS-11813
adoroszlai Feb 13, 2025
bbbb40b
Merge remote-tracking branch 'origin/master' into HDDS-11813
adoroszlai Feb 18, 2025
4aac8b6
Merge remote-tracking branch 'origin/master' into HDDS-11813
adoroszlai Mar 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
289 changes: 289 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This reusable workflow executes a single check from `hadoop-ozone/dev-support/checks/`.
# Before and after the check, it performs various steps based on workflow inputs.

name: ci-check

on:
workflow_call:
inputs:
# REQUIRED
script:
type: string
description: "Test script to run from hadoop-ozone/dev-support/checks, without .sh extension"
required: true

sha:
type: string
description: "Commit SHA to test"
required: true

# OPTIONAL (ordered alphabetically)
checkout-fetch-depth:
type: number
description: "Fetch depth for checking out the repo (default: no history)"
default: 1
required: false

java-version:
type: string
description: "Java version to set up (default: none)"
default: ''
required: false

needs-maven-cache:
type: boolean
description: "Whether to restore Maven cache before run (default: yes)"
default: true
required: false

needs-npm-cache:
type: boolean
description: "Whether to restore NPM cache before run (default: no)"
default: false
required: false

needs-ozone-binary-tarball:
type: boolean
description: "Whether to download Ozone binary tarball created by build (default: no)"
default: false
required: false

needs-ozone-repo:
type: boolean
description: "Whether to download Ozone jars created by build (default: no)"
default: false
required: false

needs-ozone-source-tarball:
type: boolean
description: "Whether to download Ozone source tarball created by build (default: no)"
default: false
required: false

pre-script:
type: string
description: "Command to execute before the test script (default: none)"
default: ''
required: false

post-failure:
type: string
description: "Command to execute after the test script, if it failed (default: none)"
default: ''
required: false

post-success:
type: string
description: "Command to execute after the test script, if it succeeded (default: none)"
default: ''
required: false

ratis-args:
type: string
description: "Version overrides from custom Ratis build (default: none)"
default: ''
required: false

runner:
type: string
description: "GitHub Actions runner to use"
default: 'ubuntu-24.04'
required: false

script-args:
type: string
description: "Arguments for the test script, ratis-args are appended"
default: ''
required: false

split:
type: string
description: "Name of split for matrix jobs, only used in display name"
default: ''
required: false

timeout-minutes:
type: number
description: "Job timeout in minutes (default: 30)"
default: 30
required: false

with-coverage:
type: boolean
description: "The value of OZONE_WITH_COVERAGE to set"
default: true
required: false

env:
HADOOP_IMAGE: ghcr.io/apache/hadoop
MAVEN_ARGS: --batch-mode --settings ${{ github.workspace }}/dev-support/ci/maven-settings.xml
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
OZONE_IMAGE: ghcr.io/apache/ozone
OZONE_RUNNER_IMAGE: ghcr.io/apache/ozone-runner
OZONE_VOLUME_OWNER: 1000

jobs:
check:
name: ${{ (inputs.split && format('{0} ({1})', inputs.script, inputs.split)) || inputs.script }}
runs-on: ${{ inputs.runner }}
timeout-minutes: ${{ inputs.timeout-minutes }}
steps:
- name: Checkout project
if: ${{ !inputs.needs-ozone-source-tarball }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}
fetch-depth: ${{ inputs.checkout-fetch-depth }}

- name: Download Ozone source tarball
if: ${{ inputs.needs-ozone-source-tarball }}
uses: actions/download-artifact@v4
with:
name: ozone-src

- name: Extract source tarball
if: ${{ inputs.needs-ozone-source-tarball }}
run: |
tar --strip-components 1 -xzvf ozone*-src.tar.gz

- name: Cache for NPM dependencies
if: ${{ inputs.needs-npm-cache }}
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
**/node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-

- name: Cache for Maven dependencies
if: ${{ inputs.needs-maven-cache }}
uses: actions/cache/restore@v4
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/ozone
key: maven-repo-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-repo-

- name: Download Ozone repo
id: download-ozone-repo
if: ${{ inputs.needs-ozone-repo }}
uses: actions/download-artifact@v4
with:
name: ozone-repo
path: |
~/.m2/repository/org/apache/ozone

- name: Download Ratis repo
if: ${{ inputs.ratis-args != '' }}
uses: actions/download-artifact@v4
with:
name: ratis-jars
path: |
~/.m2/repository/org/apache/ratis

- name: Download Ozone binary tarball
if: ${{ inputs.needs-ozone-binary-tarball }}
uses: actions/download-artifact@v4
with:
name: ozone-bin

- name: Extract binary tarball
if: ${{ inputs.needs-ozone-binary-tarball }}
run: |
mkdir -p hadoop-ozone/dist/target
tar xzvf ozone*.tar.gz -C hadoop-ozone/dist/target
rm ozone*.tar.gz

- name: Setup java ${{ inputs.java-version }}
if: ${{ inputs.java-version }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ inputs.java-version }}

- name: Execute pre-test steps
if: ${{ inputs.pre-script }}
run: |
${{ inputs.pre-script }}

- name: Execute tests
run: |
hadoop-ozone/dev-support/checks/${{ inputs.script }}.sh ${{ inputs.script-args }} ${{ inputs.ratis-args }}
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
OZONE_WITH_COVERAGE: ${{ inputs.with-coverage }}

- name: Execute post-failure steps
if: ${{ failure() && inputs.post-failure }}
run: |
${{ inputs.post-failure }}

- name: Execute post-success steps
if: ${{ !failure() && inputs.post-success }}
run: |
${{ inputs.post-success }}

- name: Summary of failures
if: ${{ failure() }}
run: |
if [[ -s "target/${{ inputs.script }}/summary.md" ]]; then
cat target/${{ inputs.script }}/summary.md >> $GITHUB_STEP_SUMMARY
fi
hadoop-ozone/dev-support/checks/_summary.sh target/${{ inputs.script }}/summary.txt

- name: Archive build results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ (inputs.split && format('{0}-{1}', inputs.script, inputs.split)) || inputs.script }}
path: target/${{ inputs.script }}
continue-on-error: true

# The following steps are hard-coded to be run only for 'build' check,
# to avoid the need for 3 more inputs.
- name: Store binaries for tests
if: ${{ inputs.script == 'build' && !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ozone-bin
path: |
hadoop-ozone/dist/target/ozone-*.tar.gz
!hadoop-ozone/dist/target/ozone-*-src.tar.gz
retention-days: 1

- name: Store source tarball for compilation
if: ${{ inputs.script == 'build' && !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ozone-src
path: |
hadoop-ozone/dist/target/ozone-*-src.tar.gz
retention-days: 1

- name: Store Maven repo for tests
if: ${{ inputs.script == 'build' && !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ozone-repo
path: |
~/.m2/repository/org/apache/ozone
retention-days: 1
Loading