Skip to content

refactor: datacollector #4182

refactor: datacollector

refactor: datacollector #4182

Workflow file for this run

name: Continuous Integration
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
testing:

Check failure on line 11 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / Continuous Integration

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yml (Line: 11, Col: 3): The workflow must contain at least one job with no dependencies.
needs: [linting]
if: always() && (needs.linting.result == 'success' || needs.linting.result == 'skipped') # https://github.com/actions/runner/issues/491
runs-on: ubuntu-latest
defaults:
run:
shell: bash
container: complat/chemotion_eln_runner:main
services:
postgres:
image: postgres:16 # https://hub.docker.com/_/postgres
env:
POSTGRES_PASSWORD: postgres # env variable required by postgres Docker container
POSTGRES_USER: chemotion # optional env variable used in conjunction with POSTGRES_PASSWORD to set a user and their password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: create user for datacollectors testing
run: |
useradd testuser -ms /bin/bash
mkdir /home/testuser/.ssh
chown testuser:testuser /home/testuser/.ssh
chmod 700 /home/testuser/.ssh
mkdir -p $HOME/.ssh
chmod 700 $HOME/.ssh
service ssh restart
ssh-keygen -t ed25519 -f $HOME/.ssh/id_test -N ""
cat "${HOME}/.ssh/id_test.pub" | tee -a /home/testuser/.ssh/authorized_keys
ssh-keyscan -H 127.0.0.1 >> $HOME/.ssh/known_hosts
- name: configure repository
run: |
mv public/welcome-message-sample.md public/welcome-message.md
cp .env.test.example .env.test
cd config
cp database.yml.gitlab database.yml
cp -f datacollectors.yml.example datacollectors.yml
cp -f profile_default.yml.example profile_default.yml
cp -f shrine.yml.example shrine.yml
cp -f storage.yml.example storage.yml
cp -f radar.yml.example radar.yml
touch klasses.json
bundle config set without ''
- name: configure postgres
env:
PG_ROLE: chemotion_test
PG_ROLE_PASSWORD: 123456
PG_DATABASE: chemotion_test
PGPASSWORD: postgres # env variable required by psql client
run: | # host is service container name
psql -h postgres -U chemotion -c "CREATE ROLE $PG_ROLE LOGIN CREATEDB NOSUPERUSER PASSWORD '$PG_ROLE_PASSWORD';"
psql -h postgres -U chemotion -c "CREATE DATABASE $PG_DATABASE OWNER $PG_ROLE;"
psql -d postgresql://$PG_ROLE:$PG_ROLE_PASSWORD@postgres/$PG_DATABASE -c 'CREATE EXTENSION IF NOT EXISTS "pg_trgm"; CREATE EXTENSION IF NOT EXISTS "hstore"; CREATE EXTENSION IF NOT EXISTS "uuid-ossp";'
- name: bundle install
run: bundle install
- name: prepare postgres
run: |
RAILS_ENV=test bundle exec rake db:migrate
RAILS_ENV=test bundle exec rake db:test:prepare
- name: rspec unit
run: |
service ssh restart
eval `ssh-agent`
DATACOLLECTOR_FACTORY_SFTP_USER=testuser DATACOLLECTOR_FACTORY_SFTP_KEY=id_test RAILS_ENV=test bundle exec rspec --exclude-pattern spec/{features}/**/*_spec.rb spec/lib/datacollector
- name: coverage rspec unit
if: github.event.pull_request && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) && (github.triggering_actor != 'dependabot[bot]') # don't run on PRs from forks because of missing write permission: https://github.com/orgs/community/discussions/26829
uses: zgosalvez/github-actions-report-lcov@v1
with:
coverage-files: coverage/lcov/${{ github.event.repository.name }}.lcov
minimum-coverage: 57
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}