Skip to content

Commit

Permalink
build: Switch to release please and github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 committed Nov 14, 2023
1 parent ec24970 commit c31a448
Show file tree
Hide file tree
Showing 15 changed files with 194 additions and 92 deletions.
58 changes: 0 additions & 58 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: cargo doc --no-deps -p eventsource-client
29 changes: 29 additions & 0 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI Workflow
description: 'Shared CI workflow.'

runs:
using: composite
steps:
- name: Check formatting
shell: bash
run: cargo fmt --check

- name: Run tests
shell: bash
run: cargo test --all-features -p eventsource-client

- name: Run clippy checks
shell: bash
run: cargo clippy --all-features -p eventsource-client -- -D warnings

- name: Build contract tests
shell: bash
run: make build-contract-tests

- name: Start contract test service
shell: bash
run: make start-contract-test-service-bg

- name: Run contract tests
shell: bash
run: make run-contract-tests
17 changes: 17 additions & 0 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish Package
description: 'Publish the package to crates.io'
inputs:
token:
description: 'Token to use for publishing.'
required: true
dry_run:
description: 'Is this a dry run. If so no package will be published.'
required: true

runs:
using: composite
steps:
- name: Publish Library
shell: bash
if: ${{ inputs.dry_run == 'false' }}
run: CARGO_REGISTRY_TOKEN="${{inputs.token}}" cargo publish -p eventsource-client
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run CI
on:
push:
branches: [ main ]
paths-ignore:
- '**.md' # Do not need to run CI for markdown changes.
pull_request:
branches: [ main ]
paths-ignore:
- '**.md'

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

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

- name: Setup rust tooling
run: |
rustup override set 1.68
rustup component add rustfmt clippy
- uses: ./.github/actions/ci
- uses: ./.github/actions/build-docs
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
37 changes: 37 additions & 0 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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

- name: Setup rust tooling
run: |
rustup override set 1.68
rustup component add rustfmt
- uses: ./.github/actions/ci
- uses: ./.github/actions/build-docs

- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.0
name: 'Get crates.io token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/cratesio/api_token = CARGO_REGISTRY_TOKEN'

- uses: ./.github/actions/publish
with:
token: ${{env.CARGO_REGISTRY_TOKEN}}
dry_run: ${{ inputs.dry_run }}
50 changes: 50 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Run Release Please

on:
push:
branches:
- main

jobs:
release-package:
runs-on: ubuntu-latest
permissions:
id-token: write # Needed if using OIDC to get release secrets.
contents: write # Contents and pull-requests are for release-please to make releases.
pull-requests: write
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
command: manifest
token: ${{secrets.GITHUB_TOKEN}}
default-branch: main

- uses: actions/checkout@v4
if: ${{ steps.release.outputs.releases_created }}
with:
fetch-depth: 0 # If you only need the current version keep this.

- name: Setup rust tooling
if: ${{ steps.release.outputs.releases_created }}
run: |
rustup override set 1.68
rustup component add rustfmt
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.0
name: 'Get crates.io token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/cratesio/api_token = CARGO_REGISTRY_TOKEN'

- uses: ./.github/actions/ci
if: ${{ steps.release.outputs.releases_created }}

- uses: ./.github/actions/build-docs
if: ${{ steps.release.outputs.releases_created }}

- uses: ./.github/actions/publish
if: ${{ steps.release.outputs.releases_created }}
with:
token: ${{env.CARGO_REGISTRY_TOKEN}}
dry_run: false
6 changes: 0 additions & 6 deletions .ldrelease/build.sh

This file was deleted.

9 changes: 0 additions & 9 deletions .ldrelease/config.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .ldrelease/publish-dry-run.sh

This file was deleted.

8 changes: 0 additions & 8 deletions .ldrelease/publish.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .ldrelease/update-version.sh

This file was deleted.

3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"eventsource-client": "0.11.0"
}
10 changes: 10 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"plugins": ["cargo-workspace"],
"release-type": "rust",
"bump-minor-pre-major": true,
"versioning": "default",
"include-component-in-tag": false,
"packages": {
"eventsource-client": {}
}
}

0 comments on commit c31a448

Please sign in to comment.