Skip to content

Commit 96c2abc

Browse files
authored
Merge pull request #59 from ruby-openid/next
Improve CI Setup
2 parents f44c3a9 + 1487b1a commit 96c2abc

File tree

253 files changed

+88036
-561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+88036
-561
lines changed

.envrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@ PATH_add bin
1515
# export RUBYOPT="-W0"
1616

1717
### External Testing Controls
18+
export COVERAGE=true
1819
export K_SOUP_COV_DO=true # Means you want code coverage
1920
# Available formats are html, xml, rcov, lcov, json, tty
2021
export K_SOUP_COV_COMMAND_NAME="MiniTest Coverage"
2122
export K_SOUP_COV_FORMATTERS="html,tty"
22-
export K_SOUP_COV_MIN_BRANCH=86 # Means you want to enforce X% branch coverage
23+
export K_SOUP_COV_MIN_BRANCH=85 # Means you want to enforce X% branch coverage
2324
export K_SOUP_COV_MIN_LINE=91 # Means you want to enforce X% line coverage
2425
export K_SOUP_COV_MIN_HARD=true # Means you want the build to fail if the coverage thresholds are not met
2526
export K_SOUP_COV_MULTI_FORMATTERS=true
2627
export MAX_ROWS=1 # Setting for simplecov-console gem for tty output, limits to the worst N rows of bad coverage
2728

2829
# Internal Debugging Controls
29-
export DEBUG=false # do not allow byebug statements (override in .env.local)
30+
export DEBUG=false # do not allow debug statements (override in .env.local)
3031

3132
# .env would override anything in this file, if `dotenv` is uncommented below.
3233
# .env is a DOCKER standard, and if we use it, it would be in deployed, or DOCKER, environments,

.github/workflows/codeql-analysis.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main, "*-stable" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main, "*-stable" ]
20+
schedule:
21+
- cron: '35 1 * * 5'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'ruby' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v3
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v3
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 https://git.io/JvXDl
60+
61+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62+
# and modify them (or add more) to build your code if your project
63+
# uses a compiled language
64+
65+
#- run: |
66+
# make bootstrap
67+
# make release
68+
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@v3

.github/workflows/coverage.yml

Lines changed: 68 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,57 @@
1-
name: Ruby - Coverage
1+
name: Test Coverage
2+
3+
permissions:
4+
contents: read
5+
pull-requests: write
6+
id-token: write
27

38
env:
4-
K_SOUP_COV_MIN_BRANCH: 86
9+
K_SOUP_COV_MIN_BRANCH: 85
510
K_SOUP_COV_MIN_LINE: 91
611
K_SOUP_COV_MIN_HARD: true
12+
K_SOUP_COV_FORMATTERS: "html,xml,rcov,lcov,json,tty"
713
K_SOUP_COV_DO: true
8-
K_SOUP_COV_COMMAND_NAME: "MiniTest Coverage"
14+
K_SOUP_COV_MULTI_FORMATTERS: true
15+
K_SOUP_COV_COMMAND_NAME: "Test Coverage"
916

1017
on:
1118
push:
1219
branches:
13-
- 'main'
20+
- "main"
21+
- "*-stable"
1422
tags:
15-
- '!*' # Do not execute on tags
23+
- "!*" # Do not execute on tags
1624
pull_request:
1725
branches:
18-
- '*'
26+
- "*"
1927
# Allow manually triggering the workflow.
2028
workflow_dispatch:
2129

22-
permissions:
23-
contents: read
24-
2530
# Cancels all previous workflow runs for the same branch that have not yet completed.
2631
concurrency:
2732
# The concurrency group contains the workflow name and the branch name.
2833
group: "${{ github.workflow }}-${{ github.ref }}"
2934
cancel-in-progress: true
3035

