|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake |
| 6 | +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby |
| 7 | + |
| 8 | +name: Build - 2.6, 2.5 |
| 9 | + |
| 10 | +on: |
| 11 | + pull_request: |
| 12 | + branches: [ master, "2.1" ] |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + ruby-version: [2.6.6, 2.5.8] |
| 20 | + env: |
| 21 | + DATABASE_URL: mysql2://root@127.0.0.1:3800/myapp_test |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + - name: Start MySQL |
| 25 | + uses: cbaudouinjr/mysql-action@v1.9 |
| 26 | + with: |
| 27 | + host port: 3800 |
| 28 | + container port: 3800 |
| 29 | + mysql timezone: America/New_York |
| 30 | + mysql version: '5.7' |
| 31 | + mysql database: 'myapp_test' |
| 32 | + - name: Update and install packages |
| 33 | + run: | |
| 34 | + sudo apt-get update |
| 35 | + sudo apt-get install -y libtool |
| 36 | + sudo apt-get install -y libyaml-dev |
| 37 | + sudo apt-get install -y build-essential |
| 38 | + sudo apt-get install -y libxslt-dev |
| 39 | + sudo apt-get install -y libxml2-dev |
| 40 | + sudo apt-get install -y default-libmysqlclient-dev |
| 41 | + sudo apt-get install -y default-mysql-client |
| 42 | + - name: Set up Ruby |
| 43 | + env: |
| 44 | + ImageOS: ubuntu18 |
| 45 | + # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, |
| 46 | + # change this to (see https://github.com/ruby/setup-ruby#versioning): |
| 47 | + # uses: ruby/setup-ruby@v1 |
| 48 | + # This version tag came with the Ruby build script built by GitHub. @v1 does not work. |
| 49 | + uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a |
| 50 | + with: |
| 51 | + ruby-version: ${{ matrix.ruby-version }} |
| 52 | + - name: Install gems |
| 53 | + run: | |
| 54 | + gem install pkg-config |
| 55 | + bundle config build.nokogiri --use-system-libraries |
| 56 | + bundle install |
| 57 | + - name: Run migrations |
| 58 | + run: | |
| 59 | + bin/rails db:migrate |
| 60 | + - name: Run tests |
| 61 | + run: bundle exec rake |
0 commit comments