Skip to content

Commit

Permalink
New test gem version 1.0.0 (#1)
Browse files Browse the repository at this point in the history
* New test gem version 0.1.0

* update files

* remove gitignore files

* adding prerelease

* sorry officer

* changing to omniauth 1.0

* updated lock file
  • Loading branch information
calvinc03-rewind authored Mar 19, 2024
1 parent cc4f3d5 commit e42093a
Show file tree
Hide file tree
Showing 25 changed files with 919 additions and 95 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @rewindio/integration-squad
93 changes: 0 additions & 93 deletions .github/workflows/code-scanning.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .github/workflows/pre-release-gem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: prerelease-gem

on:
issue_comment:
types: [created]

jobs:
prerelease:
uses: rewindio/github-action-common/.github/workflows/pre-release-gem.yml@v1
52 changes: 52 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Style Checks

on: pull_request

jobs:
changelog:
name: changelog
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Get version
id: get_version
run: |
version_file=$(find ./lib -name version.rb)
version=$(grep VERSION $version_file |cut -f 2 -d= |tr -d \'|tr -d [:space:])
echo version=$version >> $GITHUB_OUTPUT
echo version_tag=v$version >> $GITHUB_OUTPUT
- name: validate changelog exists
env:
GEM_VERSION: ${{steps.get_version.outputs.version}}
run: |
error_code=0
grep "\[${GEM_VERSION}\]" CHANGELOG.md || error_code=$?
if [ "${error_code}" -eq 1 ]; then
echo "No changelog entry found for version ${GEM_VERSION}"
exit 1
fi
rubocop:
name: runner / rubocop
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2

- name: rubocop
uses: reviewdog/action-rubocop@e70b014b8062c447d6b515ee0209f834ea93e696 #v2.5.0
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-performance:gemfile rubocop-rspec:gemfile
github_token: ${{ secrets.github_token }}
filter_mode: file
fail_on_error: true
71 changes: 71 additions & 0 deletions .github/workflows/tag-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: tag-and-release

on:
push:
branches:
- main
paths: 'lib/**/version.rb'

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@main

- name: Set up Ruby 3.2.2
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2

- name: Get version
id: get_version
run: |
version_file=$(find ./lib -name version.rb)
version=$(grep VERSION $version_file |cut -f 2 -d= |tr -d \'|tr -d [:space:])
echo version=$version >> $GITHUB_OUTPUT
echo version_tag=v$version >> $GITHUB_OUTPUT
- name: Tag commit
uses: tvdias/github-tagger@ed7350546e3e503b5e942dffd65bc8751a95e49d # v0.0.2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
tag: "${{steps.get_version.outputs.version_tag}}"

- name: Upload to Rubygems
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: |
set +e
mkdir -p ~/.gem
touch ~/.gem/credentials
chmod 600 ~/.gem/credentials
echo ":rubygems_api_key: ${RUBYGEMS_API_KEY}" >> ~/.gem/credentials
gemspec=$(ls *gemspec* | head -1)
gem build $gemspec
gem_name=$(ls -t *.gem | head -1)
output=$(gem push *.gem)
if [[ $output != *"Successfully"* ]]; then
echo "Error uploading to Rubygems: $output"
rm -f ~/.gem/credentials
exit 1
else
echo "Successfully uploaded to Rubygems: $output"
rm -f ~/.gem/credentials
fi
- name: Extract from changelog
id: extract_changes
run: |
# Must use a temporary file or it loses the formatting
VERSION=${{steps.get_version.outputs.version}}; awk "/## \[$VERSION\]/{flag=1;next}/## \[/{flag=0}flag" CHANGELOG.md > REL-BODY.md
- name: Create Release
uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1.13.0
with:
tag: ${{steps.get_version.outputs.version_tag}}
artifacts: "*.gem, CHANGELOG.md"
bodyFile: "REL-BODY.md"
token: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Tests

on: pull_request

jobs:
rspec:
name: rspec tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true

- name: Run rspec tests
run: |
bundle exec rspec
- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: coverage-results
path: coverage
retention-days: 5

coverage:
needs: rspec
runs-on: ubuntu-latest
steps:
- name: Download coverage results
uses: actions/download-artifact@v3
with:
name: coverage-results
path: coverage

- name: Simplecov Report
uses: aki77/simplecov-report-action@7fd5fa551dd583dd437a11c640b2a1cf23d6cdaa # v1.5.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
failedThreshold: 100
resultPath: coverage/.last_run.json
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
*.gem
*.rbc
.bundle
.config
.yardoc
.DS_Store
**/.DS_Store
InstalledFiles
_yardoc
coverage/
doc/
lib/bundler/man
pkg
vendor/
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
.idea/
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
Loading

0 comments on commit e42093a

Please sign in to comment.