blob: b4b5b9e502e6654c24ebce65eb132e10973297ed [file]
# 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.
name: CI
on:
workflow_call:
inputs:
ref:
type: string
description: Ratis git ref (branch, tag or commit hash)
default: ''
required: false
secrets:
DEVELOCITY_ACCESS_KEY:
description: 'Token for submitting build scan to Develocity'
required: false
SONARCLOUD_TOKEN:
description: 'Token for submitting coverage data to SonarCloud'
required: false
permissions: { }
jobs:
build:
uses: ./.github/workflows/check.yaml
with:
script: build
script-args: -Prelease
timeout-minutes: 30
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
compile:
needs:
- build
strategy:
matrix:
java: [ 8, 17, 21, 25 ]
fail-fast: false
uses: ./.github/workflows/check.yaml
with:
java-version: ${{ matrix.java }}
needs-source-tarball: true
script: compile
script-args: -Prelease -Dmaven.compiler.release=${{ matrix.java }} -Dmaven.javadoc.failOnWarnings=${{ matrix.java != 8 }}
split: ${{ matrix.java }}
timeout-minutes: 30
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
release:
uses: ./.github/workflows/check.yaml
with:
script: release
timeout-minutes: 30
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
repro:
needs:
- build
uses: ./.github/workflows/check.yaml
with:
needs-maven-repo: true
script: repro
script-args: -Prelease
timeout-minutes: 30
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
basic:
strategy:
matrix:
check:
- author
- checkstyle
- findbugs
- rat
fail-fast: false
uses: ./.github/workflows/check.yaml
with:
script: ${{ matrix.check }}
timeout-minutes: 30
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
unit:
strategy:
matrix:
profile:
- grpc
- server
- misc
- flaky
fail-fast: false
uses: ./.github/workflows/check.yaml
with:
script: unit
script-args: -P${{ matrix.profile }}-tests
split: ${{ matrix.profile }}
timeout-minutes: 60
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
coverage:
needs:
- build
- unit
runs-on: ubuntu-24.04
timeout-minutes: 30
if: github.event_name != 'pull_request'
steps:
- name: Checkout project
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Cache for maven dependencies
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.m2/repository
!~/.m2/repository/org/apache/ratis
key: maven-repo-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-repo-
- name: Setup java 17
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version: 17
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: target/artifacts
- name: Untar binaries
run: |
mkdir -p ratis-assembly/target
tar xzvf target/artifacts/ratis-bin/ratis-assembly-*.tar.gz -C ratis-assembly/target
- name: Calculate combined coverage
run: ./dev-support/checks/coverage.sh
- name: Upload coverage to Sonar
if: github.repository == 'apache/ratis'
run: ./dev-support/checks/sonar.sh
env:
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive build results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: ${{ github.job }}
path: target/${{ github.job }}