DEV: Fix linting #314
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Ruby ${{ matrix.ruby }} (redis ${{ matrix.redis }}) | |
timeout-minutes: 10 | |
env: | |
PGHOST: localhost | |
PGPASSWORD: postgres | |
PGUSER: postgres | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby: [2.6, 2.7, '3.0', 3.1] | |
redis: [5, 6] | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_DB: message_bus_test | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
redis: | |
image: ${{ format('redis:{0}', matrix.redis) }} | |
ports: | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler-cache: true | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm | |
- name: Setup npm | |
run: npm install | |
- name: Tests | |
env: | |
TESTOPTS: --verbose | |
run: bundle exec rake | |
timeout-minutes: 3 | |
- name: Linting | |
run: npx eslint . | |
publish: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Release gem | |
uses: discourse/publish-rubygems-action@v2 | |
id: publish-gem | |
env: | |
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} | |
GIT_EMAIL: [email protected] | |
GIT_NAME: discoursebot | |
- name: Update package version | |
if: steps.publish-gem.outputs.new_version == 'true' | |
run: | | |
VERSION=$(ruby -r './lib/message_bus/version' -e 'puts MessageBus::VERSION') | |
sed -i "s/0.0.0-version-placeholder/$VERSION/" package.json | |
git config --global user.email "[email protected]" | |
git config --global user.name "Discourse CI" | |
git add package.json | |
git commit -m 'bump' | |
- name: Publish package | |
uses: JS-DevTools/npm-publish@v1 | |
if: steps.publish-gem.outputs.new_version == 'true' | |
with: | |
token: ${{ secrets.NPM_TOKEN }} |