Skip to content

Commit

Permalink
chore: Switch to release-please and GH actions (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 authored Dec 24, 2024
1 parent fc10492 commit 934951b
Show file tree
Hide file tree
Showing 27 changed files with 247 additions and 259 deletions.
25 changes: 0 additions & 25 deletions .circleci/config.yml

This file was deleted.

1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
.git
bin
dist
Dockerfile
sse-contract-tests
3 changes: 3 additions & 0 deletions .github/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "2.3.0"
}
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Is this a support request?**
This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going [here](https://support.launchdarkly.com/hc/en-us/requests/new) or by emailing [email protected].

Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.

**Describe the bug**
A clear and concise description of what the bug is.

**To reproduce**
Steps to reproduce the behavior.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Logs**
If applicable, add any log output related to your problem.

**SDK version**
The version of this SDK that you are using.

**Language version, developer tools**
For instance, Go 1.11 or Ruby 2.5.3. If you are using a language that requires a separate compiler, such as C, please include the name and version of the compiler too.

**OS/platform**
For instance, Ubuntu 16.04, Windows 10, or Android 4.0.3. If your code is running in a browser, please also include the browser type and version.

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Support request
url: https://support.launchdarkly.com/hc/en-us/requests/new
about: File your support requests with LaunchDarkly's support team
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context about the feature request here.
22 changes: 22 additions & 0 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI Workflow
description: 'Shared CI workflow.'
inputs:
run_linter:
description: 'If true, run linter.'
required: false
default: 'true'

runs:
using: composite
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.16
- name: Run tests
shell: bash
run: make test
- name: Run linter
if: ${{ inputs.run_linter == 'true' }}
shell: bash
run: make lint
27 changes: 27 additions & 0 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Artifacts
description: 'Publish artifacts to Github Release'
inputs:
token:
description: 'Token to use for publishing.'
required: true
tag:
description: 'Tag to upload artifacts to.'
required: true

runs:
using: composite
steps:
- name: Run Goreleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean --skip=publish
env:
GITHUB_TOKEN: ${{ inputs.token }}

- name: Upload Release Artifacts
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.token }}
run: |
gh release upload ${{ inputs.tag }} ./dist/*.tar.gz ./dist/*.zip --clobber
21 changes: 21 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
**Requirements**

- [ ] I have added test coverage for new or changed functionality
- [ ] I have followed the repository's [pull request submission guidelines](../blob/master/CONTRIBUTING.md#submitting-pull-requests)
- [ ] I have validated my changes against all supported platform versions

**Related issues**

Provide links to any issues in this repository or elsewhere relating to this pull request.

**Describe the solution you've provided**

Provide a clear and concise description of what you expect to happen.

**Describe alternatives you've considered**

Provide a clear and concise description of any alternative solutions or features you've considered.

**Additional context**

Add any other context about the pull request here.
13 changes: 13 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"packages" : {
"." : {
"release-type" : "go",
"bump-minor-pre-major" : true,
"versioning" : "default",
"include-component-in-tag" : false,
"extra-files" : [
"main.go"
]
}
}
}
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build and Test
on:
push:
branches: [ 'main' ]
paths-ignore:
- '**.md' # Do not need to run CI for markdown changes.
pull_request:
branches: [ 'main', 'feat/**' ]
paths-ignore:
- '**.md'

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci
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
26 changes: 26 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run Release Please

on:
push:
branches:
- main

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
target-branch: main

release-sdk-test-harness:
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
uses: ./.github/workflows/release.yml
with:
tag: ${{ needs.release-please.outputs.tag_name }}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish Release

on:
workflow_call:
inputs:
tag:
required: true
description: 'The tag to upload release artifacts to.'
type: string
workflow_dispatch:
inputs:
tag:
description: 'The tag to upload release artifacts to.'
required: true
type: string

jobs:
release-sdk-test-harness:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for goreleaser to inspect tags.
- uses: ./.github/actions/ci
with:
run_linter: 'false'
smoke_test: 'false'
- uses: ./.github/actions/publish
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ inputs.tag }}
15 changes: 2 additions & 13 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ builds:
goarch: 386

release:
disable: true # this disables releasing *to GitHub*; it will still push to Docker
# (we want Releaser to be responsible for doing all the GitHub release manipulations)
disable: true # this disables releasing *to GitHub*;
# (we want release-please to be responsible for doing all the GitHub release manipulations)

snapshot:
# Allows you to change the name of the generated snapshot
Expand Down Expand Up @@ -52,14 +52,3 @@ archives:
- LICENSE.txt
- README.md
- CHANGELOG.md

dockers:
- image_templates:
- "ldcircleci/sse-contract-tests:{{ .Tag }}"
- "ldcircleci/sse-contract-tests:{{ .Major }}"
- "ldcircleci/sse-contract-tests:{{ .Major }}{{ .Minor }}"
- "ldcircleci/sse-contract-tests:latest"
goos: linux
goarch: amd64
dockerfile: Dockerfile.goreleaser
skip_push: false
8 changes: 0 additions & 8 deletions .ldrelease/config.yml

This file was deleted.

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

This file was deleted.

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

This file was deleted.

3 changes: 0 additions & 3 deletions .ldrelease/secrets.properties

This file was deleted.

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

This file was deleted.

27 changes: 0 additions & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,7 @@ To build the project:
make
```

To build the Docker image locally (note that we normally use a different mechanism for publishing releases in Docker):
```
make docker-build
```

To run the linter:
```
make lint
```

### Testing

Currently the CI build for this project consists of a smoke test where the tool is built in Docker and then run against a fake service that deliberately returns an error-- proving that the code at least builds, executes, and makes the expected initial status request.

To run this test locally:
```
make docker-smoke-test
```

## Publishing releases

We normally use our internal Releaser tool. This takes care of updating the changelog, the version string in `version.go`, and the Git release history, as well as publishing the Docker image; see scripts in `.ldrelease`.

If you need to do a release manually for whatever reason, the steps are:

1. Update `VERSION` and `CHANGELOG.md`. Push these changes and create a version tag such as `v1.0.0`.
2. Use `docker login` to provide the credentials of the `ldcircleci` Docker account.
3. Run `make publish-release`.
4. Look in `./dist` for all `.tar.gz` and `.zip` files. These are the archives of executable binaries for various platforms. Attach these files to the GitHub release.

To do a dry run locally that builds all of the executables and the Docker image without publishing them, run `make build-release`. You can also use Releaser's dry-run mode to do the same for any branch in GitHub.
Loading

0 comments on commit 934951b

Please sign in to comment.