Skip to content

Commit 2fe6e0d

Browse files
authored
build: Switch to release please and github actions (#62)
1 parent ec24970 commit 2fe6e0d

File tree

15 files changed

+194
-92
lines changed

15 files changed

+194
-92
lines changed

.circleci/config.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/actions/build-docs/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Build Documentation
2+
description: 'Build Documentation.'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Build Documentation
8+
shell: bash
9+
run: cargo doc --no-deps -p eventsource-client

.github/actions/ci/action.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI Workflow
2+
description: 'Shared CI workflow.'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Check formatting
8+
shell: bash
9+
run: cargo fmt --check
10+
11+
- name: Run tests
12+
shell: bash
13+
run: cargo test --all-features -p eventsource-client
14+
15+
- name: Run clippy checks
16+
shell: bash
17+
run: cargo clippy --all-features -p eventsource-client -- -D warnings
18+
19+
- name: Build contract tests
20+
shell: bash
21+
run: make build-contract-tests
22+
23+
- name: Start contract test service
24+
shell: bash
25+
run: make start-contract-test-service-bg
26+
27+
- name: Run contract tests
28+
shell: bash
29+
run: make run-contract-tests

.github/actions/publish/action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Publish Package
2+
description: 'Publish the package to crates.io'
3+
inputs:
4+
token:
5+
description: 'Token to use for publishing.'
6+
required: true
7+
dry_run:
8+
description: 'Is this a dry run. If so no package will be published.'
9+
required: true
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Publish Library
15+
shell: bash
16+
if: ${{ inputs.dry_run == 'false' }}
17+
run: CARGO_REGISTRY_TOKEN="${{inputs.token}}" cargo publish -p eventsource-client

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Run CI
2+
on:
3+
push:
4+
branches: [ main ]
5+
paths-ignore:
6+
- '**.md' # Do not need to run CI for markdown changes.
7+
pull_request:
8+
branches: [ main ]
9+
paths-ignore:
10+
- '**.md'
11+
12+
jobs:
13+
ci-build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0 # If you only need the current version keep this.
20+
21+
- name: Setup rust tooling
22+
run: |
23+
rustup override set 1.68
24+
rustup component add rustfmt clippy
25+
26+
- uses: ./.github/actions/ci
27+
- uses: ./.github/actions/build-docs

.github/workflows/lint-pr-title.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Lint PR title
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
lint-pr-title:
12+
uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main

.github/workflows/manual-publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish Package
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
dry_run:
6+
description: 'Is this a dry run. If so no package will be published.'
7+
type: boolean
8+
required: true
9+
10+
jobs:
11+
build-publish:
12+
runs-on: ubuntu-latest
13+
# Needed to get tokens during publishing.
14+
permissions:
15+
id-token: write
16+
contents: read
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup rust tooling
21+
run: |
22+
rustup override set 1.68
23+
rustup component add rustfmt
24+
25+
- uses: ./.github/actions/ci
26+
- uses: ./.github/actions/build-docs
27+
28+
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.0
29+
name: 'Get crates.io token'
30+
with:
31+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
32+
ssm_parameter_pairs: '/production/common/releasing/cratesio/api_token = CARGO_REGISTRY_TOKEN'
33+
34+
- uses: ./.github/actions/publish
35+
with:
36+
token: ${{env.CARGO_REGISTRY_TOKEN}}
37+
dry_run: ${{ inputs.dry_run }}

.github/workflows/release-please.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Run Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release-package:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write # Needed if using OIDC to get release secrets.
13+
contents: write # Contents and pull-requests are for release-please to make releases.
14+
pull-requests: write
15+
steps:
16+
- uses: google-github-actions/release-please-action@v3
17+
id: release
18+
with:
19+
command: manifest
20+
token: ${{secrets.GITHUB_TOKEN}}
21+
default-branch: main
22+
23+
- uses: actions/checkout@v4
24+
if: ${{ steps.release.outputs.releases_created }}
25+
with:
26+
fetch-depth: 0 # If you only need the current version keep this.
27+
28+
- name: Setup rust tooling
29+
if: ${{ steps.release.outputs.releases_created }}
30+
run: |
31+
rustup override set 1.68
32+
rustup component add rustfmt
33+
34+
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.0
35+
name: 'Get crates.io token'
36+
with:
37+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
38+
ssm_parameter_pairs: '/production/common/releasing/cratesio/api_token = CARGO_REGISTRY_TOKEN'
39+
40+
- uses: ./.github/actions/ci
41+
if: ${{ steps.release.outputs.releases_created }}
42+
43+
- uses: ./.github/actions/build-docs
44+
if: ${{ steps.release.outputs.releases_created }}
45+
46+
- uses: ./.github/actions/publish
47+
if: ${{ steps.release.outputs.releases_created }}
48+
with:
49+
token: ${{env.CARGO_REGISTRY_TOKEN}}
50+
dry_run: false

.ldrelease/build.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

.ldrelease/config.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)