Skip to content

Commit

Permalink
Create release config (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinchuby authored May 17, 2024
1 parent 4987158 commit 3b1f8da
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
push:
branches:
- main
tags:
- v*
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python "3.11"
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Lint with lintrunner
uses: justinchuby/lintrunner-action@main

build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Python build dependencies
run: |
python -m pip install --upgrade pip build wheel
- name: Build wheels
run: |
python -m build
- name: Upload wheels
uses: actions/upload-artifact@v3
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
name: dist
path: dist

release:
name: Release
environment: release
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [build, lint]
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@f5622bde02b04381239da3573277701ceca8f6a0
56 changes: 56 additions & 0 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
merge_base_with = 'main'

[[linter]]
code = 'RUFF'
include_patterns = [
'**/*.py',
'**/*.pyi',
]
exclude_patterns = []
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'ruff_linter',
'--config=pyproject.toml',
'--show-disable',
'@{{PATHSFILE}}',
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'ruff==0.4.4',
]
is_formatter = true

[[linter]]
code = 'RUFF-FORMAT'
include_patterns = [
'**/*.py',
]
exclude_patterns = []
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'ruff_format_linter',
'--config=pyproject.toml',
'--',
'@{{PATHSFILE}}',
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'ruff==0.4.4',
]
is_formatter = true

0 comments on commit 3b1f8da

Please sign in to comment.