3136
jobs:
32-
test:
33-
name: Specs with Coverage - Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
34-
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
35-
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
36-
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
37+
coverage:
38+
name: Code Coverage on ${{ matrix.ruby }}@current
39+
if: ${{ !contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]') }}
3740
runs-on: ubuntu-latest
41+
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
42+
env: # $BUNDLE_GEMFILE - set at job level, so applies to all steps
43+
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}.gemfile
3844
strategy:
45+
fail-fast: false
3946
matrix:
40-
rubygems:
41-
- latest
42-
bundler:
43-
- latest
44-
gemfile:
45-
- coverage
46-
ruby:
47-
- '3.1'
47+
include:
48+
# Coverage
49+
- ruby: "ruby"
50+
appraisal_name: "coverage"
51+
exec_cmd: "rake test"
52+
gemfile: "Appraisal.root"
53+
rubygems: latest
54+
bundler: latest
4855

4956
steps:
5057
- name: Checkout
@@ -56,14 +63,47 @@ jobs:
5663
ruby-version: "${{ matrix.ruby }}"
5764
rubygems: "${{ matrix.rubygems }}"
5865
bundler: "${{ matrix.bundler }}"
59-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
66+
bundler-cache: true
67+
68+
# Raw `bundle` will use the BUNDLE_GEMFILE set to matrix.gemfile (i.e. Appraisal.root)
69+
# We need to do this first to get appraisal installed.
70+
# NOTE: This does not use the primary Gemfile at all.
71+
- name: Install Root Appraisal
72+
run: bundle
73+
- name: Appraisal for ${{ matrix.ruby }}@${{ matrix.appraisal_name }}
74+
run: bundle exec appraisal ${{ matrix.appraisal_name }} bundle
75+
- name: Run ${{ matrix.exec_cmd }} on ${{ matrix.ruby }}@${{ matrix.appraisal_name }}
76+
run: bundle exec appraisal ${{ matrix.appraisal_name }} bundle exec ${{ matrix.exec_cmd }}
6077

61-
- name: Run tests
62-
run: bundle exec rake test
78+
# Do SaaS coverage uploads first
79+
- name: Upload coverage to Coveralls
80+
if: ${{ !env.ACT }}
81+
uses: coverallsapp/github-action@master
82+
with:
83+
github-token: ${{ secrets.GITHUB_TOKEN }}
84+
continue-on-error: ${{ matrix.experimental != 'false' }}
85+
86+
- name: Upload coverage to QLTY
87+
if: ${{ !env.ACT }}
88+
uses: qltysh/qlty-action/coverage@main
89+
with:
90+
token: ${{secrets.QLTY_COVERAGE_TOKEN}}
91+
files: coverage/.resultset.json
92+
continue-on-error: ${{ matrix.experimental != 'false' }}
93+
94+
# Build will fail here if coverage upload fails
95+
# which will hopefully be noticed for the lack of code coverage comments
96+
- name: Upload coverage to CodeCov
97+
uses: codecov/codecov-action@v5
98+
with:
99+
use_oidc: true
100+
fail_ci_if_error: true # optional (default = false)
101+
verbose: true # optional (default = false)
63102

103+
# Then PR comments
64104
- name: Code Coverage Summary Report
105+
if: ${{ !env.ACT && github.event_name == 'pull_request' }}
65106
uses: irongut/[email protected]
66-
if: ${{ github.event_name == 'pull_request' }}
67107
with:
68108
filename: ./coverage/coverage.xml
69109
badge: true
@@ -73,12 +113,12 @@ jobs:
73113
hide_complexity: true
74114
indicators: true
75115
output: both
76-
thresholds: '91 86'
116+
thresholds: '91 85'
77117
continue-on-error: ${{ matrix.experimental != 'false' }}
78118

