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

Repo Refresh #29

Merged
merged 10 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ on:
- main
pull_request:

permissions:
contents: read

jobs:
# Detects changes to any of the source files for entitlements-app
changes:
runs-on: ubuntu-latest
permissions:
contents: read

outputs:
has_change: ${{ steps.diff.outputs.has_change}}

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

- id: fetch-base
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -56,9 +57,7 @@ jobs:
name: runner / acceptance-tests
strategy:
matrix:
ruby: [ '2.7.5', '3.1.2' ]
permissions:
contents: read
ruby: [ '2.7.5', '3.1.2', '3.2.2', '3.3.0' ]

steps:
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # [email protected]
Expand All @@ -74,7 +73,7 @@ jobs:

- name: checkout
if: ${{ needs.changes.outputs.has_change == 'true' }}
uses: actions/checkout@v3
uses: actions/checkout@v4

# Use Docker layer caching for 'docker build' and 'docker-compose build' commands.
# https://github.com/satackey/action-docker-layer-caching/releases/tag/v0.0.11
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ permissions:
jobs:
build:
name: build
runs-on: ubuntu-latest

strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

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

- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # [email protected]
with:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ on:
schedule:
- cron: '25 4 * * 5'

permissions:
actions: read
contents: read
security-events: write

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
Expand All @@ -25,7 +26,7 @@ jobs:

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ on:
- main
pull_request:

permissions:
contents: read

jobs:
rubocop:
name: runner / rubocop
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [ '2.7.5', '3.1.2' ]
permissions:
contents: read
ruby: [ '2.7.5', '3.1.2', '3.2.2', '3.3.0' ]

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

- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # [email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

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

- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # [email protected]
with:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ on:
- main
pull_request:

permissions:
contents: read

jobs:
rubocop:
name: runner / rspec
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [ '2.7.5', '3.1.2' ]
permissions:
contents: read
ruby: [ '2.7.5', '3.1.2', '3.2.2', '3.3.0' ]

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

- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # [email protected]
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ coverage/*

# Ignore JetBrains IDEs
.idea

tmp/
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inherit_gem:
AllCops:
SuggestExtensions: false
DisplayCopNames: true
TargetRubyVersion: 3.1.2
TargetRubyVersion: 3.3.0
Exclude:
- 'bin/*'
- 'vendor/**/*'
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.2
3.3.0
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ GEM
rubocop (>= 1.7.0, < 2.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rugged (0.27.5)
rugged (1.7.2)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
Expand Down Expand Up @@ -126,7 +126,7 @@ DEPENDENCIES
rubocop (= 1.29.1)
rubocop-github (= 0.17.0)
rubocop-performance (= 1.13.3)
rugged (= 0.27.5)
rugged (~> 1.7, >= 1.7.2)
simplecov (= 0.16.1)
simplecov-erb (= 1.0.1)
vcr (= 4.0.0)
Expand Down
4 changes: 2 additions & 2 deletions entitlements-app.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_relative "lib/version"

Gem::Specification.new do |s|
s.name = ENV["GEM_NAME"] ? ENV["GEM_NAME"] : "entitlements-app"
s.name = ENV["GEM_NAME"] || "entitlements-app"
s.version = Entitlements::Version::VERSION
s.summary = "git-managed LDAP group configurations"
s.description = "The Ruby Gem that Powers Entitlements - GitHub's Identity and Access Management System"
Expand All @@ -27,7 +27,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "rubocop", "= 1.29.1"
s.add_development_dependency "rubocop-github", "= 0.17.0"
s.add_development_dependency "rubocop-performance", "= 1.13.3"
s.add_development_dependency "rugged", "= 0.27.5"
s.add_development_dependency "rugged", "~> 1.7", ">= 1.7.2"
s.add_development_dependency "simplecov", "= 0.16.1"
s.add_development_dependency "simplecov-erb", "= 1.0.1"
s.add_development_dependency "vcr", "= 4.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion lib/contracts-ruby2/.github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion lib/contracts-ruby3/.github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
58 changes: 49 additions & 9 deletions script/bootstrap
Original file line number Diff line number Diff line change
@@ -1,14 +1,54 @@
#!/bin/bash
#! /usr/bin/env bash

set -e
# COLORS
OFF='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'

set -e # Prevent any kind of script failures

# if any of the following env vars are set, use them for the APP_ENV value
if [ -n "$APP_ENV" ]; then
export APP_ENV="$APP_ENV"
elif [ -n "$ENV" ]; then
export APP_ENV="$ENV"
elif [ -n "$ENVIRONMENT" ]; then
export APP_ENV="$ENVIRONMENT"
elif [ -n "$RAILS_ENV" ]; then
export APP_ENV="$RAILS_ENV"
elif [ -n "$RACK_ENV" ]; then
export APP_ENV="$RACK_ENV"
fi

# set the working directory to the root of the project
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
cd "$DIR"

export PATH=/usr/share/rbenv/shims:$PATH
export RBENV_VERSION="$(cat .ruby-version)"
rm -rf "${DIR}/.bundle"
# set the ruby version to the one specified in the .ruby-version file
[ -z "$RBENV_VERSION" ] && export RBENV_VERSION=$(cat "$DIR/.ruby-version")

# set the app environment to development if it's not set
[ -z "$APP_ENV" ] && export APP_ENV="development"

# set the path to include the rbenv shims if they exist
[ -d "/usr/share/rbenv/shims" ] && export PATH=/usr/share/rbenv/shims:$PATH

# Using Deprecated Flags to avoid pulling from upstream
bundle install --local
TRASHDIR=$(mktemp -d /tmp/bootstrap.XXXXXXXXXXXXXXXXX)
cleanup() {
rm -rf "$TRASHDIR"
# Remove empty directory
rmdir "$DIR/vendor/cache" 2>/dev/null || true
}
trap cleanup EXIT

bundle binstubs rake rspec-core rubocop
# Bootstrap gem dependencies.
if [ "$APP_ENV" == "production" ]; then
echo -e "💎 ${BLUE}Installing Gems for ${GREEN}production${BLUE}...${OFF}"
BUNDLE_WITHOUT=development bundle install --local
BUNDLE_WITHOUT=development bundle binstubs --all
else
echo -e "💎 ${BLUE}Installing Gems for ${PURPLE}development${BLUE}...${OFF}"
bundle install --local
bundle binstubs --all
fi
2 changes: 1 addition & 1 deletion spec/acceptance/Dockerfile.entitlements-app
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
pkg-config

# Install bundler
RUN gem install bundler
RUN gem install bundler -v 2.4.22

# Bootstrap files and caching for speed
COPY "vendor/cache/" "/data/entitlements-app/vendor/cache/"
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/Dockerfile.entitlements-app-ruby2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
ldap-utils

# Install bundler
RUN gem install bundler
RUN gem install bundler -v 2.4.22

# Bootstrap files and caching for speed
COPY "vendor/cache/" "/data/entitlements-app/vendor/cache/"
Expand Down
Binary file removed vendor/cache/rugged-0.27.5.gem
Binary file not shown.
Binary file added vendor/cache/rugged-1.7.2.gem
Binary file not shown.
Loading