100 lines
2.4 KiB
YAML
100 lines
2.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
env:
|
|
RAILS_ENV: test
|
|
PGUSER: discourse
|
|
PGPASSWORD: discourse
|
|
LOAD_PLUGINS: 1
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
container: discourse/discourse_test:slim
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- name: Set working directory owner
|
|
run: chown -R root:root .
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install JS dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Bundle install
|
|
run: bundle install
|
|
|
|
- name: Rubocop
|
|
run: bundle exec rubocop .
|
|
|
|
- name: Syntax Tree
|
|
run: bundle exec stree check Gemfile $(git ls-files '*.rb')
|
|
|
|
- name: ESLint, Stylelint, Prettier and Types
|
|
run: pnpm lint
|
|
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
container: discourse/discourse_test:slim-browsers
|
|
timeout-minutes: 60
|
|
|
|
steps:
|
|
- name: Set working directory owner
|
|
run: chown -R root:root .
|
|
|
|
- name: Checkout plugin
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: plugin
|
|
|
|
- name: Clone Discourse core
|
|
run: git clone --depth 1 --branch latest https://github.com/discourse/discourse.git core
|
|
|
|
- name: Install plugin
|
|
run: cp -r plugin core/plugins/hledger
|
|
|
|
- name: Install hledger
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends hledger
|
|
hledger --version
|
|
|
|
- name: Start Redis
|
|
run: redis-server /etc/redis/redis.conf &
|
|
|
|
- name: Start Postgres
|
|
working-directory: core
|
|
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: Setup gems
|
|
working-directory: core
|
|
run: bundle install
|
|
|
|
- name: Install JS dependencies
|
|
working-directory: core
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Prepare database
|
|
working-directory: core
|
|
run: |
|
|
bin/rake db:create
|
|
bin/rake db:migrate
|
|
|
|
- name: Plugin RSpec
|
|
working-directory: core
|
|
run: bin/rspec plugins/hledger/spec/lib plugins/hledger/spec/requests
|
|
|
|
- name: Plugin QUnit
|
|
working-directory: core
|
|
env:
|
|
DISCOURSE_DISABLE_BROWSER_SANDBOX: "1"
|
|
run: bin/rake plugin:qunit['hledger'] |