| 1 |
# Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 |
# contributor license agreements. See the NOTICE file distributed with |
| 3 |
# this work for additional information regarding copyright ownership. |
| 4 |
# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 5 |
# (the "License"); you may not use this file except in compliance with |
| 6 |
# the License. You may obtain a copy of the License at |
| 7 |
# |
| 8 |
# https://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
# See the License for the specific language governing permissions and |
| 14 |
# limitations under the License. |
| 15 |
|
| 16 |
name: 'Test Ruby' |
| 17 |
on: |
| 18 |
workflow_dispatch: |
| 19 |
push: |
| 20 |
branches: [ main ] |
| 21 |
pull_request: |
| 22 |
branches: [ main ] |
| 23 |
paths: |
| 24 |
- .github/workflows/test-lang-ruby.yml |
| 25 |
- lang/ruby/** |
| 26 |
|
| 27 |
defaults: |
| 28 |
run: |
| 29 |
working-directory: lang/ruby |
| 30 |
|
| 31 |
concurrency: |
| 32 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 33 |
cancel-in-progress: true |
| 34 |
|
| 35 |
jobs: |
| 36 |
test: |
| 37 |
runs-on: ${{ matrix.os }} |
| 38 |
strategy: |
| 39 |
matrix: |
| 40 |
os: |
| 41 |
- ubuntu-latest |
| 42 |
- ubuntu-24.04-arm |
| 43 |
ruby: |
| 44 |
- '2.7' |
| 45 |
- '3.0' |
| 46 |
- '3.1' |
| 47 |
- '3.2' |
| 48 |
- '3.3' |
| 49 |
steps: |
| 50 |
- uses: actions/checkout@v5 |
| 51 |
|
| 52 |
- uses: ruby/setup-ruby@v1 |
| 53 |
with: |
| 54 |
ruby-version: ${{ matrix.ruby }} |
| 55 |
|
| 56 |
- name: Install Dependencies |
| 57 |
run: sudo apt-get update && sudo apt-get install -qqy libsnappy-dev |
| 58 |
|
| 59 |
- uses: actions/cache@v4 |
| 60 |
with: |
| 61 |
path: .gem |
| 62 |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} |
| 63 |
restore-keys: | |
| 64 |
${{ runner.os }}-gems- |
| 65 |
|
| 66 |
- name: Configure Bundler to Use Cache |
| 67 |
run: bundle config path .gem |
| 68 |
|
| 69 |
- name: Lint |
| 70 |
run: | |
| 71 |
PATH=$PWD/.gem/bin:$PATH |
| 72 |
./build.sh lint |
| 73 |
|
| 74 |
- name: Test |
| 75 |
run: | |
| 76 |
PATH=$PWD/.gem/bin:$PATH |
| 77 |
./build.sh test |
| 78 |
|
| 79 |
interop: |
| 80 |
runs-on: ${{ matrix.os }} |
| 81 |
strategy: |
| 82 |
matrix: |
| 83 |
os: |
| 84 |
- ubuntu-latest |
| 85 |
- ubuntu-24.04-arm |
| 86 |
ruby: |
| 87 |
- '2.7' |
| 88 |
- '3.0' |
| 89 |
- '3.1' |
| 90 |
- '3.2' |
| 91 |
- '3.3' |
| 92 |
steps: |
| 93 |
- uses: actions/checkout@v5 |
| 94 |
|
| 95 |
- uses: ruby/setup-ruby@v1 |
| 96 |
with: |
| 97 |
ruby-version: ${{ matrix.ruby }} |
| 98 |
|
| 99 |
- name: Install Dependencies |
| 100 |
run: sudo apt-get update && sudo apt-get install -qqy libsnappy-dev |
| 101 |
|
| 102 |
- uses: actions/cache@v4 |
| 103 |
with: |
| 104 |
path: .gem |
| 105 |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} |
| 106 |
restore-keys: | |
| 107 |
${{ runner.os }}-gems- |
| 108 |
|
| 109 |
- name: Configure Bundler to Use Cache |
| 110 |
run: bundle config path .gem |
| 111 |
|
| 112 |
- name: Cache Local Maven Repository |
| 113 |
uses: actions/cache@v4 |
| 114 |
with: |
| 115 |
path: ~/.m2/repository |
| 116 |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 117 |
restore-keys: | |
| 118 |
${{ runner.os }}-maven- |
| 119 |
|
| 120 |
- name: 'Setup Temurin JDK 8, 11, 17 & 21' |
| 121 |
uses: actions/setup-java@v5 |
| 122 |
with: |
| 123 |
distribution: 'temurin' |
| 124 |
java-version: | |
| 125 |
8 |
| 126 |
11 |
| 127 |
17 |
| 128 |
21 |
| 129 |
|
| 130 |
- name: 'Setup Maven 3.9.6' |
| 131 |
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5 |
| 132 |
with: |
| 133 |
maven-version: 3.9.6 |
| 134 |
|
| 135 |
- name: Install Java Avro for Interop Test |
| 136 |
working-directory: . |
| 137 |
run: mvn -B install -PskipQuality |
| 138 |
|
| 139 |
- name: Create Interop Data Directory |
| 140 |
working-directory: . |
| 141 |
run: mkdir -p build/interop/data |
| 142 |
|
| 143 |
- name: Generate Interop Resources |
| 144 |
working-directory: lang/java/avro |
| 145 |
run: mvn -B -P interop-data-generate generate-resources |
| 146 |
|
| 147 |
- name: Bundle Install |
| 148 |
run: | |
| 149 |
export GEM_HOME="$PWD/.gem/" |
| 150 |
export PATH="$GEM_HOME/bin:$PATH" |
| 151 |
bundle install |
| 152 |
|
| 153 |
- name: Generate Interop Data |
| 154 |
run: | |
| 155 |
export GEM_HOME="$PWD/.gem/" |
| 156 |
export PATH="$GEM_HOME/bin:$PATH" |
| 157 |
bundle exec rake --trace generate_interop |
| 158 |
|
| 159 |
- name: Run Interop Tests |
| 160 |
run: | |
| 161 |
export GEM_HOME="$PWD/.gem/" |
| 162 |
export PATH="$GEM_HOME/bin:$PATH" |
| 163 |
bundle exec rake --trace interop |