frankfurter/.github/workflows/build.yml
2019-11-22 14:46:38 +00:00

56 lines
1.4 KiB
YAML

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
ports:
- 5432:5432
steps:
- uses: actions/checkout@v1
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.3
- 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: |
sudo apt-get install libpq-dev
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 $?