Refactor GitHub Actions (#2808)
This commit is contained in:
parent
31d14704cb
commit
4dde4572ec
28
.github/workflows/coverage.yml
vendored
28
.github/workflows/coverage.yml
vendored
|
@ -12,29 +12,23 @@ on:
|
|||
- main
|
||||
- current-release
|
||||
- "*LTS"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
coverage:
|
||||
name: Check coverage
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.9]
|
||||
os: [ubuntu-latest]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies 🔨
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install tox
|
||||
- name: Run coverage
|
||||
run: tox -e coverage
|
||||
continue-on-error: true
|
||||
- uses: codecov/codecov-action@v2
|
||||
uses: sanic-org/simple-tox-action@v1
|
||||
with:
|
||||
python-version: "3.11"
|
||||
tox-env: coverage
|
||||
ignore-errors: true
|
||||
- name: Run Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
files: ./coverage.xml
|
||||
fail_ci_if_error: false
|
||||
|
|
39
.github/workflows/on-demand.yml
vendored
39
.github/workflows/on-demand.yml
vendored
|
@ -1,39 +0,0 @@
|
|||
name: On Demand Task
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
python-version:
|
||||
description: 'Version of Python to use for running Test'
|
||||
required: false
|
||||
default: "3.8"
|
||||
tox-env:
|
||||
description: 'Test Environment to Run'
|
||||
required: true
|
||||
default: ''
|
||||
os:
|
||||
description: 'Operating System to Run Test on'
|
||||
required: false
|
||||
default: ubuntu-latest
|
||||
jobs:
|
||||
onDemand:
|
||||
name: tox-${{ matrix.config.tox-env }}-on-${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ["${{ github.event.inputs.os}}"]
|
||||
config:
|
||||
- { tox-env: "${{ github.event.inputs.tox-env }}", py-version: "${{ github.event.inputs.python-version }}"}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run tests
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
python-version: ${{ matrix.config.py-version }}
|
||||
test-infra-tool: tox
|
||||
test-infra-version: latest
|
||||
action: tests
|
||||
test-additional-args: "-e=${{ matrix.config.tox-env }}"
|
||||
experimental-ignore-error: "yes"
|
37
.github/workflows/pr-bandit.yml
vendored
37
.github/workflows/pr-bandit.yml
vendored
|
@ -1,37 +0,0 @@
|
|||
name: Security Analysis
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- current-release
|
||||
- "*LTS"
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
bandit:
|
||||
if: github.event.pull_request.draft == false
|
||||
name: type-check-${{ matrix.config.python-version }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
config:
|
||||
- { python-version: 3.8, tox-env: security}
|
||||
- { python-version: 3.9, tox-env: security}
|
||||
- { python-version: "3.10", tox-env: security}
|
||||
- { python-version: "3.11", tox-env: security}
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v2
|
||||
id: checkout-branch
|
||||
|
||||
- name: Run Linter Checks
|
||||
id: linter-check
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
test-infra-tool: tox
|
||||
test-infra-version: latest
|
||||
action: tests
|
||||
test-additional-args: "-e=${{ matrix.config.tox-env }}"
|
33
.github/workflows/pr-docs.yml
vendored
33
.github/workflows/pr-docs.yml
vendored
|
@ -1,33 +0,0 @@
|
|||
name: Document Linter
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- current-release
|
||||
- "*LTS"
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
docsLinter:
|
||||
if: github.event.pull_request.draft == false
|
||||
name: Lint Documentation
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {python-version: "3.10", tox-env: "docs"}
|
||||
fail-fast: false
|
||||
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run Document Linter
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
test-infra-tool: tox
|
||||
test-infra-version: latest
|
||||
action: tests
|
||||
test-additional-args: "-e=${{ matrix.config.tox-env }}"
|
34
.github/workflows/pr-linter.yml
vendored
34
.github/workflows/pr-linter.yml
vendored
|
@ -1,34 +0,0 @@
|
|||
name: Linter Checks
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- current-release
|
||||
- "*LTS"
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
linter:
|
||||
if: github.event.pull_request.draft == false
|
||||
name: lint
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
config:
|
||||
- { python-version: "3.10", tox-env: lint}
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v2
|
||||
id: checkout-branch
|
||||
|
||||
- name: Run Linter Checks
|
||||
id: linter-check
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
test-infra-tool: tox
|
||||
test-infra-version: latest
|
||||
action: tests
|
||||
test-additional-args: "-e=${{ matrix.config.tox-env }}"
|
41
.github/workflows/pr-python-pypy.yml
vendored
41
.github/workflows/pr-python-pypy.yml
vendored
|
@ -1,41 +0,0 @@
|
|||
name: Python PyPy Tests
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tox-env:
|
||||
description: "Tox Env to run on the PyPy Infra"
|
||||
required: false
|
||||
default: "pypy310"
|
||||
pypy-version:
|
||||
description: "Version of PyPy to use"
|
||||
required: false
|
||||
default: "pypy-3.10"
|
||||
jobs:
|
||||
testPyPy:
|
||||
name: ut-${{ matrix.config.tox-env }}-${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# os: [ubuntu-latest, macos-latest]
|
||||
os: [ubuntu-latest]
|
||||
config:
|
||||
- {
|
||||
python-version: "${{ github.event.inputs.pypy-version }}",
|
||||
tox-env: "${{ github.event.inputs.tox-env }}",
|
||||
}
|
||||
steps:
|
||||
- name: Checkout the Repository
|
||||
uses: actions/checkout@v2
|
||||
id: checkout-branch
|
||||
|
||||
- name: Run Unit Tests
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
test-infra-tool: tox
|
||||
test-infra-version: latest
|
||||
action: tests
|
||||
test-additional-args: "-e=${{ matrix.config.tox-env }}"
|
||||
experimental-ignore-error: "true"
|
||||
command-timeout: "600000"
|
48
.github/workflows/pr-python310.yml
vendored
48
.github/workflows/pr-python310.yml
vendored
|
@ -1,48 +0,0 @@
|
|||
name: Python 3.10 Tests
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- current-release
|
||||
- "*LTS"
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
testPy310:
|
||||
if: github.event.pull_request.draft == false
|
||||
name: ut-${{ matrix.config.tox-env }}-${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# os: [ubuntu-latest, macos-latest]
|
||||
os: [ubuntu-latest]
|
||||
config:
|
||||
- {
|
||||
python-version: "3.10",
|
||||
tox-env: py310,
|
||||
ignore-error-flake: "false",
|
||||
command-timeout: "0",
|
||||
}
|
||||
- {
|
||||
python-version: "3.10",
|
||||
tox-env: py310-no-ext,
|
||||
ignore-error-flake: "true",
|
||||
command-timeout: "600000",
|
||||
}
|
||||
steps:
|
||||
- name: Checkout the Repository
|
||||
uses: actions/checkout@v2
|
||||
id: checkout-branch
|
||||
|
||||
- name: Run Unit Tests
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
test-infra-tool: tox
|
||||
test-infra-version: latest
|
||||
action: tests
|
||||
test-additional-args: "-e=${{ matrix.config.tox-env }},-vv=''"
|
||||
experimental-ignore-error: "${{ matrix.config.ignore-error-flake }}"
|
||||
command-timeout: "${{ matrix.config.command-timeout }}"
|
||||
test-failure-retry: "3"
|
48
.github/workflows/pr-python311.yml
vendored
48
.github/workflows/pr-python311.yml
vendored
|
@ -1,48 +0,0 @@
|
|||
name: Python 3.11 Tests
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- current-release
|
||||
- "*LTS"
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
testPy311:
|
||||
if: github.event.pull_request.draft == false
|
||||
name: ut-${{ matrix.config.tox-env }}-${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# os: [ubuntu-latest, macos-latest]
|
||||
os: [ubuntu-latest]
|
||||
config:
|
||||
- {
|
||||
python-version: "3.11",
|
||||
tox-env: py311,
|
||||
ignore-error-flake: "false",
|
||||
command-timeout: "0",
|
||||
}
|
||||
- {
|
||||
python-version: "3.11",
|
||||
tox-env: py311-no-ext,
|
||||
ignore-error-flake: "true",
|
||||
command-timeout: "600000",
|
||||
}
|
||||
steps:
|
||||
- name: Checkout the Repository
|
||||
uses: actions/checkout@v2
|
||||
id: checkout-branch
|
||||
|
||||
- name: Run Unit Tests
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
test-infra-tool: tox
|
||||
test-infra-version: latest
|
||||
action: tests
|
||||
test-additional-args: "-e=${{ matrix.config.tox-env }},-vv=''"
|
||||
experimental-ignore-error: "${{ matrix.config.ignore-error-flake }}"
|
||||
command-timeout: "${{ matrix.config.command-timeout }}"
|
||||
test-failure-retry: "3"
|
36
.github/workflows/pr-python38.yml
vendored
36
.github/workflows/pr-python38.yml
vendored
|
@ -1,36 +0,0 @@
|
|||
name: Python 3.8 Tests
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- current-release
|
||||
- "*LTS"
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
testPy38:
|
||||
if: github.event.pull_request.draft == false
|
||||
name: ut-${{ matrix.config.tox-env }}-${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
# os: [ubuntu-latest, macos-latest]
|
||||
os: [ubuntu-latest]
|
||||
config:
|
||||
- { python-version: 3.8, tox-env: py38 }
|
||||
- { python-version: 3.8, tox-env: py38-no-ext }
|
||||
steps:
|
||||
- name: Checkout the Repository
|
||||
uses: actions/checkout@v2
|
||||
id: checkout-branch
|
||||
|
||||
- name: Run Unit Tests
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
test-infra-tool: tox
|
||||
test-infra-version: latest
|
||||
action: tests
|
||||
test-additional-args: "-e=${{ matrix.config.tox-env }}"
|
||||
test-failure-retry: "3"
|
48
.github/workflows/pr-python39.yml
vendored
48
.github/workflows/pr-python39.yml
vendored
|
@ -1,48 +0,0 @@
|
|||
name: Python 3.9 Tests
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- current-release
|
||||
- "*LTS"
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
testPy39:
|
||||
if: github.event.pull_request.draft == false
|
||||
name: ut-${{ matrix.config.tox-env }}-${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
# os: [ubuntu-latest, macos-latest]
|
||||
os: [ubuntu-latest]
|
||||
config:
|
||||
- {
|
||||
python-version: 3.9,
|
||||
tox-env: py39,
|
||||
ignore-error-flake: "false",
|
||||
command-timeout: "0",
|
||||
}
|
||||
- {
|
||||
python-version: 3.9,
|
||||
tox-env: py39-no-ext,
|
||||
ignore-error-flake: "true",
|
||||
command-timeout: "600000",
|
||||
}
|
||||
steps:
|
||||
- name: Checkout the Repository
|
||||
uses: actions/checkout@v2
|
||||
id: checkout-branch
|
||||
|
||||
- name: Run Unit Tests
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
test-infra-tool: tox
|
||||
test-infra-version: latest
|
||||
action: tests
|
||||
test-additional-args: "-e=${{ matrix.config.tox-env }},-vv=''"
|
||||
experimental-ignore-error: "${{ matrix.config.ignore-error-flake }}"
|
||||
command-timeout: "${{ matrix.config.command-timeout }}"
|
||||
test-failure-retry: "3"
|
37
.github/workflows/pr-type-check.yml
vendored
37
.github/workflows/pr-type-check.yml
vendored
|
@ -1,37 +0,0 @@
|
|||
name: Typing Checks
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- current-release
|
||||
- "*LTS"
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
typeChecking:
|
||||
if: github.event.pull_request.draft == false
|
||||
name: type-check-${{ matrix.config.python-version }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
config:
|
||||
- { python-version: 3.8, tox-env: type-checking}
|
||||
- { python-version: 3.9, tox-env: type-checking}
|
||||
- { python-version: "3.10", tox-env: type-checking}
|
||||
- { python-version: "3.11", tox-env: type-checking}
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v2
|
||||
id: checkout-branch
|
||||
|
||||
- name: Run Linter Checks
|
||||
id: linter-check
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
test-infra-tool: tox
|
||||
test-infra-version: latest
|
||||
action: tests
|
||||
test-additional-args: "-e=${{ matrix.config.tox-env }}"
|
38
.github/workflows/pr-windows.yml
vendored
38
.github/workflows/pr-windows.yml
vendored
|
@ -1,38 +0,0 @@
|
|||
name: Run Unit Tests on Windows
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- current-release
|
||||
- "*LTS"
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
testsOnWindows:
|
||||
if: github.event.pull_request.draft == false
|
||||
name: ut-${{ matrix.config.tox-env }}
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- { python-version: 3.8, tox-env: py38-no-ext }
|
||||
- { python-version: 3.9, tox-env: py39-no-ext }
|
||||
- { python-version: "3.10", tox-env: py310-no-ext }
|
||||
- { python-version: "3.11", tox-env: py310-no-ext }
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run Unit Tests
|
||||
uses: ahopkins/custom-actions@pip-extra-args
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
test-infra-tool: tox
|
||||
test-infra-version: latest
|
||||
action: tests
|
||||
test-additional-args: "-e=${{ matrix.config.tox-env }}"
|
||||
experimental-ignore-error: "true"
|
||||
command-timeout: "600000"
|
||||
pip-extra-args: "--user"
|
48
.github/workflows/publish-images.yml
vendored
48
.github/workflows/publish-images.yml
vendored
|
@ -1,48 +0,0 @@
|
|||
name: Publish Docker Images
|
||||
on:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- 'Publish Artifacts'
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
publishDockerImages:
|
||||
name: Docker Image Build [${{ matrix.python-version }}]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11"]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build Latest Base images for ${{ matrix.python-version }}
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
docker-image-base-name: sanicframework/sanic-build
|
||||
ignore-python-setup: 'true'
|
||||
dockerfile-base-dir: './docker'
|
||||
action: 'image-publish'
|
||||
docker-image-tag: "${{ matrix.python-version }}"
|
||||
docker-file-suffix: "base"
|
||||
docker-build-args: "PYTHON_VERSION=${{ matrix.python-version }}"
|
||||
registry-auth-user: ${{ secrets.DOCKER_ACCESS_USER }}
|
||||
registry-auth-password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||
push-images: 'true'
|
||||
|
||||
- name: Publish Sanic Docker Image for ${{ matrix.python-version }}
|
||||
uses: harshanarayana/custom-actions@main
|
||||
with:
|
||||
docker-image-base-name: sanicframework/sanic
|
||||
ignore-python-setup: 'true'
|
||||
dockerfile-base-dir: './docker'
|
||||
action: 'image-publish'
|
||||
docker-build-args: "BASE_IMAGE_TAG=${{ matrix.python-version }}"
|
||||
docker-image-prefix: "${{ matrix.python-version }}"
|
||||
registry-auth-user: ${{ secrets.DOCKER_ACCESS_USER }}
|
||||
registry-auth-password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||
push-images: 'true'
|
39
.github/workflows/publish-package.yml
vendored
39
.github/workflows/publish-package.yml
vendored
|
@ -1,39 +0,0 @@
|
|||
name: Upload Python Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
build-n-publish:
|
||||
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.x"
|
||||
- name: Install pypa/build
|
||||
run: >-
|
||||
python3 -m
|
||||
pip install
|
||||
build
|
||||
--user
|
||||
- name: Build a binary wheel and a source tarball
|
||||
run: >-
|
||||
python3 -m
|
||||
build
|
||||
--sdist
|
||||
--wheel
|
||||
--outdir dist/
|
||||
.
|
||||
# - name: Publish distribution 📦 to Test PyPI
|
||||
# uses: pypa/gh-action-pypi-publish@release/v1
|
||||
# with:
|
||||
# password: ${{ secrets.SANIC_TEST_PYPI_API_TOKEN }}
|
||||
# repository-url: https://test.pypi.org/legacy/
|
||||
- name: Publish distribution 📦 to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
password: ${{ secrets.SANIC_PYPI_API_TOKEN }}
|
174
.github/workflows/publish-release.yml
vendored
Normal file
174
.github/workflows/publish-release.yml
vendored
Normal file
|
@ -0,0 +1,174 @@
|
|||
name: Publish release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
env:
|
||||
IS_TEST: false
|
||||
DOCKER_ORG_NAME: sanicframework
|
||||
DOCKER_IMAGE_NAME: sanic
|
||||
DOCKER_BASE_IMAGE_NAME: sanic-build
|
||||
DOCKER_IMAGE_DOCKERFILE: ./docker/Dockerfile
|
||||
DOCKER_BASE_IMAGE_DOCKERFILE: ./docker/Dockerfile-base
|
||||
|
||||
jobs:
|
||||
generate_info:
|
||||
name: Generate info
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
docker-tags: ${{ steps.generate_docker_info.outputs.tags }}
|
||||
pypi-version: ${{ steps.parse_version_tag.outputs.pypi-version }}
|
||||
steps:
|
||||
- name: Parse version tag
|
||||
id: parse_version_tag
|
||||
env:
|
||||
TAG_NAME: ${{ github.event.release.tag_name }}
|
||||
run: |
|
||||
tag_name="${{ env.TAG_NAME }}"
|
||||
|
||||
if [[ ! "${tag_name}" =~ ^v([0-9]{2})\.([0-9]{1,2})\.([0-9]+)$ ]]; then
|
||||
echo "::error::Tag name must be in the format vYY.MM.MICRO"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
year_output="year=${BASH_REMATCH[1]}"
|
||||
month_output="month=${BASH_REMATCH[2]}"
|
||||
pypi_output="pypi-version=${tag_name#v}"
|
||||
|
||||
echo "${year_output}"
|
||||
echo "${month_output}"
|
||||
echo "${pypi_output}"
|
||||
|
||||
echo "${year_output}" >> $GITHUB_OUTPUT
|
||||
echo "${month_output}" >> $GITHUB_OUTPUT
|
||||
echo "${pypi_output}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Get latest release
|
||||
id: get_latest_release
|
||||
run: |
|
||||
latest_tag=$(
|
||||
curl -L \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer ${{ github.token }}" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
https://api.github.com/repos/${{ github.repository }}/releases/latest \
|
||||
| jq -r '.tag_name'
|
||||
)
|
||||
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate Docker info
|
||||
id: generate_docker_info
|
||||
run: |
|
||||
tag_year="${{ steps.parse_version_tag.outputs.year }}"
|
||||
tag_month="${{ steps.parse_version_tag.outputs.month }}"
|
||||
latest_tag="${{ steps.get_latest_release.outputs.latest_tag }}"
|
||||
tag="${{ github.event.release.tag_name }}"
|
||||
|
||||
tags="${tag_year}.${tag_month}"
|
||||
|
||||
if [[ "${tag_month}" == "12" ]]; then
|
||||
tags+=",LTS"
|
||||
echo "::notice::Tag ${tag} is LTS version"
|
||||
else
|
||||
echo "::notice::Tag ${tag} is not LTS version"
|
||||
fi
|
||||
|
||||
if [[ "${latest_tag}" == "${{ github.event.release.tag_name }}" ]]; then
|
||||
tags+=",latest"
|
||||
echo "::notice::Tag ${tag} is marked as latest"
|
||||
else
|
||||
echo "::notice::Tag ${tag} is not marked as latest"
|
||||
fi
|
||||
|
||||
tags_output="tags=${tags}"
|
||||
|
||||
echo "${tags_output}"
|
||||
echo "${tags_output}" >> $GITHUB_OUTPUT
|
||||
|
||||
publish_package:
|
||||
name: Build and publish package
|
||||
runs-on: ubuntu-latest
|
||||
needs: generate_info
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install build twine
|
||||
|
||||
- name: Update package version
|
||||
run: |
|
||||
echo "__version__ = \"${{ needs.generate_info.outputs.pypi-version }}\"" > sanic/__version__.py
|
||||
|
||||
- name: Build a binary wheel and a source tarball
|
||||
run: python -m build --sdist --wheel --outdir dist/ .
|
||||
|
||||
- name: Publish to PyPi 🚀
|
||||
run: twine upload --non-interactive --disable-progress-bar dist/*
|
||||
env:
|
||||
TWINE_USERNAME: __token__
|
||||
TWINE_PASSWORD: ${{ env.IS_TEST == 'true' && secrets.SANIC_TEST_PYPI_API_TOKEN || secrets.SANIC_PYPI_API_TOKEN }}
|
||||
TWINE_REPOSITORY: ${{ env.IS_TEST == 'true' && 'testpypi' || 'pypi' }}
|
||||
|
||||
publish_docker:
|
||||
name: Publish Docker / Python ${{ matrix.python-version }}
|
||||
needs: [generate_info, publish_package]
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
python-version: ["3.10", "3.11"]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_ACCESS_USER }}
|
||||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||
|
||||
- name: Build and push base image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
push: ${{ env.IS_TEST == 'false' }}
|
||||
file: ${{ env.DOCKER_BASE_IMAGE_DOCKERFILE }}
|
||||
tags: ${{ env.DOCKER_ORG_NAME }}/${{ env.DOCKER_BASE_IMAGE_NAME }}:${{ matrix.python-version }}
|
||||
build-args: |
|
||||
PYTHON_VERSION=${{ matrix.python-version }}
|
||||
|
||||
- name: Parse tags for this Python version
|
||||
id: parse_tags
|
||||
run: |
|
||||
IFS=',' read -ra tags <<< "${{ needs.generate_info.outputs.docker-tags }}"
|
||||
tag_args=""
|
||||
|
||||
for tag in "${tags[@]}"; do
|
||||
tag_args+=",${{ env.DOCKER_ORG_NAME }}/${{ env.DOCKER_IMAGE_NAME }}:${tag}-py${{ matrix.python-version }}"
|
||||
done
|
||||
|
||||
tag_args_output="tag_args=${tag_args:1}"
|
||||
|
||||
echo "${tag_args_output}"
|
||||
echo "${tag_args_output}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push Sanic image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
push: ${{ env.IS_TEST == 'false' }}
|
||||
file: ${{ env.DOCKER_IMAGE_DOCKERFILE }}
|
||||
tags: ${{ steps.parse_tags.outputs.tag_args }}
|
||||
build-args: |
|
||||
BASE_IMAGE_ORG=${{ env.DOCKER_ORG_NAME }}
|
||||
BASE_IMAGE_NAME=${{ env.DOCKER_BASE_IMAGE_NAME }}
|
||||
BASE_IMAGE_TAG=${{ matrix.python-version }}
|
||||
SANIC_PYPI_VERSION=${{ needs.generate_info.outputs.pypi-version }}
|
49
.github/workflows/tests.yml
vendored
Normal file
49
.github/workflows/tests.yml
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
name: Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- current-release
|
||||
- "*LTS"
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
run_tests:
|
||||
name: "${{ matrix.config.platform == 'windows-latest' && 'Windows' || 'Linux' }} / Python ${{ matrix.config.python-version }} / tox -e ${{ matrix.config.tox-env }}"
|
||||
if: github.event.pull_request.draft == false
|
||||
runs-on: ${{ matrix.config.platform || 'ubuntu-latest' }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
config:
|
||||
- { python-version: "3.8", tox-env: security }
|
||||
- { python-version: "3.9", tox-env: security }
|
||||
- { python-version: "3.10", tox-env: security }
|
||||
- { python-version: "3.11", tox-env: security }
|
||||
- { python-version: "3.10", tox-env: lint }
|
||||
- { python-version: "3.10", tox-env: docs }
|
||||
- { python-version: "3.8", tox-env: type-checking }
|
||||
- { python-version: "3.9", tox-env: type-checking }
|
||||
- { python-version: "3.10", tox-env: type-checking }
|
||||
- { python-version: "3.11", tox-env: type-checking }
|
||||
- { python-version: "3.8", tox-env: py38, max-attempts: 3 }
|
||||
- { python-version: "3.8", tox-env: py38-no-ext, max-attempts: 3 }
|
||||
- { python-version: "3.9", tox-env: py39, max-attempts: 3 }
|
||||
- { python-version: "3.9", tox-env: py39-no-ext, max-attempts: 3 }
|
||||
- { python-version: "3.10", tox-env: py310, max-attempts: 3 }
|
||||
- { python-version: "3.10", tox-env: py310-no-ext, max-attempts: 3 }
|
||||
- { python-version: "3.11", tox-env: py311, max-attempts: 3 }
|
||||
- { python-version: "3.11", tox-env: py311-no-ext, max-attempts: 3 }
|
||||
- { python-version: "3.8", tox-env: py38-no-ext, platform: windows-latest, ignore-errors: true }
|
||||
- { python-version: "3.9", tox-env: py39-no-ext, platform: windows-latest, ignore-errors: true }
|
||||
- { python-version: "3.10", tox-env: py310-no-ext, platform: windows-latest, ignore-errors: true }
|
||||
- { python-version: "3.11", tox-env: py310-no-ext, platform: windows-latest, ignore-errors: true }
|
||||
steps:
|
||||
- name: Run tests
|
||||
uses: sanic-org/simple-tox-action@v1
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
tox-env: ${{ matrix.config.tox-env }}
|
||||
max-attempts: ${{ matrix.config.max-attempts || 1 }}
|
||||
ignore-errors: ${{ matrix.config.ignore-errors || false }}
|
10
README.rst
10
README.rst
|
@ -11,7 +11,7 @@ Sanic | Build fast. Run fast.
|
|||
:stub-columns: 1
|
||||
|
||||
* - Build
|
||||
- | |Py310Test| |Py39Test| |Py38Test|
|
||||
- | |Tests|
|
||||
* - Docs
|
||||
- | |UserGuide| |Documentation|
|
||||
* - Package
|
||||
|
@ -27,12 +27,8 @@ Sanic | Build fast. Run fast.
|
|||
:target: https://community.sanicframework.org/
|
||||
.. |Discord| image:: https://img.shields.io/discord/812221182594121728?logo=discord
|
||||
:target: https://discord.gg/FARQzAEMAA
|
||||
.. |Py310Test| image:: https://github.com/sanic-org/sanic/actions/workflows/pr-python310.yml/badge.svg?branch=main
|
||||
:target: https://github.com/sanic-org/sanic/actions/workflows/pr-python310.yml
|
||||
.. |Py39Test| image:: https://github.com/sanic-org/sanic/actions/workflows/pr-python39.yml/badge.svg?branch=main
|
||||
:target: https://github.com/sanic-org/sanic/actions/workflows/pr-python39.yml
|
||||
.. |Py38Test| image:: https://github.com/sanic-org/sanic/actions/workflows/pr-python38.yml/badge.svg?branch=main
|
||||
:target: https://github.com/sanic-org/sanic/actions/workflows/pr-python38.yml
|
||||
.. |Tests| image:: https://github.com/sanic-org/sanic/actions/workflows/tests.yml/badge.svg?branch=main
|
||||
:target: https://github.com/sanic-org/sanic/actions/workflows/tests.yml
|
||||
.. |Documentation| image:: https://readthedocs.org/projects/sanic/badge/?version=latest
|
||||
:target: http://sanic.readthedocs.io/en/latest/?badge=latest
|
||||
.. |PyPI| image:: https://img.shields.io/pypi/v/sanic.svg
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
ARG BASE_IMAGE_ORG
|
||||
ARG BASE_IMAGE_NAME
|
||||
ARG BASE_IMAGE_TAG
|
||||
|
||||
FROM sanicframework/sanic-build:${BASE_IMAGE_TAG}
|
||||
FROM ${BASE_IMAGE_ORG}/${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG}
|
||||
|
||||
RUN apk update
|
||||
RUN update-ca-certificates
|
||||
|
||||
RUN pip install sanic
|
||||
ARG SANIC_PYPI_VERSION
|
||||
|
||||
RUN pip install -U pip && pip install sanic==${SANIC_PYPI_VERSION}
|
||||
RUN apk del build-base
|
||||
|
|
Loading…
Reference in New Issue
Block a user