[Feature] Enable contributing over api #2853
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: | ||
pull_request: | ||
branches: [ main ] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
env: | ||
RUBYOPT: "-W:no-deprecated" | ||
RAILS_ENV: test | ||
DATABASE_URL: postgres://postgres:postgres@localhost:5432 | ||
services: | ||
postgres: | ||
image: postgres:12.2 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: app_test | ||
ports: [ "5432:5432" ] | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Setup upterm session | ||
uses: lhotari/action-upterm@v1 | ||
with: | ||
## limits ssh access and adds the ssh public key for the user which triggered the workflow | ||
limit-access-to-actor: true | ||
## limits ssh access and adds the ssh public keys of the listed GitHub users | ||
limit-access-to-users: mattwr18 | ||
if: ${{ failure() }} | ||
with: | ||
## If no one connects after 5 minutes, shut down server. | ||
wait-timeout-minutes: 5 | ||
- name: Update file watchers because of rails settings cached | ||
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p | ||
- name: Read .tool-versions | ||
uses: marocchino/tool-versions-action@v1 | ||
id: versions | ||
- name: Use Node.js ${{ steps.versions.outputs.nodejs}} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ steps.versions.outputs.nodejs}} | ||
- name: Install ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ steps.versions.outputs.ruby}} | ||
bundler-cache: true | ||
- name: Cache NPM dependencies | ||
uses: actions/cache@v3.2.6 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: ${{ runner.os }}-npm- | ||
- name: Install NPM dependencies | ||
run: npm install | ||
- name: Run prettier | ||
run: npm run prettier | ||
- name: Build JS | ||
run: npm run build:js | ||
- name: Build CSS | ||
run: npm run build:css | ||
- name: Run database migrations | ||
run: bin/rails db:migrate | ||
- name: Run rubocop | ||
run: bundle exec rubocop | ||
- name: Run tests | ||
run: bin/rake spec |