Skip to content

Commit

Permalink
Github Workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
joel committed Mar 16, 2021
1 parent e2a09ed commit 9531fc9
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 1 deletion.
43 changes: 43 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2

updates:
- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "daily"
versioning-strategy: increase
commit-message:
prefix: "gems"
include: "scope"
labels:
- "gems"
- "dependencies"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
versioning-strategy: increase
commit-message:
prefix: "npm"
include: "scope"
labels:
- "npm"
- "dependencies"

# Check for updates to GitHub Actions every weekday
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "github-actions"
include: "scope"
labels:
- "github-actions"
- "dependencies"
19 changes: 19 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Docker

on: [push,pull_request]

jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
-
name: Docker Build
id: docker_build
uses: docker/build-push-action@v2
with:
push: false
tags: joel/weblog:latest
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
29 changes: 29 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

name: Ruby Linter

on: [push,pull_request]

jobs:
test:
name: Run Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.0
- name: Cache gems
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-linter-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-linter-
- name: Install gems
run: |
bundle config path vendor/bundle
bundle config set without 'default doc job cable storage ujs test db'
bundle install --jobs 4 --retry 3
- name: Run Linter
run: bundle exec standardrb
94 changes: 94 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Tests

on: [push,pull_request]

jobs:
# Label of the runner job
runner-job:
name: Run Test Suite
runs-on: ubuntu-latest

# Services
services:
db:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres

# Set health checks to wait until db has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432

steps:
- uses: actions/checkout@v2

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

- name: Cache gems
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-test-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-test-
- name: Install Ruby dependencies
run: |
sudo apt-get --assume-yes install libpq-dev
gem install bundler:2.2.11
bundle config path vendor/bundle
bundle config set without 'production'
bundle install --jobs 4 --retry 3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Js dependencies
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install NodeJs
uses: actions/setup-node@v1
with:
node-version: 15.5.1

- name: Cache Node Modules
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install Js dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile

- name: Create data store
env:
RAILS_ENV: test
DB_HOST: localhost
DB_PORT: 5432
run: |
bundle exec rails db:create
bundle exec rails db:migrate
- name: Run tests
run: bundle exec rails test:all
env:
DB_HOST: localhost
DB_PORT: 5432
2 changes: 1 addition & 1 deletion test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
require "test_helper"

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
end

0 comments on commit 9531fc9

Please sign in to comment.