Skip to content

Commit

Permalink
ci: Replace releaser with release please (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 authored Dec 1, 2023
1 parent 375da8f commit 432c53d
Show file tree
Hide file tree
Showing 16 changed files with 292 additions and 202 deletions.
156 changes: 0 additions & 156 deletions .circleci/config.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Build Documentation
description: 'Build Documentation.'

runs:
using: composite
steps:
- name: Build Documentation
shell: bash
run: cd docs && make html
36 changes: 36 additions & 0 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI Workflow
description: 'Shared CI workflow.'
inputs:
ruby-version:
description: 'The version of ruby to setup and run'
required: true

runs:
using: composite
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby-version }}
bundler: 2.2.33

- name: Install dependencies
shell: bash
run: bundle _2.2.33_ install

- name: Skip flaky tests for jruby
if: ${{ startsWith(inputs.ruby-version, 'jruby') }}
shell: bash
run: echo "SPEC_TAGS=-t '~flaky'" >> $GITHUB_ENV

- name: Run tests
shell: bash
run: bundle _2.2.33_ exec rspec spec $SPEC_TAGS

- name: Run RuboCop
shell: bash
run: bundle exec rubocop --parallel

- name: Run contract tests
if: ${{ !startsWith(inputs.ruby-version, 'jruby') }}
shell: bash
run: make contract-tests
15 changes: 15 additions & 0 deletions .github/actions/publish-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Publish Documentation
description: 'Publish the documentation to GitHub Pages'
inputs:
token:
description: 'Token to use for publishing.'
required: true

runs:
using: composite
steps:
- uses: launchdarkly/gh-actions/actions/[email protected]
name: 'Publish to Github pages'
with:
docs_path: docs/build/html/
github_token: ${{inputs.token}} # For the shared action the token should be a GITHUB_TOKEN<
18 changes: 18 additions & 0 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish Package
description: 'Publish the package to rubygems'
inputs:
dry_run:
description: 'Is this a dry run. If so no package will be published.'
required: true

runs:
using: composite
steps:
- name: Build gemspec
shell: bash
run: gem build ld-eventsource.gemspec

- name: Publish Library
shell: bash
if: ${{ inputs.dry_run == 'false' }}
run: gem push ld-eventsource-*.gem
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Run CI
on:
push:
branches: [ 7.x ]
paths-ignore:
- '**.md' # Do not need to run CI for markdown changes.
pull_request:
branches: [ 7.x ]
paths-ignore:
- '**.md'

jobs:
build-linux:
runs-on: ubuntu-latest

env:
LD_SKIP_DATABASE_TESTS: 0

strategy:
matrix:
ruby-version:
- '2.7'
- '3.0'
- '3.1'
- '3.2'
- jruby-9.4

services:
redis:
image: redis
ports:
- 6379:6379
dynamodb:
image: amazon/dynamodb-local
ports:
- 8000:8000
consul:
image: hashicorp/consul
ports:
- 8500:8500

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # If you only need the current version keep this.

- uses: ./.github/actions/ci
with:
ruby-version: ${{ matrix.ruby-version }}

- uses: ./.github/actions/build-docs
if: ${{ !startsWith(matrix.ruby-version, 'jruby') }}

build-windows:
runs-on: windows-latest

env:
LD_SKIP_DATABASE_TESTS: 1

defaults:
run:
shell: powershell

steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler: 2.2.33

- name: Install dependencies
run: bundle _2.2.33_ install

- name: Run tests
run: bundle _2.2.33_ exec rspec spec
12 changes: 12 additions & 0 deletions .github/workflows/lint-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Lint PR title

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
lint-pr-title:
uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main
23 changes: 23 additions & 0 deletions .github/workflows/manual-publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
workflow_dispatch:

name: Publish Documentation
jobs:
build-publish-docs:
runs-on: ubuntu-latest
permissions:
id-token: write # Needed if using OIDC to get release secrets.
contents: write # Needed in this case to write github pages.
steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler: 2.2.33

- uses: ./.github/actions/build-docs

- uses: ./.github/actions/publish-docs
with:
token: ${{secrets.GITHUB_TOKEN}}
36 changes: 36 additions & 0 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Package
on:
workflow_dispatch:
inputs:
dry_run:
description: 'Is this a dry run. If so no package will be published.'
type: boolean
required: true

jobs:
build-publish:
runs-on: ubuntu-latest
# Needed to get tokens during publishing.
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4

- uses: launchdarkly/gh-actions/actions/[email protected]
name: 'Get rubygems API key'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/rubygems/api_key = GEM_HOST_API_KEY'

- id: build-and-test
name: Build and Test
uses: ./.github/actions/ci
with:
ruby-version: 2.7

- id: publish
name: Publish Package
uses: ./.github/actions/publish
with:
dry_run: ${{ inputs.dry_run }}
Loading

0 comments on commit 432c53d

Please sign in to comment.