Fix workflows #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: rails_graphql_federation books CI | |
on: | |
pull_request: | |
push: | |
branches: [ main ] | |
paths: [ rails_graphql_federation/books/** ] | |
workflow_dispatch: | |
env: | |
rails_app_root: rails_graphql_federation/books | |
jobs: | |
scan_ruby: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
working-directory: ${{ env.rails_app_root }} | |
bundler-cache: true | |
- name: Scan for common Rails security vulnerabilities using static analysis | |
run: | | |
cd ${{ env.rails_app_root }} | |
./bin/brakeman --no-pager | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
working-directory: ${{ env.rails_app_root }} | |
bundler-cache: true | |
- name: Lint code for consistent style | |
run: | | |
cd ${{ env.rails_app_root }} | |
./bin/rubocop -f github | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
services: | |
kafka: | |
image: bitnami/kafka:latest | |
env: | |
KAFKA_ENABLE_KRAFT: yes | |
KAFKA_CFG_PROCESS_ROLES: broker,controller | |
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER | |
KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093 | |
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT | |
KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092 | |
KAFKA_CFG_NODE_ID: 1 | |
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: [email protected]:9093 | |
ALLOW_PLAINTEXT_LISTENER: yes | |
KAFKA_CFG_NUM_PARTITIONS: 4 | |
KAFKA_CFG_OFFSETS_TOPIC_NUM_PARTITIONS: 1 | |
KAFKA_CFG_TRANSACTION_STATE_LOG_NUM_PARTITIONS: 1 | |
KAFKA_CFG_LOG_RETENTION_BYTES: -1 | |
KAFKA_CFG_LOG_RETENTION_HOURS: -1 | |
ports: | |
- "9092:9092" | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
working-directory: ${{ env.rails_app_root }} | |
bundler-cache: true | |
- name: Run RSpec | |
run: | | |
cd ${{ env.rails_app_root }} | |
sleep 5 # Waiting for Kafka to become available | |
./bin/rspec --format json --out tmp/rspec_results.json | |
- name: Generate RSpec report | |
uses: SonicGarden/rspec-report-action@v5 | |
with: | |
json-path: ${{ env.rails_app_root }}/tmp/rspec_results.json | |
if: always() |