Skip to content

Commit

Permalink
Merge pull request #435 from ublefo/7.0.x
Browse files Browse the repository at this point in the history
Backport CI improvements to v7.0.x
  • Loading branch information
macite authored Apr 11, 2024
2 parents 65e78b2 + 4ae1ce2 commit 06a8917
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 60 deletions.
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
20 changes: 16 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 Down Expand Up @@ -33,14 +41,18 @@ jobs:
options: --health-cmd "/usr/local/bin/healthcheck.sh --connect --innodb_initialized" --health-interval 10s --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 @@ -64,7 +76,7 @@ jobs:
-e DF_ENCRYPTION_DETERMINISTIC_KEY
-e DF_ENCRYPTION_KEY_DERIVATION_SALT
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 Down
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
9 changes: 9 additions & 0 deletions dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Set update schedule for GitHub Actions

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"

0 comments on commit 06a8917

Please sign in to comment.