diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml new file mode 100644 index 0000000..d84ffeb --- /dev/null +++ b/.github/workflows/continuous-integration-workflow.yml @@ -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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4028606..0000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: ruby -cache: bundler -rvm: - - 2.5 -services: - - postgresql -addons: - postgresql: "9.6" - -before_script: - - psql -c 'CREATE DATABASE safe_pg_migrations_test' -U postgres