From 84790bbc613f09bf22a4ba48db76116ee9bc0db2 Mon Sep 17 00:00:00 2001 From: Sergio Alvarez Date: Fri, 18 Aug 2023 12:10:53 +0200 Subject: [PATCH] Migrate CI to Github Actions --- .github/workflows/publish.yml | 23 ++++++++++++++++++++++ .github/workflows/rspec.yml | 36 +++++++++++++++++++++++++++++++++++ .travis.yml | 26 ------------------------- README.md | 2 +- 4 files changed, 60 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/rspec.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..9f4716f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,23 @@ +name: Publish Gem +on: + release: + types: + - "created" + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Publish to RubyGems + run: | + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials + gem build mysql_framework.gemspec + gem push mysql_framework-*.gem + env: + GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}" diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml new file mode 100644 index 0000000..4ab9a63 --- /dev/null +++ b/.github/workflows/rspec.yml @@ -0,0 +1,36 @@ +name: RSpec +on: + - push +jobs: + test: + runs-on: ubuntu-latest + + services: + mysql: + image: mysql:5.7 + ports: + - 3306:3306 + env: + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + redis: + image: redis:latest + ports: + - 6379:6379 + + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.4 + bundler-cache: true + + - name: Run tests + run: bundle exec rspec + + - name: Code Coverage + uses: paambaati/codeclimate-action@v2.7.5 + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + with: + coverageLocations: | + ${{github.workspace}}/coverage/.resultset.json:simplecov diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0913656..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: ruby -services: - - mysql - - redis-server -rvm: - - 2.4.0 - - 2.5.0 -before_script: - - 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" -after_script: - - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT" -env: - global: - secure: kxLjg7wpaHBxceZE6d7LdG5FGiZtSxwsQcuJjdlGryt4ZBukW8fpymN0KNdx3V9w2UH4NCqAdx0EZR2ano/VAQ6tOhAVS70LLl0PmNJqzv9TtFhD8vqc+tCHmoKk8hiAJDY9qmp3zmyp3Wlp2C/SvnqvGj/P0/g2mqWijzh+y9//s8ZJaEJkJ0o+iSCf1QlRI44/FidHnNPCmaY13dAikOCOykxQK34wMsXLG7LilyKFe7mwr0yo67ZlwDxbFs3AhCZirfkYbkDy22GhQCmLyiA/iWV7jovWSJ07spATOHlxvtDEXpkSNJq6hc5PKNT0g1H0hxVBwzC9cWxKpMmO/LRSDoXFa1ZOSU91C+EAQio3wPoXu6tOX5w6YrPI8kgZVOyPuIVKw4s0u0hktVEe4DU0VNCmNm7+Y8ase3bh9IAJLKRxzNwQsWNMW53qWIK9D5oyxHFFmUuNNiPi22xm99bF2wz4OTg65o25TIMuHXKqjli2nn0Y8MWgDzFcvf+y4mpvwzv3cWmAKJeU0LBlwzi0CQgZ9rewAJcWPakNsBcQl9xXLo2UzNpDGQKWXHLKfKST32Q3+A0zK8/XhkvSNH+ws/bbgoAOwrUJnhWZTQ6BPQFpaLk/pJtanfrAWOKB5jWeB8ErwmF/uU5fR537xqWEK1QIq1T9QvsdzaeYO08= -deploy: - provider: rubygems - api_key: - secure: FYZP52Y2n2JR8YJ2YdFpnJ8/0KVAa4yfpH7580VZFSRYiDZQ17teaFbVhhB5tlrODweo6eXYNQLyvhZnifEpw7zP/0lcGrc7wLrbRxmYPgMO8520W2HxPpp4nFu+y/LgVB/bOL2VOtuiCnG0ps/iuNiNdc76jvie1dZzkknfuoAM2RmUJasgFEVtlrDBypsSF0cCtDQiw0NpkrcHdrndGFdSuqEWHgWGmSpQmlJ+3u8bEWwB+AtNf5k6CsOrNilY1T8VAGnh+bk5P9+ngysjIBWR71pWdVQ1wieEFJyeVf5dBmG9HyOdsjcWZYiVtokcemNP+Spr6NX/ZdMEMUcu9/gv6IyvgPYjGrx4r+zH3A1o4G5wPCMbN5CDrCYybpsW9KZE7/FKhdCDHnKf8ajk6QgzW8cd0abup/O/Nj172vxY059Py2h8Jn8OvlnE2/aG+42poNQaLHO1t04/8VwnDkAnFQD2nU5Fvsr3OEKKdzCviXMk3W9xAxdg4lYTHLIdDRoqRMsors4ZwgJhyPEFlBzJ4RrkRkSLWMDbnLaIErl8KKz1LdjDs08tV322ZUyY+UN8XZwpAR+YC6MyswFI4EyTNtGvFDrcm/YoB7wJG0Rjl3cmEjUl/DZVAYVr3btOSL/Nm/C1TK852Lda/ors/HHA8DeaRDw7GjH3odXQxxQ= - gem: mysql_framework - on: - tags: true - repo: Sage/mysql_framework - condition: "$TRAVIS_RUBY_VERSION == 2.5.0" diff --git a/README.md b/README.md index 657ec10..83971fd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Mysql_Framework -[![Build Status](https://travis-ci.org/Sage/mysql_framework.svg?branch=master)](https://travis-ci.org/Sage/mysql_framework) +[![RSpec](https://github.com/Sage/mysql_framework/actions/workflows/rspec.yml/badge.svg)](https://github.com/Sage/mysql_framework/actions/workflows/rspec.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/36068a1f03ea88d08b86/maintainability)](https://codeclimate.com/github/Sage/mysql_framework/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/36068a1f03ea88d08b86/test_coverage)](https://codeclimate.com/github/Sage/mysql_framework/test_coverage) [![Gem Version](https://badge.fury.io/rb/mysql_framework.svg)](https://badge.fury.io/rb/mysql_framework)