Skip to content

Commit

Permalink
using shared ci/cd config
Browse files Browse the repository at this point in the history
  • Loading branch information
perryqh committed Apr 24, 2024
1 parent 7555443 commit 4354f79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 85 deletions.
22 changes: 4 additions & 18 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,8 @@ on:
workflows: [CI]
types: [completed]
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'schedule' }}
steps:
- uses: actions/checkout@v3
- name: Tag and Push Gem
id: tag-and-push-gem
uses: discourse/publish-rubygems-action@v3
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GIT_EMAIL: ${{secrets.GUSTO_GIT_EMAIL}}
GIT_NAME: ${{secrets.GUSTO_GIT_NAME}}
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
- name: Create GitHub Release
run: gh release create v${{steps.tag-and-push-gem.outputs.gem_version}} --generate-notes
if: ${{ steps.tag-and-push-gem.outputs.new_version == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
call-workflow-from-shared-config:
uses: rubyatscale/shared-config/.github/workflows/cd.yml@main
secrets: inherit
70 changes: 3 additions & 67 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,7 @@
name: CI

on:
push:
branches:
- main
pull_request:
schedule:
- cron: "0 0 * * *"
on: [push, pull_request]

jobs:
minitest:
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
# See comment comes from https://github.com/ruby/setup-ruby#matrix-of-ruby-versions
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
- "3.0"
- 3.1
- 3.2
env:
BUNDLE_GEMFILE: Gemfile
name: "Minitest tests: Ruby ${{ matrix.ruby }}"
steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby }}
- name: Run tests
run: bundle exec rake
static_type_check:
name: "Type Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 3.1
- name: Run static type checks
run: bundle exec srb tc
rubocop:
runs-on: ubuntu-latest
name: Rubocop
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 3.1
- name: Run style checks
run: bundle exec rubocop
notify_on_failure:
runs-on: ubuntu-latest
needs: [minitest, static_type_check, rubocop]
if: ${{ failure() && github.ref == 'refs/heads/main' }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
steps:
- uses: slackapi/[email protected]
with:
payload: |
{
"text": "${{ github.repository }}/${{ github.ref }}: FAILED\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
call-workflow-from-shared-config:
uses: rubyatscale/shared-config/.github/workflows/ci.yml@main

0 comments on commit 4354f79

Please sign in to comment.