Skip to content

Commit d1fe34a

Browse files
authored
chore: Switch to release-please and GH actions (#25)
1 parent cf409cb commit d1fe34a

File tree

19 files changed

+429
-146
lines changed

19 files changed

+429
-146
lines changed

.circleci/config.yml

Lines changed: 0 additions & 124 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is this a support request?**
11+
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.
12+
13+
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.
14+
15+
**Describe the bug**
16+
A clear and concise description of what the bug is.
17+
18+
**To reproduce**
19+
Steps to reproduce the behavior.
20+
21+
**Expected behavior**
22+
A clear and concise description of what you expected to happen.
23+
24+
**Logs**
25+
If applicable, add any log output related to your problem.
26+
27+
**SDK version**
28+
The version of this SDK that you are using.
29+
30+
**Language version, developer tools**
31+
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.
32+
33+
**OS/platform**
34+
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.
35+
36+
**Additional context**
37+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context about the feature request here.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Coverage
2+
description: "Runs Go Server SDK's code-coverage checker."
3+
inputs:
4+
enforce:
5+
description: 'Whether to enforce coverage thresholds.'
6+
required: false
7+
default: 'false'
8+
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- uses: ./.github/actions/get-go-version
14+
id: go-version
15+
16+
- name: Test with coverage
17+
shell: bash
18+
id: test-coverage
19+
run: |
20+
set +e
21+
make test-coverage
22+
status=$?
23+
echo "coverage_status=$status" >> $GITHUB_OUTPUT
24+
25+
- name: Upload coverage results
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: Coverage-result-${{ steps.go-version.outputs.version }}
29+
path: build/coverage*
30+
31+
- name: Enforce coverage
32+
shell: bash
33+
run: |
34+
if [ "${{ steps.test-coverage.outputs.coverage_status }}" != "0" ]; then
35+
echo "Code isn't fully covered!"
36+
if [ "${{ inputs.enforce }}" == "true" ]; then
37+
exit 1
38+
fi
39+
else
40+
echo "Code is fully covered!"
41+
fi
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Get Go Version
2+
description: "Gets the currently installed Go version."
3+
outputs:
4+
version:
5+
description: 'The currently installed Go version.'
6+
value: ${{ steps.go-version.outputs.value }}
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Get Go version
12+
id: go-version
13+
shell: bash
14+
run: |
15+
echo "value=$(go version | awk '{print $3}')" >> $GITHUB_OUTPUT
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Unit Tests
2+
description: "Runs SDK's unit tests + linters and optionally gathers coverage."
3+
inputs:
4+
lint:
5+
description: 'Whether to run linters.'
6+
required: false
7+
default: 'false'
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- uses: ./.github/actions/get-go-version
13+
id: go-version
14+
- name: Lint
15+
if: inputs.lint == 'true'
16+
shell: bash
17+
run: make lint
18+
19+
- name: Test
20+
shell: bash
21+
id: test
22+
run: make test | tee raw_report.txt
23+
24+
- name: Process test results
25+
if: steps.test.outcome == 'success'
26+
id: process-test
27+
shell: bash
28+
run: go run github.com/jstemmer/go-junit-report@v0.9.1 < raw_report.txt > junit_report.xml
29+
30+
- name: Upload test results
31+
if: steps.process-test.outcome == 'success'
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: Test-result-test${{ steps.go-version.outputs.version }}
35+
path: junit_report.xml

.github/pull_request_template.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
**Requirements**
2+
3+
- [ ] I have added test coverage for new or changed functionality
4+
- [ ] I have followed the repository's [pull request submission guidelines](../blob/master/CONTRIBUTING.md#submitting-pull-requests)
5+
- [ ] I have validated my changes against all supported platform versions
6+
7+
**Related issues**
8+
9+
Provide links to any issues in this repository or elsewhere relating to this pull request.
10+
11+
**Describe the solution you've provided**
12+
13+
Provide a clear and concise description of what you expect to happen.
14+
15+
**Describe alternatives you've considered**
16+
17+
Provide a clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
21+
Add any other context about the pull request here.

.github/variables/go-versions.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
latest=1.23
2+
penultimate=1.22
3+
min=1.18
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Check Supported Go Versions
2+
on:
3+
schedule:
4+
- cron: "0 17 * * *"
5+
workflow_dispatch:
6+
7+
jobs:
8+
check-go-eol:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
latest: ${{ steps.parse.outputs.latest }}
12+
penultimate: ${{ steps.parse.outputs.penultimate }}
13+
timeout-minutes: 2
14+
steps:
15+
- uses: actions/checkout@v4
16+
# Perform a GET request to endoflife.date for the Go language. The response
17+
# contains all Go releases; we're interested in the 0'th and 1'th (latest and penultimate.)
18+
- name: Fetch officially supported Go versions
19+
uses: JamesIves/fetch-api-data-action@396ebea7d13904824f85b892b1616985f847301c
20+
with:
21+
endpoint: https://endoflife.date/api/go.json
22+
configuration: '{ "method": "GET" }'
23+
debug: true
24+
# Parse the response JSON and insert into environment variables for the next step.
25+
- name: Parse officially supported Go versions
26+
id: parse
27+
run: |
28+
echo "latest=${{ fromJSON(env.fetch-api-data)[0].cycle }}" >> $GITHUB_OUTPUT
29+
echo "penultimate=${{ fromJSON(env.fetch-api-data)[1].cycle }}" >> $GITHUB_OUTPUT
30+
31+
32+
create-prs:
33+
permissions:
34+
contents: write
35+
pull-requests: write
36+
needs: check-go-eol
37+
runs-on: ubuntu-latest
38+
strategy:
39+
matrix:
40+
branch: ["v4"]
41+
fail-fast: false
42+
env:
43+
officialLatestVersion: ${{ needs.check-go-eol.outputs.latest }}
44+
officialPenultimateVersion: ${{ needs.check-go-eol.outputs.penultimate }}
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
ref: ${{ matrix.branch }}
49+
50+
- name: Get current Go versions
51+
id: go-versions
52+
run: cat ./.github/variables/go-versions.env > $GITHUB_OUTPUT
53+
54+
- name: Update go-versions.env and README.md
55+
if: steps.go-versions.outputs.latest != env.officialLatestVersion
56+
id: update-go-versions
57+
run: |
58+
sed -i -e "s#latest=[^ ]*#latest=${{ env.officialLatestVersion }}#g" \
59+
-e "s#penultimate=[^ ]*#penultimate=${{ env.officialPenultimateVersion }}#g" \
60+
./.github/variables/go-versions.env
61+
62+
- name: Create pull request
63+
if: steps.update-go-versions.outcome == 'success'
64+
uses: peter-evans/create-pull-request@v6
65+
with:
66+
token: ${{ secrets.GITHUB_TOKEN }}
67+
add-paths: |
68+
.github/variables/go-versions.env
69+
branch: "launchdarklyreleasebot/update-to-go${{ env.officialLatestVersion }}-${{ matrix.branch }}"
70+
author: "LaunchDarklyReleaseBot <LaunchDarklyReleaseBot@launchdarkly.com>"
71+
committer: "LaunchDarklyReleaseBot <LaunchDarklyReleaseBot@launchdarkly.com>"
72+
labels: ${{ matrix.branch }}
73+
title: "ci: bump tested Go versions to ${{ env.officialLatestVersion }} and ${{ env.officialPenultimateVersion }}"
74+
commit-message: "Bumps from Go ${{ steps.go-versions.outputs.latest }} -> ${{ env.officialLatestVersion }} and ${{ steps.go-versions.outputs.penultimate }} -> ${{ env.officialPenultimateVersion }}."
75+
body: |
76+
- [ ] 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`)

0 commit comments

Comments
 (0)