Skip to content

Elasticsearch endpoint set up #455

Elasticsearch endpoint set up

Elasticsearch endpoint set up #455

Workflow file for this run

name: Run linter and tests
on:
push:
branches:
- master
- simplecov
- semgrep_fixes
- hardening-dockerfile-sq
pull_request:
permissions:
contents: read
security-events: write
env:
GIT_AUTHOR_NAME: ${{ vars.GIT_AUTHOR_NAME }}
GIT_AUTHOR_EMAIL: ${{ vars.GIT_AUTHOR_EMAIL }}
jobs:
test:
name: "Lint, test & analyse"
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: metadataregistry_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/metadataregistry_test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Pre-cache grape-middleware-logger gem
run: |
mkdir -p vendor/cache
if [ -f local_packages/grape-middleware-logger-2.4.0.gem ]; then
cp -v local_packages/grape-middleware-logger-2.4.0.gem vendor/cache/
fi
- uses: ruby/setup-ruby@v1
with:
bundler-cache: false
ruby-version: '3.4'
- name: Install gems (non-frozen)
run: |
bundle config set path vendor/bundle
bundle config set frozen false
bundle install --jobs 4
- run: RACK_ENV=test bundle exec rake db:migrate
# Rubocop, bundler-audit, etc. are executed through Overcommit hooks.
- name: Run Overcommit hooks
run: |
bundle exec overcommit --sign
bundle exec overcommit --run
continue-on-error: true
- run: bundle exec rspec
- name: SonarQube scan
uses: sonarsource/sonarqube-scan-action@v5.2.0
if: always()
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
- name: Upload coverage report
if: ${{ always() && hashFiles('coverage/**') != '' }}
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/