Skip to content

Cleanup job code

Cleanup job code #36

Workflow file for this run

name: 'Rails Lint and Test'
on:
workflow_dispatch:
push:
paths-ignore:
- 'doc/**'
- '**.md'
pull_request:
paths-ignore:
- 'doc/**'
- '**.md'
jobs:
build:
runs-on: 'ubuntu-20.04'
env:
HEADLESS: true
RAILS_DB_ADAPTER: mysql2
RAILS_DB_HOST: 127.0.0.1
RAILS_DB_PORT: 33066
RAILS_DB_USERNAME: hitobito
RAILS_DB_PASSWORD: hitobito
RAILS_DB_NAME: hitobito_test
RAILS_TEST_DB_NAME: hitobito_test
TZ: Europe/Berlin
RAILS_USE_TEST_GROUPS: true
services:
mysql:
image: 'mysql:5.7'
env:
MYSQL_USER: 'hitobito'
MYSQL_PASSWORD: 'hitobito'
MYSQL_DATABASE: 'hitobito_test'
MYSQL_ROOT_PASSWORD: 'root'
ports:
- '33066:3306'
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 10s
--health-retries 10
memcached:
image: 'memcached'
ports: [ '11211:11211' ]
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Set up Ruby'
uses: ruby/setup-ruby@v1
env:
ImageOS: ubuntu20
- name: Read .tool-versions
uses: marocchino/tool-versions-action@v1
id: readToolVersions
- name: Set up Node.js ${{ steps.readToolVersions.outputs.nodejs }}
uses: actions/setup-node@v4
with:
node-version: ${{ steps.readToolVersions.outputs.nodejs }}
- name: 'Setup OS'
run: |
sudo apt-get -qq update
sudo apt-get install sphinxsearch
echo "ruby version: $(ruby -v)"
echo "bundle version: $(bundle -v)"
echo "node version: $(node -v)"
echo "yarn version: $(yarn -v)"
- name: 'create cache key'
run: cp Gemfile.lock Gemfile.lock.backup
- uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-ruby-bundle-${{ hashFiles('**/Gemfile.lock.backup') }}
restore-keys: |
${{ runner.os }}-ruby-bundle-
- name: 'Bundle install'
run: |
bundle install --jobs 4 --retry 3 --path vendor/bundle
- name: 'Make changes to Gemfile.lock transparent'
run: git diff Gemfile.lock || true
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: 'Yarn install'
run: |
yarn install --frozen-lockfile
- name: 'Run Webpacker'
run: |
bundle exec rake webpacker:compile
- name: 'Rubocop'
run: |
bundle exec rake rubocop
- name: 'Run db migrations'
run: |
bundle exec rake db:migrate
- name: 'Main Specs without features'
run: |
bundle exec rake ci:setup:env spec:without_features
- name: 'Sphinx'
run: |
bundle exec rake ci:setup:env spec:sphinx
- name: 'Features'
run: |
bundle exec rake ci:setup:env spec:features:lenient
- name: 'Make capybara output downloadable'
uses: actions/upload-artifact@v4
if: always()
with:
name: capybara-output
path: |
tmp/capybara
notify_statuscope:
uses: ./.github/workflows/notify-statuscope.yml
needs: [ build ]
if: ( success() || failure() ) && ( github.ref_name == 'master' )
with:
repository: 'hitobito'
test_result: ${{ needs.build.result == 'success' }}
secrets:
HEARTBEAT_URL: ${{ secrets.HEARTBEAT_URL }}
HEARTBEAT_TOKEN: ${{ secrets.HEARTBEAT_TOKEN }}