-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CI to work outside of
github.com/bellroy
- Loading branch information
1 parent
5365df6
commit b6eb3b2
Showing
10 changed files
with
81 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,24 @@ | ||
--- | ||
name: Continuous Integration | ||
env: | ||
SLACK_CHANNEL_ID: C0317P7C9C2 | ||
on: | ||
push: | ||
branches-ignore: | ||
- refs/tags/*_staging | ||
- refs/tags/*_production | ||
|
||
on: push | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
ruby-version: ['3.1'] | ||
steps: | ||
- name: Checkout branch | ||
# Pin to v3.1.0 SHA | ||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 | ||
- name: Extract branch name | ||
shell: bash | ||
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | ||
id: extract_branch | ||
- name: Cache gems | ||
# Pin to 3.0.11 SHA | ||
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 | ||
with: | ||
path: vendor/bundle | ||
key: "${{ runner.OS }}-gem-cache-${{ hashFiles('**/*.gemspec') | ||
}}" | ||
restore-keys: "${{ runner.OS }}-gem-cache-\n" | ||
# Pin to the v18 SHA | ||
- uses: "cachix/install-nix-action@daddc62a2e67d1decb56e028c9fa68344b9b7c2a" | ||
with: | ||
extra_nix_config: | | ||
post-build-hook = /etc/nix/upload-to-cache.sh | ||
substituters = https://cache.nixos.org/ | ||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | ||
nix_path: nixpkgs=channel:nixos-22.05 | ||
install_url: https://releases.nixos.org/nix/nix-2.7.0/install | ||
- name: Run CI through nix-shell | ||
env: | ||
GEMFURY_DEPLOY_TOKEN: ${{ secrets.GEMFURY_DEPLOY_TOKEN }} | ||
run: nix-shell --run "chmod 755 ./run_ci.sh && ./run_ci.sh" | ||
- name: Post to Slack if build fails | ||
if: failure() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stable') | ||
# Pin to the v1.23.0 SHA | ||
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 | ||
env: | ||
SLACK_BOT_TOKEN: "${{ secrets.BELLROY_SLACK_TOKEN }}" | ||
with: | ||
channel-id: "${{ env.SLACK_CHANNEL_ID }}" | ||
payload: | | ||
{ | ||
"text": "* ${{ github.repository }} BUILD FAILURE*", | ||
"attachments": [ | ||
{ | ||
"fallback": "Failure summary", | ||
"color": "ff0000", | ||
"fields": [ | ||
{ | ||
"title": "Branch", | ||
"value": "${{ steps.extract_branch.outputs.branch}}" | ||
}, | ||
{ | ||
"title": "Who broke it", | ||
"value": "${{ github.actor }}" | ||
}, | ||
{ | ||
"title": "Build output", | ||
"value": "https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks", | ||
"short": false | ||
} | ||
] | ||
} | ||
] | ||
} | ||
- uses: actions/checkout@v3 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true | ||
- name: Run RSpec tests | ||
run: bin/rspec | ||
- name: Check for Rubocop offenses | ||
run: bin/rubocop --format github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +0,0 @@ | ||
--- | ||
Documentation: | ||
Enabled: false | ||
Rails: | ||
Enabled: true | ||
AllCops: | ||
Include: | ||
- app/**/*.rb | ||
- lib/**/*.rb | ||
- spec/**/*.rb | ||
Exclude: | ||
- app/assets/**/* | ||
- bin/**/* | ||
- client/node_modules/**/* | ||
- config/**/* | ||
- coverage/**/* | ||
- data/**/* | ||
- db/**/* | ||
- db_*/**/* | ||
- dw/**/* | ||
- log/**/* | ||
- phrase/**/* | ||
- public/**/* | ||
- tmp/**/* | ||
- vendor/**/* | ||
TargetRubyVersion: 2.5 | ||
Metrics/LineLength: | ||
Max: 100 | ||
Layout/MultilineMethodCallIndentation: | ||
EnforcedStyle: indented | ||
Style/PercentLiteralDelimiters: | ||
PreferredDelimiters: | ||
"%w": "[]" | ||
RSpec/ExampleLength: | ||
Enabled: false | ||
Max: 10 | ||
RSpec/MultipleExpectations: | ||
Enabled: false | ||
Max: 10 | ||
RSpec/NestedGroups: | ||
Enabled: false | ||
Max: 10 | ||
RSpec/MessageExpectation: | ||
Enabled: false | ||
RSpec/MissingExampleGroupArgument: | ||
Enabled: false | ||
require: | ||
- rubocop-performance | ||
- rubocop-rspec | ||
- test_prof/rubocop | ||
Metrics/BlockLength: | ||
Enabled: false | ||
RSpec/MessageSpies: | ||
Enabled: false | ||
RSpec/ExpectInHook: | ||
Enabled: false | ||
RSpec/AggregateFailures: | ||
Enabled: true | ||
Include: | ||
- spec/**/*.rb | ||
Rails/InverseOf: | ||
Enabled: false | ||
Rails/Present: | ||
Enabled: false | ||
Rails/TimeZone: | ||
Enabled: false | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,5 @@ end | |
|
||
group :test do | ||
gem 'ffaker' | ||
gem 'simplecov' | ||
gem 'rspec-github', require: false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
# | ||
# This file was generated by Bundler. | ||
# | ||
# The application 'rspec' is installed as part of a gem, and | ||
# this file is here to facilitate running it. | ||
# | ||
|
||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) | ||
|
||
bundle_binstub = File.expand_path("bundle", __dir__) | ||
|
||
if File.file?(bundle_binstub) | ||
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ | ||
load(bundle_binstub) | ||
else | ||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. | ||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") | ||
end | ||
end | ||
|
||
require "rubygems" | ||
require "bundler/setup" | ||
|
||
load Gem.bin_path("rspec-core", "rspec") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
# | ||
# This file was generated by Bundler. | ||
# | ||
# The application 'rubocop' is installed as part of a gem, and | ||
# this file is here to facilitate running it. | ||
# | ||
|
||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) | ||
|
||
bundle_binstub = File.expand_path("bundle", __dir__) | ||
|
||
if File.file?(bundle_binstub) | ||
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ | ||
load(bundle_binstub) | ||
else | ||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. | ||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") | ||
end | ||
end | ||
|
||
require "rubygems" | ||
require "bundler/setup" | ||
|
||
load Gem.bin_path("rubocop", "rubocop") |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.