Skip to content

Commit

Permalink
chore: Switch to release-please and GH actions (#26)
Browse files Browse the repository at this point in the history
Co-authored-by: Casey Waldren <cwaldren@launchdarkly.com>
  • Loading branch information
keelerm84 and cwaldren-ld authored Dec 9, 2024
1 parent 0d0d7e9 commit 78f0c01
Show file tree
Hide file tree
Showing 24 changed files with 468 additions and 133 deletions.
106 changes: 0 additions & 106 deletions .circleci/config.yml

This file was deleted.

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/) and clicking "submit a request", or by emailing support@launchdarkly.com.

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.
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.
20 changes: 20 additions & 0 deletions .github/actions/benchmarks/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Benchmarks
description: "Runs the SDK's performance benchmarks."

runs:
using: composite
steps:
- uses: ./.github/actions/get-go-version
id: go-version

- name: Run Benchmarks
id: benchmarks
shell: bash
run: make benchmarks | tee benchmarks.txt

- name: Upload Results
if: steps.benchmarks.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: Benchmarks-${{ steps.go-version.outputs.version }}
path: benchmarks.txt
41 changes: 41 additions & 0 deletions .github/actions/coverage/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Coverage
description: "Runs Go Server SDK's code-coverage checker."
inputs:
enforce:
description: 'Whether to enforce coverage thresholds.'
required: false
default: 'false'


runs:
using: composite
steps:
- uses: ./.github/actions/get-go-version
id: go-version

- name: Test with coverage
shell: bash
id: test-coverage
run: |
set +e
make test-coverage
status=$?
echo "coverage_status=$status" >> $GITHUB_OUTPUT
- name: Upload coverage results
uses: actions/upload-artifact@v4
with:
name: Coverage-result-${{ steps.go-version.outputs.version }}
path: build/coverage*

- name: Enforce coverage
shell: bash
run: |
if [ "${{ steps.test-coverage.outputs.coverage_status }}" != "0" ]; then
echo "Code isn't fully covered!"
if [ "${{ inputs.enforce }}" == "true" ]; then
exit 1
fi
else
echo "Code is fully covered!"
fi
15 changes: 15 additions & 0 deletions .github/actions/get-go-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Get Go Version
description: "Gets the currently installed Go version."
outputs:
version:
description: 'The currently installed Go version.'
value: ${{ steps.go-version.outputs.value }}

runs:
using: composite
steps:
- name: Get Go version
id: go-version
shell: bash
run: |
echo "value=$(go version | awk '{print $3}')" >> $GITHUB_OUTPUT
49 changes: 49 additions & 0 deletions .github/actions/unit-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Unit Tests
description: "Runs SDK's unit tests + linters and optionally gathers coverage."
inputs:
lint:
description: 'Whether to run linters.'
required: false
default: 'false'

runs:
using: composite
steps:
- uses: ./.github/actions/get-go-version
id: go-version

- name: Build (default implementation)
shell: bash
run: make build

- name: Build (easyjson implementation)
shell: bash
run: make build-easyjson

- name: Lint
if: inputs.lint == 'true'
shell: bash
run: make lint

- name: Test (default implementation)
shell: bash
id: test
run: make test | tee raw_report.txt

- name: Test (easyjson implementation)
shell: bash
id: test-easyjson
run: make test-easyjson | tee -a raw_report.txt

- name: Process test results
if: steps.test.outcome == 'success'
id: process-test
shell: bash
run: go run github.com/jstemmer/go-junit-report@v0.9.1 < raw_report.txt > junit_report.xml

- name: Upload test results
if: steps.process-test.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: Test-result-test${{ steps.go-version.outputs.version }}
path: junit_report.xml
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.
3 changes: 3 additions & 0 deletions .github/variables/go-versions.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
latest=1.23
penultimate=1.22
min=1.18
76 changes: 76 additions & 0 deletions .github/workflows/check-go-versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Check Supported Go Versions
on:
schedule:
- cron: "0 17 * * *"
workflow_dispatch:

jobs:
check-go-eol:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.parse.outputs.latest }}
penultimate: ${{ steps.parse.outputs.penultimate }}
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
# Perform a GET request to endoflife.date for the Go language. The response
# contains all Go releases; we're interested in the 0'th and 1'th (latest and penultimate.)
- name: Fetch officially supported Go versions
uses: JamesIves/fetch-api-data-action@396ebea7d13904824f85b892b1616985f847301c
with:
endpoint: https://endoflife.date/api/go.json
configuration: '{ "method": "GET" }'
debug: true
# Parse the response JSON and insert into environment variables for the next step.
- name: Parse officially supported Go versions
id: parse
run: |
echo "latest=${{ fromJSON(env.fetch-api-data)[0].cycle }}" >> $GITHUB_OUTPUT
echo "penultimate=${{ fromJSON(env.fetch-api-data)[1].cycle }}" >> $GITHUB_OUTPUT
create-prs:
permissions:
contents: write
pull-requests: write
needs: check-go-eol
runs-on: ubuntu-latest
strategy:
matrix:
branch: ["v3"]
fail-fast: false
env:
officialLatestVersion: ${{ needs.check-go-eol.outputs.latest }}
officialPenultimateVersion: ${{ needs.check-go-eol.outputs.penultimate }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}

- name: Get current Go versions
id: go-versions
run: cat ./.github/variables/go-versions.env > $GITHUB_OUTPUT

- name: Update go-versions.env and README.md
if: steps.go-versions.outputs.latest != env.officialLatestVersion
id: update-go-versions
run: |
sed -i -e "s#latest=[^ ]*#latest=${{ env.officialLatestVersion }}#g" \
-e "s#penultimate=[^ ]*#penultimate=${{ env.officialPenultimateVersion }}#g" \
./.github/variables/go-versions.env
- name: Create pull request
if: steps.update-go-versions.outcome == 'success'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: |
.github/variables/go-versions.env
branch: "launchdarklyreleasebot/update-to-go${{ env.officialLatestVersion }}-${{ matrix.branch }}"
author: "LaunchDarklyReleaseBot <LaunchDarklyReleaseBot@launchdarkly.com>"
committer: "LaunchDarklyReleaseBot <LaunchDarklyReleaseBot@launchdarkly.com>"
labels: ${{ matrix.branch }}
title: "ci: bump tested Go versions to ${{ env.officialLatestVersion }} and ${{ env.officialPenultimateVersion }}"
commit-message: "Bumps from Go ${{ steps.go-versions.outputs.latest }} -> ${{ env.officialLatestVersion }} and ${{ steps.go-versions.outputs.penultimate }} -> ${{ env.officialPenultimateVersion }}."
body: |
- [ ] I have triggered CI on this PR (either close & reopen this PR in Github UI, or `git commit -m "run ci" --allow-empty && git push`)
Loading

0 comments on commit 78f0c01

Please sign in to comment.