Move CI off Travis to GitHub

This commit is contained in:
Hakan Ensari 2019-11-22 14:30:44 +00:00
parent 0584ef54c2
commit af9e8c8665
4 changed files with 55 additions and 41 deletions

52
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: build
on: [push, pull_request]
jobs:
build:
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
DATABASE_URL: postgres://postgres@localhost/postgres
GIT_COMMIT_SHA: ${{ github.sha }}
GIT_BRANCH: ${{ github.ref }}
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v1
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Set up reporter
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Run tests
run: |
gem install bundler
bundle install --jobs 4 --retry 3
bundle exec rake
- name: Publish image
uses: elgohr/Publish-Docker-Github-Action@master
if: github.event_name == 'push' && github.ref == 'master'
with:
name: hakanensari/frankfurter
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Report to Code Climate
continue-on-error: true
if: success()
run: ./cc-test-reporter after-build --exit-code $?

View File

@ -1,35 +0,0 @@
dist: trusty
sudo: false
language: ruby
rvm:
- 2.6.5
addons:
postgresql: 10
apt:
packages:
- postgresql-10
- postgresql-client-10
services:
- docker
before_install:
- sudo sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/*/main/pg_hba.conf
- sudo service postgresql restart
- sleep 1
- psql -c 'create database frankfurter_test;' -U postgres
- gem install bundler
bundler_args: --without development
env:
global:
- APP_ENV=test
- PGPORT=5433
deploy:
provider: script
script: bash bin/docker_push
on:
branch: master

View File

@ -1,6 +1,8 @@
# Frankfurter
[![Build](https://travis-ci.org/hakanensari/frankfurter.svg?branch=master)](https://travis-ci.org/hakanensari/frankfurter.svg?branch=master)
[![Build](https://github.com/hakanensari/frankfurter/workflows/build/badge.svg)](https://github.com/hakanensari/frankfurter/actions)
[![Maintainability](https://api.codeclimate.com/v1/badges/81f8a458f29f171928f7/maintainability)](https://codeclimate.com/github/hakanensari/frankfurter/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/81f8a458f29f171928f7/test_coverage)](https://codeclimate.com/github/hakanensari/frankfurter/test_coverage)
[Frankfurter](https://www.frankfurter.app) is a free, open-source currency data API that tracks reference exchange rates published by the European Central Bank.

View File

@ -1,5 +0,0 @@
#!/bin/bash
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker build -t "$DOCKER_USERNAME/frankfurter" .
docker push "$DOCKER_USERNAME/frankfurter"