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

CI fixes #19

Closed
wants to merge 12 commits into from
Closed
60 changes: 29 additions & 31 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ "development" ]
branches: ["development"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "development" ]
branches: ["development"]
schedule:
- cron: '45 20 * * 3'
- cron: "45 20 * * 3"

jobs:
analyze:
Expand All @@ -32,42 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'ruby' ]
language: ["ruby"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
32 changes: 16 additions & 16 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: create-doubtfire-deployment
on:
push:
tags:
- 'v*'
- "v*"
# branches:
# - '*.x'
# - 'development'
Expand All @@ -16,25 +16,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup meta for development image
id: docker_meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: lmsdoubtfire/doubtfire-api
tags: |
type=semver,pattern={{major}}.{{minor}}.x-dev
- name: Build and push api server
id: docker_build
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand All @@ -48,18 +48,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v5
- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup meta for api server
id: docker_meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: lmsdoubtfire/apiServer
tags: |
Expand All @@ -70,7 +70,7 @@ jobs:
type=semver,pattern=prod-{{major}}
- name: Build and push api server
id: docker_build
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
file: deployApi.Dockerfile
context: .
Expand All @@ -85,18 +85,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup meta for app server
id: docker_meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: lmsdoubtfire/appServer
tags: |
Expand All @@ -107,7 +107,7 @@ jobs:
type=semver,pattern=prod-{{major}}
- name: Build and push app server
id: docker_build
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
file: deployAppSvr.Dockerfile
context: .
Expand Down
27 changes: 23 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: Unit Tests
on: [push, pull_request]
on:
push:
paths-ignore:
- "*.md"
- "docs/**"
pull_request:
paths-ignore:
- "*.md"
- "docs/**"

env:
RAILS_ENV: "test"
Expand All @@ -18,6 +26,7 @@ env:
DF_ENCRYPTION_PRIMARY_KEY: "AMLOMYA5GV8B4fTK3VKMhVGn8WdvUW8g"
DF_ENCRYPTION_DETERMINISTIC_KEY: "anlmuJ6cB3bN3biXRbYvmPsC5ALPFqGG"
DF_ENCRYPTION_KEY_DERIVATION_SALT: "hzPR8D4qpOnAg7VeAhkhWw6JmmzKJB10"
DF_REDIS_SIDEKIQ_URL: "redis://redis:6379/0"

jobs:
unit-tests:
Expand All @@ -31,16 +40,24 @@ jobs:
MARIADB_DATABASE: ${{ env.DF_TEST_DB_DATABASE }}
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: yes # This is required or the healthcheck script can't connect to the db
options: --health-cmd "/usr/local/bin/healthcheck.sh --connect --innodb_initialized" --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:7.0
options: --health-cmd "redis-cli ping | grep PONG" --health-interval 1s --health-timeout 5s --health-retries 5

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up docker buildx
uses: docker/setup-buildx-action@v3
- name: Build base doubtfire-api development image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: doubtfire-api-development:local
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Populate database
uses: addnab/docker-run-action@v3
with:
Expand All @@ -63,8 +80,9 @@ jobs:
-e DF_ENCRYPTION_PRIMARY_KEY
-e DF_ENCRYPTION_DETERMINISTIC_KEY
-e DF_ENCRYPTION_KEY_DERIVATION_SALT
-e DF_REDIS_SIDEKIQ_URL
run: bundle exec rake db:populate
- name: Run rake tests
- name: Run unit tests
uses: addnab/docker-run-action@v3
with:
image: doubtfire-api-development:local
Expand All @@ -86,4 +104,5 @@ jobs:
-e DF_ENCRYPTION_PRIMARY_KEY
-e DF_ENCRYPTION_DETERMINISTIC_KEY
-e DF_ENCRYPTION_KEY_DERIVATION_SALT
-e DF_REDIS_SIDEKIQ_URL
run: TERM=xterm bundle exec rails test
26 changes: 17 additions & 9 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: RuboCop

on: [push, pull_request]
on:
push:
paths-ignore:
- "*.md"
- "docs/**"
pull_request:
paths-ignore:
- "*.md"
- "docs/**"

permissions:
contents: read
Expand All @@ -12,13 +20,13 @@ jobs:
BUNDLE_WITHOUT: default doc job cable storage ujs test db

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

- name: Set up Ruby 3.1
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- name: Set up Ruby 3.1
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true

- name: Run RuboCop
run: bundle exec rubocop --parallel
- name: Run RuboCop
run: bundle exec rubocop --parallel
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ group :development, :test do
gem 'rubocop'
gem 'rubocop-faker'
gem 'rubocop-rails'
gem 'ruby-lsp'
gem 'simplecov', require: false
gem 'solargraph'
gem 'sprockets-rails'
Expand Down
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ GEM
ast (~> 2.4.1)
racc
pkg-config (1.5.6)
prism (0.24.0)
psych (5.1.2)
stringio
public_suffix (5.0.4)
Expand Down Expand Up @@ -388,6 +389,10 @@ GEM
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-filemagic (0.7.3)
ruby-lsp (0.14.6)
language_server-protocol (~> 3.17.0)
prism (>= 0.22.0, < 0.25)
sorbet-runtime (>= 0.5.10782)
ruby-ole (1.2.12.2)
ruby-progressbar (1.13.0)
ruby-saml (1.13.0)
Expand Down Expand Up @@ -428,6 +433,7 @@ GEM
thor (~> 1.0)
tilt (~> 2.0)
yard (~> 0.9, >= 0.9.24)
sorbet-runtime (0.5.11307)
sorted_set (1.0.3)
rbtree
set (~> 1.0)
Expand Down Expand Up @@ -512,6 +518,7 @@ DEPENDENCIES
rubocop-faker
rubocop-rails
ruby-filemagic
ruby-lsp
ruby-saml (~> 1.13.0)
rubyzip
sidekiq
Expand Down
Loading