Skip to content

Commit

Permalink
Migrate from Travis CI to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorbg committed May 7, 2021
1 parent ca15c11 commit 688fda5
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
66 changes: 66 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Ruby

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
env:
DATABASE_URL: mysql2://root:@127.0.0.1:3306/wca_test
RACK_ENV: test
defaults:
run:
working-directory: WcaOnRails
steps:
- uses: actions/checkout@v2
- name: Activate MySQL # as per https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#mysql
run: |
sudo systemctl start mysql.service
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';" -u root -proot
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.3
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Update Bundler workaround
run: |
yes | gem update --system
yes | gem update bundler
- uses: actions/setup-node@v2 # this also includes Yarn
with:
node-version: '12'
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-node_modules
- uses: actions/cache@v2
with:
path: '~/.cache/yarn'
key: ${{ runner.os }}-yarn
- uses: actions/cache@v2
with:
path: '~/.phantomjs'
key: ${{ runner.os }}-phantomjs
- name: Populate database with seeds
run: bundle exec rake db:reset
- name: Pre-compile assets for frontend tests
env:
DISABLE_SPRING: 1
run: bundle exec rake assets:precompile
- name: Run Overcommit commit hooks
run: bundle exec overcommit --sign && bundle exec overcommit --sign pre-commit && (cd .. && BUNDLE_GEMFILE=WcaOnRails/Gemfile bundle exec overcommit --run)
- name: Run tests
run: bundle exec rake
2 changes: 1 addition & 1 deletion .travis.yml → .travis-old.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cache:
- $HOME/.phantomjs
- $HOME/.bundle
- WcaOnRails/node_modules
yarn: true
yarn: true # $HOME/.cache/yarn
env:
global:
- DATABASE_URL=mysql2://root:@127.0.0.1:3306/wca_test
Expand Down

0 comments on commit 688fda5

Please sign in to comment.