Skip to content

Commit

Permalink
Add github action (#17)
Browse files Browse the repository at this point in the history
* Add github action

* Remove travis

* Add only rubocop

* Setup CI: using local actions (#3)

* Using local actions

* Add RuboCop

* Limit to push master and pr

* Pull request only

* No dependency on test

* Using real ruby versions

* Update ruby version

* options for PG?

* Start service

* Split

* Change service

* with env

* Remove host

* Stop starting the service

* Trying other config

* idea

* Adding password to env

* real test script

* Add cache

* Add rubocop

* Install in dedicated script

* Fix

* Fix fix

* Fix fix fix

* remove needs

* Using doctolib actions

* Using 9.6
  • Loading branch information
Thomas Hareau authored Sep 18, 2020
1 parent f5ee3c5 commit 3996f0e
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 11 deletions.
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
- 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.

0 comments on commit 3996f0e

Please sign in to comment.