This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
[Snyk] Security upgrade railties from 7.0.3.1 to 7.1.0 #88
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
name: CI Ruby | |
on: | |
push: | |
branches: [ 'main', 'develop' ] | |
pull_request: | |
branches: [ 'main', 'develop' ] | |
permissions: | |
actions: read | |
checks: write | |
contents: read | |
pull-requests: write | |
statuses: read | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
CI: true | |
strategy: | |
matrix: | |
ruby-version: ['2.7', '3.0', '3.1'] | |
include: | |
- ruby-version: '3.1' | |
coverage: true | |
steps: | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Your Name" | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Ruby and gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby-version }} | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Run the setup script | |
run: ./bin/setup | |
- name: Run unit tests | |
env: | |
COVERAGE: ${{ matrix.coverage }} | |
run: bundle exec rake test:unit | |
- name: Run integration tests | |
run: bundle exec rake test:integration | |
- name: Code Coverage report | |
if: ${{ matrix.coverage }} | |
uses: 5monkeys/cobertura-action@master | |
with: | |
path: coverage/coverage.xml | |
minimum_coverage: 85 | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
fail_below_threshold: true | |
show_missing: true | |
link_missing_lines: true | |
- name: Prepare data for a Code Coverage badge | |
if: ${{ matrix.coverage }} | |
run: | | |
echo "COVERAGE=$(./bin/code_coverage)" >> $GITHUB_ENV | |
REF=${{ github.ref }} | |
echo "github.ref: $REF" | |
IFS='/' read -ra PATHS <<< "$REF" | |
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}" | |
echo $BRANCH_NAME | |
echo "BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV | |
- name: Create the Coverage Badge | |
if: ${{ matrix.coverage }} | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 6a095c79278b074d79feaa4f8ceeb2a8 | |
filename: amber_component__${{ env.BRANCH }}.json | |
style: flat | |
label: Code Coverage | |
message: ${{ env.COVERAGE }}% | |
logoColor: EB222F | |
namedLogo: ruby | |
valColorRange: ${{ env.COVERAGE }} | |
maxColorRange: 100 | |
minColorRange: 0 | |
- name: Archive code coverage artifacts | |
if: ${{ matrix.coverage }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code_coverage | |
path: coverage | |
lint: | |
runs-on: ubuntu-latest | |
env: | |
CI: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Ruby and gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Run the setup script | |
run: ./bin/setup | |
# Add or replace any other lints here | |
- name: Security audit dependencies | |
run: bundle exec bundle audit --update | |
- name: Lint Ruby files | |
run: bundle exec rubocop --parallel |