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 |
@chiefpansancolt I would disagree with that statement. I have used Redis in production as an image before, but it’s hard to say that with 100% confidence without knowing what you’re doing with it.
I have Redis working on my test repo as a service I believe ¯_(ツ)_/¯
Yea this action is using redis in a docker file. over setting redis in a services. That caused my issue, why i do not know. I am still using a docker image just adding in a different way. @andrewmcodes
@chiefpansancolt gotcha. Interesting.
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
Redis cannot be used as an image as the url disallows connection from cable from what i have found not sure why just does not allow connection to the redis server