Skip to content

Commit b49931b

Browse files
authored
ci: Replace releaser with release please (#188)
1 parent 729bcab commit b49931b

File tree

14 files changed

+282
-146
lines changed

14 files changed

+282
-146
lines changed

.circleci/config.yml

Lines changed: 0 additions & 107 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Use a step like this to build documentation.
2+
name: Build Documentation
3+
description: 'Build Documentation.'
4+
5+
runs:
6+
using: composite
7+
steps:
8+
- name: Build Documentation
9+
shell: bash
10+
run: |
11+
phpdoc \
12+
-d src \
13+
-t "docs" \
14+
--ignore Impl/ \
15+
--ignore '*/Impl/' \
16+
--ignore-tags psalm-param \
17+
--ignore-tags psalm-var \
18+
--ignore-tags psalm-return \
19+
--visibility public \
20+
--defaultpackagename "LaunchDarkly" \
21+
--title "LaunchDarkly PHP SDK"

.github/actions/ci/action.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI Workflow
2+
description: 'Shared CI workflow.'
3+
inputs:
4+
php-version:
5+
description: 'Which version of PHP should we setup?'
6+
required: false
7+
default: 8.1
8+
use-lowest-dependencies:
9+
description: 'Should we prefer the lowest dependency version?'
10+
type: boolean
11+
required: false
12+
default: false
13+
token:
14+
description: 'Token used to prevent composer rate limiting'
15+
required: true
16+
17+
runs:
18+
using: composite
19+
steps:
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35
22+
with:
23+
php-version: ${{ inputs.php-version }}
24+
extensions: xdebug
25+
tools: phpdoc:3.3.1
26+
env:
27+
GITHUB_TOKEN: ${{ inputs.token }}
28+
29+
- name: Install dependencies
30+
shell: bash
31+
run: composer install --no-progress
32+
33+
- name: Downgrade to lowest versions
34+
if: ${{ inputs.use-lowest-dependencies }}
35+
shell: bash
36+
run: composer update --prefer-lowest --prefer-stable
37+
38+
- name: Run unit tests
39+
shell: bash
40+
run: make test
41+
42+
- name: Run lint checks
43+
shell: bash
44+
run: make lint
45+
46+
- name: Run contract tests
47+
shell: bash
48+
run: make contract-tests
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Publish Documentation
2+
description: 'Publish the documentation to GitHub pages'
3+
inputs:
4+
token:
5+
description: 'Token to use for publishing.'
6+
required: true
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.1
12+
name: 'Publish to Github pages'
13+
with:
14+
docs_path: docs
15+
github_token: ${{ inputs.token }}

.github/workflows/ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
linux-build:
14+
runs-on: ubuntu-latest
15+
16+
services:
17+
wiremock:
18+
image: wiremock/wiremock
19+
ports:
20+
- 8080:8080
21+
22+
strategy:
23+
matrix:
24+
php-version: [8.1, 8.2]
25+
use-lowest-dependencies: [true, false]
26+
27+
env:
28+
LD_INCLUDE_INTEGRATION_TESTS: 1
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0 # If you only need the current version keep this.
34+
35+
- uses: ./.github/actions/ci
36+
with:
37+
php-version: ${{ matrix.php-version }}
38+
use-lowest-dependencies: ${{ matrix.use-lowest-dependencies }}
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
41+
windows-build:
42+
runs-on: windows-latest
43+
44+
strategy:
45+
matrix:
46+
php-version: [8.1.26, 8.2.13]
47+
48+
env:
49+
LD_INCLUDE_INTEGRATION_TESTS: 1
50+
51+
steps:
52+
- uses: actions/checkout@v4
53+
with:
54+
fetch-depth: 0 # If you only need the current version keep this.
55+
56+
- name: Install java support
57+
run: choco install -y javaruntime
58+
59+
- name: Install php support
60+
run: choco install -y php --version=${{ matrix.php-version }} --force
61+
62+
- name: Install composer
63+
run: choco install -y composer
64+
65+
- name: Download wiremock
66+
run: Invoke-WebRequest -Uri https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.31.0/wiremock-jre8-standalone-2.31.0.jar -UseBasicParsing -OutFile wiremock.jar
67+
68+
- name: Verify checksum
69+
shell: bash
70+
run: |
71+
[ "$(sha256sum wiremock.jar | awk '{ print $1 }')" == "c5cd526e04c57293ec847d845733b017c4052d2132653332e05a54272934a305" ]
72+
73+
- name: Start wiremock
74+
run: cmd /c "START /b java -jar ./wiremock.jar"
75+
76+
- name: Wait for wiremock to be available
77+
run: PowerShell -Command Start-Sleep -Seconds 5
78+
79+
- name: Install dependencies
80+
run: composer install --no-progress
81+
82+
- name: Run tests
83+
run: .\vendor\bin\phpunit
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
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
on:
2+
workflow_dispatch:
3+
4+
name: Publish Documentation
5+
jobs:
6+
build-publish:
7+
runs-on: ubuntu-latest
8+
9+
services:
10+
wiremock:
11+
image: wiremock/wiremock
12+
ports:
13+
- 8080:8080
14+
15+
env:
16+
LD_INCLUDE_INTEGRATION_TESTS: 1
17+
18+
permissions:
19+
contents: write # Needed in this case to write github pages.
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Build and Test
25+
uses: ./.github/actions/ci
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Build documentation
30+
uses: ./.github/actions/build-docs
31+
32+
- name: Publish Documentation
33+
uses: ./.github/actions/publish-docs
34+
with:
35+
token: ${{secrets.GITHUB_TOKEN}}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
12+
permissions:
13+
contents: write # Contents and pull-requests are for release-please to make releases.
14+
pull-requests: write
15+
16+
services:
17+
wiremock:
18+
image: wiremock/wiremock
19+
ports:
20+
- 8080:8080
21+
22+
env:
23+
LD_INCLUDE_INTEGRATION_TESTS: 1
24+
25+
steps:
26+
- uses: google-github-actions/release-please-action@v3
27+
id: release
28+
with:
29+
command: manifest
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
default-branch: main
32+
33+
- uses: actions/checkout@v4
34+
if: ${{ steps.release.outputs.releases_created }}
35+
with:
36+
fetch-depth: 0 # If you only need the current version keep this.
37+
38+
- name: Build and Test
39+
if: ${{ steps.release.outputs.releases_created }}
40+
uses: ./.github/actions/ci
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Build documentation
45+
if: ${{ steps.release.outputs.releases_created }}
46+
uses: ./.github/actions/build-docs
47+
48+
- uses: ./.github/actions/publish-docs
49+
if: ${{ steps.release.outputs.releases_created }}
50+
with:
51+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)