Skip to content

Commit

Permalink
ci: Replace releaser with release please (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 authored Nov 30, 2023
1 parent fb25eb9 commit 844958e
Show file tree
Hide file tree
Showing 14 changed files with 282 additions and 146 deletions.
107 changes: 0 additions & 107 deletions .circleci/config.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Use a step like this to build documentation.
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"
48 changes: 48 additions & 0 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI Workflow
description: 'Shared CI workflow.'
inputs:
php-version:
description: 'Which version of PHP should we setup?'
required: false
default: 8.0
use-lowest-dependencies:
description: 'Should we prefer the lowest dependency version?'
type: boolean
required: false
default: false
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 }}
extensions: xdebug
tools: phpdoc:3.1.2
env:
GITHUB_TOKEN: ${{ inputs.token }}

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

- 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: make test

- name: Run lint checks
shell: bash
run: make lint

- name: Run contract tests
shell: bash
run: make contract-tests
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/publish-pages@publish-pages-v1.0.1
name: 'Publish to Github pages'
with:
docs_path: docs
github_token: ${{ inputs.token }}
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Run CI
on:
push:
branches: [ 5.x ]
paths-ignore:
- '**.md' # Do not need to run CI for markdown changes.
pull_request:
branches: [ 5.x ]
paths-ignore:
- '**.md'

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

services:
wiremock:
image: wiremock/wiremock
ports:
- 8080:8080

strategy:
matrix:
php-version: [8.0, 8.1]
use-lowest-dependencies: [true, false]

env:
LD_INCLUDE_INTEGRATION_TESTS: 1

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 }}
token: ${{ secrets.GITHUB_TOKEN }}

windows-build:
runs-on: windows-latest

strategy:
matrix:
php-version: [8.0.30, 8.1.26]

env:
LD_INCLUDE_INTEGRATION_TESTS: 1

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

- name: Install java support
run: choco install -y javaruntime

- name: Install php support
run: choco install -y php --version=${{ matrix.php-version }} --force

- name: Install composer
run: choco install -y composer

- name: Download wiremock
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

- name: Verify checksum
shell: bash
run: |
[ "$(sha256sum wiremock.jar | awk '{ print $1 }')" == "c5cd526e04c57293ec847d845733b017c4052d2132653332e05a54272934a305" ]
- name: Start wiremock
run: cmd /c "START /b java -jar ./wiremock.jar"

- name: Wait for wiremock to be available
run: PowerShell -Command Start-Sleep -Seconds 5

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

- name: Run tests
run: .\vendor\bin\phpunit
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
35 changes: 35 additions & 0 deletions .github/workflows/manual-publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
workflow_dispatch:

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

services:
wiremock:
image: wiremock/wiremock
ports:
- 8080:8080

env:
LD_INCLUDE_INTEGRATION_TESTS: 1

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}}
51 changes: 51 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Run Release Please

on:
push:
branches:
- 5.x

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:
wiremock:
image: wiremock/wiremock
ports:
- 8080:8080

env:
LD_INCLUDE_INTEGRATION_TESTS: 1

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

- 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 }}
Loading

0 comments on commit 844958e

Please sign in to comment.