Update ruby/setup-ruby action to v1.269.0 #362
This file contains hidden or 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: CI macOS ARM64 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| pull_request: | |
| branches: [ master ] | |
| schedule: | |
| - cron: '0 1 * * *' | |
| permissions: | |
| contents: read | |
| env: | |
| BUNDLE_RETRY: 6 | |
| BUNDLE_JOBS: 4 | |
| # Renovate can track and update this version | |
| CONFLUENT_VERSION: "8.0.0" | |
| jobs: | |
| specs_install: | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby: | |
| - '4.0.0-preview2' | |
| - '3.4' | |
| - '3.3' | |
| - '3.2' | |
| macos-version: | |
| - 'macos-14' # macOS 14 Sonoma (ARM64) | |
| - 'macos-15' # macOS 15 Sequoia (ARM64) | |
| include: | |
| - ruby: '3.4' | |
| macos-version: 'macos-15' | |
| coverage: 'true' | |
| exclude: | |
| - ruby: '4.0.0-preview2' | |
| macos-version: 'macos-14' | |
| runs-on: ${{ matrix.macos-version }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Bash 4+ and Kerberos | |
| run: | | |
| brew install bash | |
| brew list krb5 &>/dev/null || brew install krb5 | |
| echo "/opt/homebrew/bin" >> $GITHUB_PATH | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@d697be2f83c6234b20877c3b5eac7a7f342f0d0c # v1.269.0 | |
| with: | |
| ruby-version: ${{matrix.ruby}} | |
| bundler-cache: false | |
| - name: Install and Start Confluent Community Kafka (KRaft) | |
| run: | | |
| brew install openjdk@17 | |
| export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH" | |
| export JAVA_HOME="/opt/homebrew/opt/openjdk@17" | |
| curl -O "https://packages.confluent.io/archive/8.0/confluent-community-${CONFLUENT_VERSION}.tar.gz" | |
| tar -xzf "confluent-community-${CONFLUENT_VERSION}.tar.gz" | |
| export CONFLUENT_HOME="$(pwd)/confluent-${CONFLUENT_VERSION}" | |
| export PATH="$CONFLUENT_HOME/bin:$PATH" | |
| cd "$CONFLUENT_HOME" | |
| # Find the correct server config | |
| KRAFT_CONFIG="" | |
| for config in "etc/kafka/kraft/server.properties" "config/kraft/server.properties" "etc/kafka/server.properties"; do | |
| if [ -f "$config" ]; then | |
| KRAFT_CONFIG="$config" | |
| echo "Found config: $KRAFT_CONFIG" | |
| break | |
| fi | |
| done | |
| if [ -z "$KRAFT_CONFIG" ]; then | |
| echo "❌ No server config found" | |
| exit 1 | |
| fi | |
| # Configure KRaft for single-node setup | |
| cat >> "$KRAFT_CONFIG" << 'EOF' | |
| # KRaft mode configuration for single-node setup | |
| process.roles=broker,controller | |
| node.id=1 | |
| [email protected]:9093 | |
| listeners=PLAINTEXT://127.0.0.1:9092,CONTROLLER://127.0.0.1:9093 | |
| controller.listener.names=CONTROLLER | |
| inter.broker.listener.name=PLAINTEXT | |
| log.dirs=/tmp/kraft-combined-logs | |
| # Enable simple ACL authorization for testing | |
| authorizer.class.name=org.apache.kafka.metadata.authorizer.StandardAuthorizer | |
| super.users=User:ANONYMOUS | |
| allow.everyone.if.no.acl.found=true | |
| EOF | |
| echo "Updated KRaft configuration" | |
| CLUSTER_ID=$(bin/kafka-storage random-uuid) | |
| bin/kafka-storage format -t "$CLUSTER_ID" -c "$KRAFT_CONFIG" | |
| bin/kafka-server-start "$KRAFT_CONFIG" & | |
| sleep 20 | |
| for i in {1..30}; do | |
| if bin/kafka-topics --bootstrap-server 127.0.0.1:9092 --list >/dev/null 2>&1; then | |
| echo "✅ Confluent Community ${CONFLUENT_VERSION} (KRaft) is ready!" | |
| break | |
| fi | |
| [ $i -eq 30 ] && { echo "❌ Kafka failed to start"; exit 1; } | |
| sleep 2 | |
| done | |
| - name: Install dependencies | |
| env: | |
| RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext | |
| run: | | |
| bundle install | |
| - name: Build gem with mini_portile | |
| run: | | |
| set -e | |
| cd ext && bundle exec rake | |
| cd .. | |
| - name: Run all specs | |
| env: | |
| GITHUB_COVERAGE: ${{matrix.coverage}} | |
| RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext | |
| run: | | |
| bundle exec rspec | |
| build_precompiled: | |
| timeout-minutes: 45 | |
| runs-on: macos-15 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Bash 4+ and Kerberos | |
| run: | | |
| brew install bash | |
| brew list krb5 &>/dev/null || brew install krb5 | |
| echo "/opt/homebrew/bin" >> $GITHUB_PATH | |
| - name: Cache build-tmp directory | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ext/build-tmp-macos | |
| key: build-tmp-${{ runner.os }}-${{ hashFiles('ext/*.sh', 'ext/Rakefile') }}-v2 | |
| - name: Build precompiled librdkafka for macOS ARM64 | |
| run: | | |
| cd ext | |
| /opt/homebrew/bin/bash ./build_macos_arm64.sh | |
| - name: Upload precompiled library | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: librdkafka-precompiled-macos | |
| path: ext/ | |
| retention-days: 1 | |
| specs_precompiled: | |
| timeout-minutes: 30 | |
| needs: build_precompiled | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby: | |
| - '4.0.0-preview2' | |
| - '3.4' | |
| - '3.3' | |
| - '3.2' | |
| macos-version: | |
| - 'macos-14' | |
| - 'macos-15' | |
| include: | |
| - ruby: '3.4' | |
| macos-version: 'macos-15' | |
| coverage: 'true' | |
| exclude: | |
| - ruby: '4.0.0-preview2' | |
| macos-version: 'macos-14' | |
| runs-on: ${{ matrix.macos-version }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download precompiled library | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: librdkafka-precompiled-macos | |
| path: ext/ | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@d697be2f83c6234b20877c3b5eac7a7f342f0d0c # v1.269.0 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: false | |
| - name: Install Bash 4+ and Kerberos | |
| run: | | |
| brew install bash | |
| brew list krb5 &>/dev/null || brew install krb5 | |
| echo "/opt/homebrew/bin" >> $GITHUB_PATH | |
| - name: Install and Start Confluent Community Kafka (KRaft) | |
| run: | | |
| brew install openjdk@17 | |
| export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH" | |
| export JAVA_HOME="/opt/homebrew/opt/openjdk@17" | |
| curl -O "https://packages.confluent.io/archive/8.0/confluent-community-${CONFLUENT_VERSION}.tar.gz" | |
| tar -xzf "confluent-community-${CONFLUENT_VERSION}.tar.gz" | |
| export CONFLUENT_HOME="$(pwd)/confluent-${CONFLUENT_VERSION}" | |
| export PATH="$CONFLUENT_HOME/bin:$PATH" | |
| cd "$CONFLUENT_HOME" | |
| # Find the correct server config | |
| KRAFT_CONFIG="" | |
| for config in "etc/kafka/kraft/server.properties" "config/kraft/server.properties" "etc/kafka/server.properties"; do | |
| if [ -f "$config" ]; then | |
| KRAFT_CONFIG="$config" | |
| echo "Found config: $KRAFT_CONFIG" | |
| break | |
| fi | |
| done | |
| if [ -z "$KRAFT_CONFIG" ]; then | |
| echo "❌ No server config found" | |
| exit 1 | |
| fi | |
| # Configure KRaft for single-node setup | |
| cat >> "$KRAFT_CONFIG" << 'EOF' | |
| # KRaft mode configuration for single-node setup | |
| process.roles=broker,controller | |
| node.id=1 | |
| [email protected]:9093 | |
| listeners=PLAINTEXT://127.0.0.1:9092,CONTROLLER://127.0.0.1:9093 | |
| controller.listener.names=CONTROLLER | |
| inter.broker.listener.name=PLAINTEXT | |
| log.dirs=/tmp/kraft-combined-logs | |
| # Enable simple ACL authorization for testing | |
| authorizer.class.name=org.apache.kafka.metadata.authorizer.StandardAuthorizer | |
| super.users=User:ANONYMOUS | |
| allow.everyone.if.no.acl.found=true | |
| EOF | |
| echo "Updated KRaft configuration" | |
| CLUSTER_ID=$(bin/kafka-storage random-uuid) | |
| bin/kafka-storage format -t "$CLUSTER_ID" -c "$KRAFT_CONFIG" | |
| bin/kafka-server-start "$KRAFT_CONFIG" & | |
| sleep 20 | |
| for i in {1..30}; do | |
| if bin/kafka-topics --bootstrap-server 127.0.0.1:9092 --list >/dev/null 2>&1; then | |
| echo "✅ Confluent Community ${CONFLUENT_VERSION} (KRaft) is ready!" | |
| break | |
| fi | |
| [ $i -eq 30 ] && { echo "❌ Kafka failed to start"; exit 1; } | |
| sleep 2 | |
| done | |
| - name: Install bundle with precompiled library | |
| env: | |
| GITHUB_COVERAGE: ${{ matrix.coverage }} | |
| RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext | |
| run: | | |
| bundle install | |
| echo "Bundle install completed with precompiled library" | |
| - name: Run specs with precompiled library | |
| env: | |
| GITHUB_COVERAGE: ${{ matrix.coverage }} | |
| RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext | |
| RDKAFKA_PRECOMPILED: "true" | |
| run: | | |
| bundle exec rspec | |
| ci-success: | |
| name: CI macOS ARM64 Success | |
| runs-on: ubuntu-latest | |
| if: always() | |
| needs: | |
| - specs_install | |
| - build_precompiled | |
| - specs_precompiled | |
| steps: | |
| - name: Check all jobs passed | |
| if: | | |
| contains(needs.*.result, 'failure') || | |
| contains(needs.*.result, 'cancelled') || | |
| contains(needs.*.result, 'skipped') | |
| run: exit 1 | |
| - run: echo "All CI checks passed!" |