diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 00000000000..908f671fcd2 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -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 diff --git a/.travis.yml b/.travis-old.yml similarity index 97% rename from .travis.yml rename to .travis-old.yml index 2b4f7e0a060..5356ff731c3 100644 --- a/.travis.yml +++ b/.travis-old.yml @@ -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