Skip to content

Commit

Permalink
Add GitHub Actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
junaruga committed Jan 12, 2021
1 parent e2503dc commit 77677ad
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test
on: [push, pull_request]
jobs:
build:
name: >-
${{ matrix.os }} ruby ${{ matrix.ruby }} ${{ matrix.db }}
# Run all the tests on the new environment as much as possible.
# https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-20.04 # focal
ruby:
- 2.7
db: ['']
include:
- {os: ubuntu-16.04, ruby: 2.4, db: mariadb10.0}
# On the fail-fast: true, it cancels all in-progress jobs
# if any matrix job fails unlike Travis fast_finish.
fail-fast: false
steps:
- uses: actions/checkout@v2
# https://github.com/ruby/setup-ruby
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- if: matrix.db != ''
run: echo 'DB=${{ matrix.db }}' >> $GITHUB_ENV
- run: bash .travis_setup.sh
- run: bundle exec rake
13 changes: 11 additions & 2 deletions .travis_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

set -eux

# Install system MySQL if DB is not set.
if [[ -z ${DB-} ]]; then
sudo apt-get update -qq
sudo apt-get install -qq mysql-server-8.0 mysql-client-8.0
sudo service mysql restart
sudo service mysql status
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''"
fi

# Install MySQL 5.5 if DB=mysql55
if [[ -n ${DB-} && x$DB =~ ^xmysql55 ]]; then
sudo bash .travis_mysql55.sh
Expand All @@ -19,12 +28,12 @@ fi

# Install MariaDB client headers after Travis CI fix for MariaDB 10.2 broke earlier 10.x
if [[ -n ${DB-} && x$DB =~ ^xmariadb10.0 ]]; then
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' libmariadbclient-dev
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' mariadb-server mariadb-server-10.0 libmariadb-client-lgpl-dev
fi

# Install MariaDB client headers after Travis CI fix for MariaDB 10.2 broke earlier 10.x
if [[ -n ${DB-} && x$DB =~ ^xmariadb10.1 ]]; then
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' libmariadbclient-dev
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' mariadb-server mariadb-server-10.1 libmariadbclient18
fi

# Install MariaDB 10.2 if DB=mariadb10.2
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ group :test do
gem 'rubocop', '~> 0.50.0'
end

group :benchmarks do
group :benchmarks, optional: true do
gem 'activerecord', '>= 3.0'
gem 'benchmark-ips'
gem 'do_mysql'
Expand All @@ -28,7 +28,7 @@ group :benchmarks do
gem 'sequel'
end

group :development do
group :development, optional: true do
gem 'pry'
gem 'rake-compiler-dock', '~> 0.7.0'
end
Expand Down

0 comments on commit 77677ad

Please sign in to comment.