Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No build is faster than any build #1086

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.

# Ignore git directory.
/.git/

# Ignore bundler config.
/.bundle

# Ignore all environment files (except templates).
/.env*
!/.env*.erb

# Ignore all default key files.
/config/master.key
/config/credentials/*.key

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/.keep

# Ignore assets.
/node_modules/
/app/assets/builds/*
!/app/assets/builds/.keep
/public/assets
67 changes: 0 additions & 67 deletions .github/workflows/backend.yml

This file was deleted.

102 changes: 102 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build

on:
- push
- pull_request

jobs:
docker:
name: 'Docker: Build'
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build test image
uses: docker/build-push-action@v5
with:
push: true
context: .
target: test
tags: "gmmcal/gmmcal:test"
cache-from: type=gha
cache-to: type=gha,mode=max

rubocop:
name: 'Lint: Rubocop'
runs-on: ubuntu-20.04
needs: docker

if: github.event_name == 'pull_request'

steps:
- name: Run rubocop
run: |
docker run --rm gmmcal/gmmcal:test bundle exec rubocop --config .rubocop.yml .

reek:
name: 'Lint: Reek'
runs-on: ubuntu-20.04
needs: docker

if: github.event_name == 'pull_request'

steps:
- name: Run reek
run: |
docker run --rm gmmcal/gmmcal:test bundle exec reek --config .reek.yml .

brakeman:
name: 'Lint: Brakeman'
runs-on: ubuntu-20.04
needs: docker

if: github.event_name == 'pull_request'

steps:
- name: Run brakeman
run: |
docker run --rm gmmcal/gmmcal:test bundle exec brakeman

scsslint:
name: 'Lint: SCSSLint'
runs-on: ubuntu-20.04
needs: docker

if: github.event_name == 'pull_request'

steps:
- name: Run SCSSLint
run: |
docker run --rm gmmcal/gmmcal:test bundle exec scss-lint --config .scss-lint.yml

tests:
name: 'Unit: Backend'
runs-on: ubuntu-20.04
needs: docker

services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: gmmcalcombr_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Run rubocop
run: |
docker run --network=${{ job.services.postgres.network }} -e DATABASE_URL='postgres://postgres:postgres@postgres:5432/gmmcalcombr_test' -e DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true --rm gmmcal/gmmcal:test
102 changes: 1 addition & 101 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,6 @@ on:
- pull_request

jobs:
rubocop:
name: 'Lint: Rubocop'
runs-on: ubuntu-20.04

container:
image: ruby:3.2.2

steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-gmmcal-${{ hashFiles('/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-gmmcal-

- name: Run bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3

- name: Run rubocop
run: bundle exec rubocop --config .rubocop.yml .

reek:
name: 'Lint: Reek'
runs-on: ubuntu-20.04

container:
image: ruby:3.2.2

steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-gmmcal-${{ hashFiles('/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-gmmcal-

- name: Run bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3

- name: Run reek
run: bundle exec reek --config .reek.yml .

brakeman:
name: 'Lint: Brakeman'
runs-on: ubuntu-20.04

container:
image: ruby:3.2.2

steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-gmmcal-${{ hashFiles('/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-gmmcal-

- name: Run bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3

- name: Run brakeman
run: bundle exec brakeman

bundler-audit:
name: 'Lint: Bundler Audit'
runs-on: ubuntu-20.04
Expand All @@ -98,31 +23,6 @@ jobs:
- name: Run bundler-audit
run: bundler-audit

scsslint:
name: 'Lint: SCSSLint'
runs-on: ubuntu-20.04

container:
image: ruby:3.2.2

steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-gmmcal-${{ hashFiles('/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-gmmcal-

- name: Run bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3

- name: Run SCSSLint
run: bundle exec scss-lint --config .scss-lint.yml

eslint:
name: 'Lint: ESLint'
runs-on: ubuntu-20.04
Expand All @@ -131,7 +31,7 @@ jobs:
image: node:18

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
*.rbc
capybara-*.html
/log
/tmp
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
/db/*.sqlite3
/public/system
/public/assets
/public/uploads
/coverage/
!/coverage/.keep
/spec/tmp
/spec/backend/examples.txt
/spec/end-to-end/screenshots
Expand Down
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require:
- rubocop-rails
- rubocop-rspec
- rubocop-factory_bot

AllCops:
TargetRubyVersion: 3.0
Expand Down
11 changes: 5 additions & 6 deletions .scss-lint.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Default application configuration that all configurations inherit from.

scss_files: "app/**/*.scss"
scss_files: "scss/**/*.scss"
plugin_directories: ['.scss-linters']

exclude:
- 'app/assets/stylesheets/admin/mdb/**'
- 'app/javascript/stylesheets/components/skill.scss'
- 'app/assets/stylesheets/cv/_functions.scss'
- 'app/assets/stylesheets/cv/application.sass.scss'
- 'app/assets/stylesheets/frontend/components/skill.scss'
- 'scss/admin/mdb/**'
- 'scss/cv/_functions.scss'
- 'scss/cv/application.sass.scss'
- 'scss/frontend/components/skill.scss'

# List of gem names to load custom linters from (make sure they are already
# installed)
Expand Down
Loading