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 21, 2023
1 parent 57ca6ac commit 35297e3
Show file tree
Hide file tree
Showing 14 changed files with 269 additions and 240 deletions.
172 changes: 0 additions & 172 deletions .circleci/config.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Package
description: 'Publish the package to PyPI'
inputs:
token:
description: 'Token to use for publishing.'
required: true
dry_run:
description: 'Is this a dry run. If so no package will be published.'
required: true

runs:
using: composite
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
shell: bash
run: |
pip install -r requirements.txt
pip install wheel
pip install setuptools
- name: Building publishable packages
shell: bash
run: python setup.py sdist bdist_wheel

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ inputs.dry_run == 'false' }}
with:
password: ${{inputs.token}}
134 changes: 134 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Quality control checks

on:
push:
branches: [ main ]
paths-ignore:
- '**.md' # Do not need to run CI for markdown changes.
pull_request:
branches: [ main ]
paths-ignore:
- '**.md'

jobs:
linux:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

services:
redis:
image: redis
ports:
- 6379:6379
dynamodb:
image: amazon/dynamodb-local
ports:
- 8000:8000
consul:
image: hashicorp/consul
ports:
- 8500:8500

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install requirements
run: |
pipx install virtualenv
pip install setuptools
pip install -r test-requirements.txt
pip install -r test-filesource-optional-requirements.txt
pip install -r consul-requirements.txt
python setup.py install
pip freeze
- name: Run tests
run: pytest -s testing -W error::SyntaxWarning

- name: Test packaging
run: |
sudo rm -rf dist *.egg-info
./test-packaging/test-packaging.sh
- name: Verify typehints
run: make lint

- name: Verify docs can be successfully built
run: make docs

- name: Build contract tests
run: make build-contract-tests

- name: Start contract test service
run: make start-contract-test-service &

- name: run contract tests
run: make run-contract-tests

windows:
runs-on: windows-latest

defaults:
run:
shell: powershell

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Setup DynamoDB
run: |
$ProgressPreference = "SilentlyContinue"
iwr -outf dynamo.zip https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip
mkdir dynamo
Expand-Archive -Path dynamo.zip -DestinationPath dynamo
cd dynamo
cmd /c "START /b java -Djava.library.path=./DynamoDBLocal_lib -jar ./DynamoDBLocal.jar"
- name: Setup Consul
run: |
$ProgressPreference = "SilentlyContinue"
iwr -outf consul.zip https://releases.hashicorp.com/consul/1.4.2/consul_1.4.2_windows_amd64.zip
mkdir consul
Expand-Archive -Path consul.zip -DestinationPath consul
cd consul
sc.exe create "Consul" binPath="$(Get-Location)/consul.exe agent -dev"
sc.exe start "Consul"
- name: Setup Redis
run: |
$ProgressPreference = "SilentlyContinue"
iwr -outf redis.zip https://github.com/MicrosoftArchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.zip
mkdir redis
Expand-Archive -Path redis.zip -DestinationPath redis
cd redis
./redis-server --service-install
./redis-server --service-start
Start-Sleep -s 5
./redis-cli ping
- name: Install requirements
run: |
pip install setuptools
pip install -r test-requirements.txt
pip install -r test-filesource-optional-requirements.txt
pip install -r consul-requirements.txt
python setup.py install
pip freeze
- name: Run tests
run: pytest -s testing -W error::SyntaxWarning
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
31 changes: 31 additions & 0 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Package
on:
workflow_dispatch:
inputs:
dry_run:
description: 'Is this a dry run? If so no package will be published.'
type: boolean
required: true

jobs:
build-publish:
runs-on: ubuntu-latest
# Needed to get tokens during publishing.
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4

- uses: launchdarkly/gh-actions/actions/[email protected]
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'

- id: publish
name: Publish Package
uses: ./.github/actions/publish
with:
token: ${{env.PYPI_AUTH_TOKEN}}
dry_run: ${{ inputs.dry_run }}
Loading

0 comments on commit 35297e3

Please sign in to comment.