Run tsc on build #338
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
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: pages_test | |
name: Build | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
jobs: | |
rubocop-test: | |
name: Rubocop | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
if: "!contains(github.event.head_commit.message, '[ci skip]')" | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: 3.3 | |
- name: Check code | |
run: bundle exec rubocop | |
eslint-test: | |
name: ESLint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Node modules cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Node modules | |
run: | | |
yarn install | |
- name: Check code | |
run: yarn lint | |
typescript-test: | |
name: Typescript | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Node modules cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Node modules | |
run: | | |
yarn install | |
- name: Check code | |
run: yarn tsc --noEmit | |
rspec-test: | |
name: RSpec | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[ci skip]')" | |
strategy: | |
matrix: | |
ruby: ["3.1", "3.2", "3.3"] | |
services: | |
postgres: | |
image: postgres:latest | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install system dependencies | |
run: sudo apt-get install -y libpq-dev libvips42 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler-cache: true | |
- name: Node modules cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Node modules | |
run: | | |
yarn install | |
- name: Create database | |
env: | |
RAILS_ENV: test | |
PGHOST: localhost | |
PGUSER: ${{ env.POSTGRES_USER }} | |
PGPASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
run: | | |
bundle exec rake db:migrate | |
- name: Run tests | |
env: | |
PGHOST: localhost | |
PGUSER: ${{ env.POSTGRES_USER }} | |
PGPASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
run: bundle exec rspec | |
- name: Send results to Code Climate | |
uses: paambaati/[email protected] | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
with: | |
coverageCommand: ls | |
notify-slack: | |
name: Slack notification | |
if: "always() && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[ci skip]')" | |
needs: | |
- rubocop-test | |
- eslint-test | |
- typescript-test | |
- rspec-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prepare message | |
id: message | |
uses: anyone-oslo/github-action-notify-slack@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
run-id: ${{ github.run_id }} | |
run-number: ${{ github.run_number }} | |
- name: Send to Slack | |
if: success() | |
run: | | |
curl -X POST ${{ secrets.SLACK_WEBHOOK_URL}} -H "Content-type: application/json" --data '${{ steps.message.outputs.message }}' |