Skip to content

fix(Actions): upgrade create-pull-request to v6 #5882

fix(Actions): upgrade create-pull-request to v6

fix(Actions): upgrade create-pull-request to v6 #5882

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
types: [opened, reopened, synchronize]
jobs:
static-analysis:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Validate commit message format
uses: wagoid/commitlint-github-action@v4
with:
configFile: './.commitlint.yml'
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: latest
bundler: latest
- name: Rubocop
run: bundle exec rubocop --parallel
- name: Brakeman
run: bundle exec brakeman
- name: ShellCheck
uses: ludeeus/[email protected]
with:
ignore: vendor
check_together: true
development-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up the environment
run: |
cp .env.example .env
pipx install podman-compose==1.0.6
- name: Build using podman-compose
run: podman-compose build
- name: Build using docker-compose
run: docker compose build
unit-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: insights
POSTGRES_DB: insights
POSTGRES_PASSWORD: insights
ports: ["5432:5432"]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: latest
bundler: latest
- name: Setup database
env:
RAILS_ENV: test
ACG_CONFIG: ./github-ci.json
DATABASE_SERVICE_NAME: postgres
POSTGRES_SERVICE_HOST: localhost
POSTGRESQL_USER: insights
POSTGRESQL_PASSWORD: insights
POSTGRESQL_TEST_DATABASE: insights
run: |
bin/rails db:setup;
bundle exec rails db -p < db/cyndi_setup_test.sql;
- name: Run zeitwerk check
env:
RAILS_ENV: test
ACG_CONFIG: ./github-ci.json
DATABASE_SERVICE_NAME: postgres
POSTGRES_SERVICE_HOST: localhost
POSTGRESQL_USER: insights
POSTGRESQL_PASSWORD: insights
POSTGRESQL_TEST_DATABASE: insights
run: bin/rails zeitwerk:check
- name: Validate the OpenAPIv2 schema
env:
RAILS_ENV: test
SWAGGER_DRY_RUN: false
ACG_CONFIG: ./github-ci.json
DATABASE_SERVICE_NAME: postgres
POSTGRES_SERVICE_HOST: localhost
POSTGRESQL_USER: insights
POSTGRESQL_PASSWORD: insights
POSTGRESQL_TEST_DATABASE: insights
SPEC_OPTS: "--color --tty --format documentation"
run: |
bundle exec rails db -p < db/cyndi_setup_test.sql;
cp swagger/v2/openapi.json openapi.old.json
bin/rake rswag:specs:swaggerize
symbols=( '"' '[' '{' )
for symbol in "${symbols[@]}"; do
NEW=$(cat swagger/v2/openapi.json | tr -cd "${symbol}" | wc -c)
OLD=$(cat openapi.old.json | tr -cd "${symbol}" | wc -c)
rm -rf coverage
if [[ "${OLD}" != "${NEW}" ]]; then
echo 'OpenAPI Spec needs to be updated:'
echo '$ bin/rake rswag:specs:swaggerize'
diff -s -u --minimal openapi.old.json swagger/v2/openapi.json
rm openapi.old.json
exit 1
fi
done
diff <(echo 'null') <(curl -s 'https://validator.swagger.io/validator/debug' -H 'accept: application/json' -H 'Content-Type: application/json' -d @openapi.old.json | jq '.schemaValidationMessages')
if [[ $? != 0 ]]; then
rm openapi.old.json
exit 1
fi
rm openapi.old.json
exit 0
- name: Run RSpec tests
env:
HOSTNAME: rails
RAILS_ENV: test
ACG_CONFIG: ./github-ci.json
DATABASE_SERVICE_NAME: postgres
POSTGRES_SERVICE_HOST: localhost
POSTGRESQL_USER: insights
POSTGRESQL_PASSWORD: insights
POSTGRESQL_TEST_DATABASE: insights
SPEC_OPTS: "--color --tty --format documentation"
RUBY_YJIT_ENABLE: 1
run: bin/rake spec
- name: Upload code coverage from RSpec
uses: codecov/[email protected]
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
version: v9.0.4
- name: Run minitest tests
env:
HOSTNAME: rails
RAILS_ENV: test
ACG_CONFIG: ./github-ci.json
DATABASE_SERVICE_NAME: postgres
POSTGRES_SERVICE_HOST: localhost
POSTGRESQL_USER: insights
POSTGRESQL_PASSWORD: insights
POSTGRESQL_TEST_DATABASE: insights
RUBY_YJIT_ENABLE: 1
run: bin/rake test
- name: Upload code coverage from minitest
uses: codecov/[email protected]
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
version: v9.0.4
migration-robustness:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: insights
POSTGRES_DB: insights
POSTGRES_PASSWORD: insights
ports: ["5432:5432"]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: latest
bundler: latest
- name: Setup database and run migrations
env:
RAILS_ENV: test
ACG_CONFIG: ./github-ci.json
DATABASE_SERVICE_NAME: postgres
POSTGRES_SERVICE_HOST: localhost
POSTGRESQL_USER: insights
POSTGRESQL_PASSWORD: insights
POSTGRESQL_TEST_DATABASE: insights
run: bin/rails db:create db:migrate
- name: Check if migrations altered the schema.rb
run: "! git diff --unified=0 -- db/schema.rb | grep ^+ActiveRecord"