Skip to content

Commit

Permalink
CI: Update Workflows (#196)
Browse files Browse the repository at this point in the history
* Format GitHub Actions workflows with Prettier

* Use "ruby/setup-ruby@v1" as suggested by authors

* Use at least Ruby 2.7

* Update actions/checkout to v4

* Use reviewdog action

* Remove unused env "ImageOs"
  • Loading branch information
ioboi authored Sep 25, 2023
1 parent b18ff90 commit d6c6663
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 87 deletions.
85 changes: 36 additions & 49 deletions .github/workflows/code-style-review.yaml
Original file line number Diff line number Diff line change
@@ -1,59 +1,46 @@
name: 'Code Style Review'
name: "Code Style Review"

on:
pull_request:
branches:
- 'master'
- "master"
paths-ignore:
- 'doc/**'
- '**.md'
- "doc/**"
- "**.md"

jobs:
lint:
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"

steps:
- name: 'Checkout'
uses: actions/checkout@v2

- name: 'Set up Ruby'
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'

- name: 'Set up Reviewdog'
env:
REVIEWDOG_INSTALLER: 'https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh'
run: |
mkdir -p $HOME/bin
curl -sfL ${REVIEWDOG_INSTALLER} | sh -s -- -b $HOME/bin
- name: 'Set up Rubocop'
run: 'gem install rubocop rubocop-minitest rubocop-performance rubocop-rails'

- name: 'Run Rubocop'
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rubocop |
$HOME/bin/reviewdog \
-f=rubocop \
-name="Rubocop" \
-reporter=github-pr-review \
-level=error \
-diff="git diff $DIFF_BRANCH"
- name: 'Set up Haml-lint'
run: 'gem install haml-lint'

- name: 'Run Haml-lint'
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
haml-lint |
$HOME/bin/reviewdog \
-efm="%f:%l %m" \
-name="Haml-lint" \
-reporter=github-pr-review \
-level=error \
-diff="git diff $DIFF_BRANCH"
- name: "Checkout"
uses: actions/checkout@v4

- name: "Set up Ruby"
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7

- name: "Rubocop"
uses: reviewdog/action-rubocop@v2
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-minitest:gemfile rubocop-performance:gemfile rubocop-rails:gemfile
reporter: github-pr-review
level: error

- name: "Install HAML-Lint"
run: "gem install haml-lint"
- name: "Set up reviewdog"
uses: reviewdog/action-setup@v1
- name: "Run reviewdog HAML-Lint"
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
haml-lint |
reviewdog \
-efm="%f:%l %m" \
-name="Haml-lint" \
-reporter=github-pr-review \
-level=error \
-diff="git diff $DIFF_BRANCH"
74 changes: 36 additions & 38 deletions .github/workflows/rails-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,68 +1,66 @@
name: 'Rails Unit Tests'
name: "Rails Unit Tests"

on:
push:
branches:
- 'master'
- "master"
paths-ignore:
- 'doc/**'
- '**.md'
- "doc/**"
- "**.md"
pull_request:
branches:
- 'master'
- "master"
paths-ignore:
- 'doc/**'
- '**.md'
- "doc/**"
- "**.md"

jobs:
build:
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"

timeout-minutes: 15

strategy:
matrix:
ruby: [ '2.6', '2.7' ]
ruby: ["2.6", "2.7"]

services:
postgres:
image: 'postgres:11'
image: "postgres:11"
env:
POSTGRES_PASSWORD: 'postgres'
ports: [ '5432:5432' ]
POSTGRES_PASSWORD: "postgres"
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 10s
--health-retries 10
memcached:
image: 'memcached'
ports: [ '11211:11211' ]
image: "memcached"
ports: ["11211:11211"]

steps:
- name: 'Checkout'
uses: actions/checkout@v2
- name: "Checkout"
uses: actions/checkout@v4

- name: 'Set up Ruby ${{ matrix.ruby }}'
uses: ruby/[email protected]
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
env:
ImageOS: ubuntu18
- name: "Set up Ruby ${{ matrix.ruby }}"
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: 'Build and test with Rake'
env:
RAILS_TEST_DB_NAME: 'postgres'
RAILS_TEST_DB_USERNAME: 'postgres'
RAILS_TEST_DB_PASSWORD: 'postgres'
RAILS_ENV: 'test'
CI: 'true'
PGDATESTYLE: German
run: |
sudo apt-get -yqq install libpq-dev
gem install bundler --version '~> 2'
bundle install --jobs 4 --retry 3
bundle exec rails db:create
bundle exec rails db:migrate
bundle exec rails test
- name: "Build and test with Rake"
env:
RAILS_TEST_DB_NAME: "postgres"
RAILS_TEST_DB_USERNAME: "postgres"
RAILS_TEST_DB_PASSWORD: "postgres"
RAILS_ENV: "test"
CI: "true"
PGDATESTYLE: German
run: |
sudo apt-get -yqq install libpq-dev
gem install bundler --version '~> 2'
bundle install --jobs 4 --retry 3
bundle exec rails db:create
bundle exec rails db:migrate
bundle exec rails test

0 comments on commit d6c6663

Please sign in to comment.