Created
November 14, 2019 14:13
-
-
Save chiefpansancolt/4e655e467a8aaeebfae7766830bb6d31 to your computer and use it in GitHub Desktop.
Ruby on Rails Github Actions
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: Builds | |
on: [pull_request] | |
jobs: | |
ruby-build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:11 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: "" | |
POSTGRES_DB: postgres | |
ports: | |
- 5432/tcp | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Ruby 2.6.x | |
uses: actions/setup-ruby@v1 | |
with: | |
ruby-version: 2.6.x | |
- name: Build and create DB | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPORT: ${{ job.services.postgres.ports[5432] }} | |
RAILS_ENV: test | |
run: | | |
sudo apt-get install libpq-dev | |
gem install bundler | |
bundle install --jobs 4 --retry 3 | |
bundle exec rails db:prepare | |
node-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: '13.x' | |
- run: yarn install |
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: Lints | |
on: [pull_request] | |
jobs: | |
ruby-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Rubocop Linter | |
uses: andrewmcodes/rubocop-linter-action@v1.0.3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
haml-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: HAML Lint | |
uses: andrewmcodes/haml-lint-action@v0.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
js-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: eslint | |
uses: reviewdog/action-eslint@v1 | |
with: | |
github_token: ${{ secrets.github_token }} | |
reporter: github-pr-check | |
eslint_flags: 'app/**/* postcss.config.js babel.config.js' | |
css-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: stylelint | |
uses: reviewdog/action-stylelint@v1 | |
with: | |
github_token: ${{ secrets.github_token }} | |
reporter: github-pr-check | |
stylelint_input: 'app/**/*.scss' |
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
# usage with redis | |
name: Tests | |
on: [pull_request] | |
jobs: | |
ruby-test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:11 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: "" | |
POSTGRES_DB: postgres | |
ports: | |
- 5432/tcp | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: zhulik/redis-action@v1.0.0 | |
with: | |
redis version: '4' | |
- name: Set up Ruby 2.6.x | |
uses: actions/setup-ruby@v1 | |
with: | |
ruby-version: 2.6.x | |
- name: Build and create DB | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPORT: ${{ job.services.postgres.ports[5432] }} | |
RAILS_ENV: test | |
run: | | |
sudo apt-get install libpq-dev | |
gem install bundler | |
bundle install --jobs 4 --retry 3 | |
bundle exec rails db:prepare |
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: Tests | |
on: [pull_request] | |
jobs: | |
ruby-test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:11 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: "" | |
POSTGRES_DB: postgres | |
ports: | |
- 5432/tcp | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Ruby 2.6.x | |
uses: actions/setup-ruby@v1 | |
with: | |
ruby-version: 2.6.x | |
- name: Build and Run Tests | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPORT: ${{ job.services.postgres.ports[5432] }} | |
RAILS_ENV: test | |
run: | | |
sudo apt-get install libpq-dev | |
gem install bundler | |
bundle install --jobs 4 --retry 3 | |
bundle exec rails db:prepare | |
bundle exec rake test |
Yea it puzzled me haha, but its working so im just rolling with it haha.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@chiefpansancolt gotcha. Interesting.