79119
- name: Add Coverage PR Comment
80120
uses: marocchino/sticky-pull-request-comment@v2
81-
if: ${{ github.event_name == 'pull_request' }}
121+
if: ${{ !env.ACT && github.event_name == 'pull_request' }}
82122
with:
83123
recreate: true
84124
path: code-coverage-results.md
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Targets the evergreen latest release of ruby, truffleruby, and jruby
2+
# and tests against the HEAD of runtime dependencies
3+
name: Runtime Deps @ HEAD
4+
5+
permissions:
6+
contents: read
7+
8+
env:
9+
K_SOUP_COV_DO: false
10+
11+
on:
12+
push:
13+
branches:
14+
- 'main'
15+
- '*-stable'
16+
tags:
17+
- '!*' # Do not execute on tags
18+
pull_request:
19+
branches:
20+
- '*'
21+
# Allow manually triggering the workflow.
22+
workflow_dispatch:
23+
24+
# Cancels all previous workflow runs for the same branch that have not yet completed.
25+
concurrency:
26+
# The concurrency group contains the workflow name and the branch name.
27+
group: "${{ github.workflow }}-${{ github.ref }}"
28+
cancel-in-progress: true
29+
30+
jobs:
31+
test:
32+
name: Tests ${{ matrix.ruby }}@${{ matrix.appraisal_name }}
33+
if: ${{ !contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]') }}
34+
runs-on: ubuntu-latest
35+
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
36+
env: # $BUNDLE_GEMFILE - set at job level, so applies to all steps
37+
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}.gemfile
38+
strategy:
39+
matrix:
40+
include:
41+
# Ruby 3.4
42+
- ruby: "ruby"
43+
appraisal_name: "dep-heads"
44+
exec_cmd: "rake test"
45+
gemfile: "Appraisal.root"
46+
rubygems: latest
47+
bundler: latest
48+
49+
# truffleruby-24.1
50+
- ruby: "truffleruby"
51+
appraisal_name: "dep-heads"
52+
exec_cmd: "rake test"
53+
gemfile: "Appraisal.root"
54+
rubygems: default
55+
bundler: default
56+
57+
# jruby-10.0 (targets Ruby 3.4 compatibility)
58+
- ruby: "jruby"
59+
appraisal_name: "dep-heads"
60+
exec_cmd: "rake test"
61+
gemfile: "Appraisal.root"
62+
experimental: true
63+
rubygems: default
64+
bundler: default
65+
66+
steps:
67+
- name: Checkout
68+
if: ${{ !env.ACT || !startsWith(matrix.ruby, 'jruby') }}
69+
uses: actions/checkout@v4
70+
71+
- name: Setup Ruby & RubyGems
72+
if: ${{ !env.ACT || !startsWith(matrix.ruby, 'jruby') }}
73+
uses: ruby/setup-ruby@v1
74+
with:
75+
ruby-version: ${{ matrix.ruby }}
76+
rubygems: ${{ matrix.rubygems }}
77+
bundler: ${{ matrix.bundler }}
78+
bundler-cache: false
79+
80+
# Raw `bundle` will use the BUNDLE_GEMFILE set to matrix.gemfile (i.e. Appraisal.root)
81+
# We need to do this first to get appraisal installed.
82+
# NOTE: This does not use the primary Gemfile at all.
83+
- name: Install Root Appraisal
84+
if: ${{ !env.ACT || !startsWith(matrix.ruby, 'jruby') }}
85+
run: bundle
86+
- name: Appraisal for ${{ matrix.ruby }}@${{ matrix.appraisal_name }}
87+
if: ${{ !env.ACT || !startsWith(matrix.ruby, 'jruby') }}
88+
run: bundle exec appraisal ${{ matrix.appraisal_name }} bundle
89+
- name: Run ${{ matrix.exec_cmd }} on ${{ matrix.ruby }}@${{ matrix.appraisal_name }}
90+
if: ${{ !env.ACT || !startsWith(matrix.ruby, 'jruby') }}
91+
run: bundle exec appraisal ${{ matrix.appraisal_name }} bundle exec ${{ matrix.exec_cmd }}

0 commit comments

Comments
 (0)