From e92f4931b6f436c244f09f3227598d408d726ff7 Mon Sep 17 00:00:00 2001 From: Pavel Pustovalov Date: Sun, 31 May 2020 22:08:55 +0300 Subject: [PATCH] github actions --- .github/workflows/jest.yml | 41 +++++++++++++++++++++ .github/workflows/js-lint.yml | 42 ++++++++++++++++++++++ .github/workflows/rubocop.yml | 40 +++++++++++++++++++++ .github/workflows/ruby.yml | 67 +++++++++++++++++++++++++++++++++++ Gemfile.lock | 2 +- 5 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/jest.yml create mode 100644 .github/workflows/js-lint.yml create mode 100644 .github/workflows/rubocop.yml create mode 100644 .github/workflows/ruby.yml diff --git a/.github/workflows/jest.yml b/.github/workflows/jest.yml new file mode 100644 index 000000000..a066d2328 --- /dev/null +++ b/.github/workflows/jest.yml @@ -0,0 +1,41 @@ +name: Jest specs + +on: [push, pull_request] + +jobs: + build: + name: Jest specs + strategy: + matrix: + os: [ubuntu-latest] + node: [10.x, 12.x, 14.x] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.node }}-yarn- + + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: Install dependencies + run: yarn --frozen-lockfile + + - name: Jest Specs + run: yarn test diff --git a/.github/workflows/js-lint.yml b/.github/workflows/js-lint.yml new file mode 100644 index 000000000..c286a3b57 --- /dev/null +++ b/.github/workflows/js-lint.yml @@ -0,0 +1,42 @@ +name: JS lint + +on: [push, pull_request] + +jobs: + build: + name: JS Lint + + strategy: + matrix: + os: [ubuntu-latest] + node: [12.x] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: Install dependencies + run: yarn --frozen-lockfile + + - name: Lint + run: yarn lint diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml new file mode 100644 index 000000000..7e3d850f7 --- /dev/null +++ b/.github/workflows/rubocop.yml @@ -0,0 +1,40 @@ +name: Rubocop + +on: [push, pull_request] + +jobs: + build: + name: Rubocop + strategy: + matrix: + os: [ubuntu-latest] + ruby: [ + 2.7 + ] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: actions/cache@v2 + with: + path: /home/runner/bundle + key: bundle-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + bundle-gems- + + - uses: actions/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Bundle install + run: | + gem install bundler -v 2.1.4 + bundle config path /home/runner/bundle + bundle install --jobs 4 --retry 3 + + - name: Ruby linter + run: bundle exec rubocop diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 000000000..179f8c25c --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,67 @@ +name: Ruby specs + +on: [push, pull_request] + +jobs: + build: + name: Ruby specs + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + ruby: [ + 2.4, + 2.5, + 2.6, + 2.7 + ] + gemfile: [ + "gemfiles/Gemfile-rails.5.2.x", + "gemfiles/Gemfile-rails.6.0.x" + ] + exclude: + - ruby: "2.4" + gemfile: gemfiles/Gemfile-rails.6.0.x + experimental: [false] + include: + - ruby: head + os: ubuntu-latest + gemfile: gemfiles/Gemfile-rails.6.0.x + experimental: true + - ruby: 2.6 + os: ubuntu-latest + gemfile: gemfiles/Gemfile-rails-edge + experimental: true + - ruby: 2.7 + os: ubuntu-latest + gemfile: gemfiles/Gemfile-rails-edge + experimental: true + + runs-on: ${{ matrix.os }} + continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' || matrix.experimental }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: actions/cache@v2 + with: + path: /home/runner/bundle + key: bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-gems-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }} + restore-keys: | + bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-gems- + + - uses: actions/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Bundle install + run: | + gem install bundler -v 2.1.4 + bundle config path /home/runner/bundle + bundle config --global gemfile ${{ matrix.gemfile }} + bundle install --jobs 4 --retry 3 + + - name: Ruby specs + run: bundle exec rake test diff --git a/Gemfile.lock b/Gemfile.lock index a705cff33..587581a2d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -171,4 +171,4 @@ DEPENDENCIES webpacker! BUNDLED WITH - 1.17.3 + 2.1.4