Skip to content

COMPATIBILITY: Modernize the component #30

COMPATIBILITY: Modernize the component

COMPATIBILITY: Modernize the component #30

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
container: discourse/discourse_test:slim-browsers
timeout-minutes: 30
env:
DISCOURSE_HOSTNAME: www.example.com
RUBY_GLOBAL_METHOD_CACHE_SIZE: 131072
RAILS_ENV: development
QUNIT_RAILS_ENV: development
PGHOST: postgres
PGUSER: discourse
PGPASSWORD: discourse
services:
postgres:
image: postgres:13
ports:
- 5432:5432
env:
POSTGRES_USER: discourse
POSTGRES_PASSWORD: discourse
options: >-
--mount type=tmpfs,destination=/var/lib/postgresql/data
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
with:
repository: discourse/discourse
fetch-depth: 1
- name: Install component
uses: actions/checkout@v2
with:
path: tmp/component
fetch-depth: 1
- name: Setup Git
run: |
git config --global user.email "ci@ci.invalid"
git config --global user.name "Discourse CI"
- name: Start redis
run: |
redis-server /etc/redis/redis.conf &
- name: Start Postgres
run: |
chown -R postgres /var/run/postgresql
sudo -E -u postgres script/start_test_db.rb
sudo -u postgres psql -c "CREATE ROLE $PGUSER LOGIN SUPERUSER PASSWORD '$PGPASSWORD';"
- name: Bundler cache
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-2.7-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-2.7-gem-
- name: Setup gems
run: |
bundle config --local path vendor/bundle
bundle config --local deployment true
bundle config --local without development
bundle install --jobs 4
bundle clean
- name: Get yarn cache directory
id: yarn-cache-dir
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.os }}-yarn-
- name: Yarn install
run: yarn install
- name: Migrate database
run: |
bin/rake db:create
bin/rake db:migrate
- name: Check qunit existence
id: check_qunit
shell: bash
run: |
shopt -s extglob
if ls tmp/component/test/**/*.@(js|es6) &> /dev/null; then
echo "::set-output name=files_exist::true"
fi
- name: Component QUnit
if: steps.check_qunit.outputs.files_exist == 'true'
run: |
bundle exec rake themes:install -- '--{"${{ github.event.repository.name }}": "tmp/component"}'
UNICORN_TIMEOUT=120 bundle exec rake themes:qunit[name,${{ github.event.repository.name }}]
timeout-minutes: 10
- name: Lint English locale
if: ${{ always() }}
run: bundle exec ruby script/i18n_lint.rb "tmp/component/locales/en.yml"