make workflows reusable #9
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: Java CI | |
on: | |
push: | |
paths: | |
- glide-core/src/** | |
- submodules/** | |
- java/** | |
- .github/workflows/java.yml | |
- .github/workflows/install-shared-dependencies/action.yml | |
- .github/workflows/test-benchmark/action.yml | |
- .github/workflows/lint-rust/action.yml | |
- .github/workflows/install-valkey/action.yml | |
- .github/workflows/create-test-matrices/action.yml | |
- .github/json_matrices/** | |
pull_request: | |
paths: | |
- glide-core/src/** | |
- submodules/** | |
- java/** | |
- .github/workflows/java.yml | |
- .github/workflows/install-shared-dependencies/action.yml | |
- .github/workflows/test-benchmark/action.yml | |
- .github/workflows/lint-rust/action.yml | |
- .github/workflows/install-valkey/action.yml | |
- .github/workflows/create-test-matrices/action.yml | |
- .github/json_matrices/** | |
workflow_dispatch: | |
inputs: | |
full-matrix: | |
description: "Run the full engine, host, and language version matrix" | |
required: false | |
type: boolean | |
default: "false" | |
workflow_call: | |
concurrency: | |
group: java-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
get-matrices: | |
runs-on: ubuntu-latest | |
# Avoid running on schedule for forks | |
if: (github.event_name == 'schedule' && github.repository_owner == 'valkey-io') || github.event_name == 'push' || github.event_name == 'pull_request' | |
outputs: | |
engine-matrix-output: ${{ steps.get-matrices.outputs.engine-matrix-output }} | |
host-matrix-output: ${{ steps.get-matrices.outputs.host-matrix-output }} | |
version-matrix-output: ${{ steps.get-matrices.outputs.version-matrix-output }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: get-matrices | |
uses: ./.github/workflows/create-test-matrices | |
with: | |
language-name: java | |
run-full-matrix: ${{ github.event.inputs.full-matrix || 'false' }} | |
test-java: | |
needs: get-matrices | |
timeout-minutes: 35 | |
strategy: | |
# Run all jobs | |
fail-fast: false | |
matrix: | |
java: ${{ fromJson(needs.get-matrices.outputs.version-matrix-output) }} | |
engine: ${{ fromJson(needs.get-matrices.outputs.engine-matrix-output) }} | |
host: ${{ fromJson(needs.get-matrices.outputs.host-matrix-output) }} | |
runs-on: ${{ matrix.host.RUNNER }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
build-amazonlinux-latest: | |
if: github.repository_owner == 'valkey-io' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.event.inputs.full-matrix == 'true' | |
needs: get-matrices | |
strategy: | |
# Run all jobs | |
fail-fast: false | |
matrix: | |
java: ${{ fromJson(needs.get-matrices.outputs.version-matrix-output) }} | |
engine: ${{ fromJson(needs.get-matrices.outputs.engine-matrix-output) }} | |
runs-on: ubuntu-latest | |
container: amazonlinux:latest | |
timeout-minutes: 35 | |
steps: | |
- name: Install git | |
run: | | |
yum -y remove git | |
yum -y remove git-* | |
yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm | |
yum update | |
yum install -y git | |
git --version | |
- uses: actions/checkout@v4 | |
lint-rust: | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |