Skip to content

Commit

Permalink
ci: Replace releaser with release please
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 committed Nov 30, 2023
1 parent 09ace06 commit 293c82a
Show file tree
Hide file tree
Showing 16 changed files with 258 additions and 81 deletions.
59 changes: 0 additions & 59 deletions .circleci/config.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build Documentation
description: 'Build Documentation.'

runs:
using: composite
steps:
- name: Build Documentation
shell: bash
run: |
phpdoc \
-d src \
-t "docs" \
--ignore Impl/ \
--ignore '*/Impl/' \
--ignore-tags psalm-param \
--ignore-tags psalm-var \
--ignore-tags psalm-return \
--visibility public \
--defaultpackagename "LaunchDarkly" \
--title "LaunchDarkly PHP SDK phpredis integration"
47 changes: 47 additions & 0 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI Workflow
description: 'Shared CI workflow.'
inputs:
php-version:
description: 'Which version of PHP should we setup?'
required: false
default: 7.4
use-lowest-dependencies:
description: 'Should we prefer the lowest dependency version?'
type: boolean
required: false
default: false
shared-test-version:
description: 'Which version of the shared test package should we required'
required: false
default: 4.x-dev
token:
description: 'Token used to prevent composer rate limiting'
required: true

runs:
using: composite
steps:
- name: Setup PHP
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35
with:
php-version: ${{ inputs.php-version }}
tools: phpdoc:3.1.2
env:
GITHUB_TOKEN: ${{ inputs.token }}

- name: Install dependencies
shell: bash
run: composer install --no-progress

- name: Require appropriate shared tests package
shell: bash
run: composer require --dev 'launchdarkly/server-sdk-shared-tests:${{ inputs.shared-test-version }}'

- name: Downgrade to lowest versions
if: ${{ inputs.use-lowest-dependencies }}
shell: bash
run: composer update --prefer-lowest --prefer-stable

- name: Run unit tests
shell: bash
run: ./vendor/bin/phpunit
15 changes: 15 additions & 0 deletions .github/actions/publish-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Publish Documentation
description: 'Publish the documentation to GitHub pages'
inputs:
token:
description: 'Token to use for publishing.'
required: true

runs:
using: composite
steps:
- uses: launchdarkly/gh-actions/actions/[email protected]
name: 'Publish to Github pages'
with:
docs_path: docs
github_token: { token } # For the shared action the token should be a GITHUB_TOKEN
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Run CI
on:
push:
branches: [ main ]
paths-ignore:
- '**.md' # Do not need to run CI for markdown changes.
pull_request:
branches: [ main ]
paths-ignore:
- '**.md'

jobs:
ci-build:
runs-on: ubuntu-latest

services:
redis:
image: redis
ports:
- 6379:6379

strategy:
matrix:
include:
# SDK 4.x PHP >= 7.3 & <8.0
- php-verison: 7.3
use-lowest-dependencies: true
shared-test-version: 4.x-dev
- php-verison: 7.4
use-lowest-dependencies: true
shared-test-version: 4.x-dev

# SDK 4.x PHP >= 8.0
- php-verison: 8.0
use-lowest-dependencies: true
shared-test-version: 4.x-dev
- php-verison: 8.1
use-lowest-dependencies: true
shared-test-version: 4.x-dev

# SDK 5.x PHP >= 8.0
- php-verison: 8.0
use-lowest-dependencies: false
shared-test-version: 5.x-dev
- php-verison: 8.1
use-lowest-dependencies: false
shared-test-version: 5.x-dev
- php-verison: 8.2
use-lowest-dependencies: false
shared-test-version: 5.x-dev

# SDK 6.x PHP >= 8.1
- php-verison: 8.1
use-lowest-dependencies: false
shared-test-version: dev-main
- php-verison: 8.2
use-lowest-dependencies: false
shared-test-version: dev-main

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # If you only need the current version keep this.

- uses: ./.github/actions/ci
with:
php-version: ${{ matrix.php-version }}
use-lowest-dependencies: ${{ matrix.use-lowest-dependencies }}
shared-test-version: ${{ matrix.shared-test-version }}
token: ${{ secrets.GITHUB_TOKEN }}
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
32 changes: 32 additions & 0 deletions .github/workflows/manual-publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
workflow_dispatch:

name: Publish Documentation
jobs:
build-publish:
runs-on: ubuntu-latest

services:
redis:
image: redis
ports:
- 6379:6379

permissions:
contents: write # Needed in this case to write github pages.

steps:
- uses: actions/checkout@v4

- name: Build and Test
uses: ./.github/actions/ci
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Build documentation
uses: ./.github/actions/build-docs

- name: Publish Documentation
uses: ./.github/actions/publish-docs
with:
token: ${{secrets.GITHUB_TOKEN}}
47 changes: 47 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Run Release Please

on:
push:
branches:
- main

jobs:
release-package:
runs-on: ubuntu-latest
permissions:
contents: write # Contents and pull-requests are for release-please to make releases.
pull-requests: write

services:
redis:
image: redis
ports:
- 6379:6379

steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
command: manifest
token: ${{secrets.GITHUB_TOKEN}}
default-branch: main

- uses: actions/checkout@v4
if: ${{ steps.release.outputs.releases_created }}
with:
fetch-depth: 0 # If you only need the current version keep this.

- name: Build and Test
if: ${{ steps.release.outputs.releases_created }}
uses: ./.github/actions/ci
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Build documentation
if: ${{ steps.release.outputs.releases_created }}
uses: ./.github/actions/build-docs

- uses: ./.github/actions/publish-docs
if: ${{ steps.release.outputs.releases_created }}
with:
token: ${{secrets.GITHUB_TOKEN}}
15 changes: 0 additions & 15 deletions .ldrelease/config.yml

This file was deleted.

Binary file removed .phpdoc/cache/descriptors/8/B/YUUawcRPu8iqa0H4uRzA
Binary file not shown.
3 changes: 0 additions & 3 deletions .phpdoc/cache/descriptors/D/D/m0G1Z9xVFKtNtCQFoi5w

This file was deleted.

Binary file removed .phpdoc/cache/descriptors/Z/L/JFbSeYKL898DcXcLNJXA
Binary file not shown.
Loading

0 comments on commit 293c82a

Please sign in to comment.