Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action #17

Merged
merged 8 commits into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
env:
RUBY_VERSION: 2.6.x
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: safe_pg_migrations_test
PGPASSWORD: postgres

name: Rake tests
on: pull_request

jobs:
rubocop-test:
name: Rubocop
runs-on: ubuntu-18.04
steps:
- uses: doctolib/checkout@v1
- uses: doctolib/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
- uses: doctolib/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: bundle
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
Comment on lines +17 to +30
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to move this part here in an independent action, but as document in actions/runner#438 it is not yet possible to use other actions in composite actions.

Apparently github is working on it, once done we could have an internal action in a repo that we can use in any of our repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would also make the file a lot shorter :)

- name: Install Rubocop
run: gem install rubocop
- name: Check code
run: bundle exec rubocop
unit-test:
name: UnitTest
runs-on: ubuntu-18.04
# Service containers to run with `container-job`
services:
postgres:
image: postgres:9.6
env:
POSTGRES_DB: safe_pg_migrations_test
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: doctolib/checkout@v1
- name: Set up Ruby
uses: doctolib/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
- uses: doctolib/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: bundle
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run tests
run: bundle exec rake test
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.