Skip to content

Commit

Permalink
Merge branch 'main' into art049-typo-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo authored Nov 2, 2023
2 parents f2f0a73 + 9a566ea commit 2b7fb7f
Show file tree
Hide file tree
Showing 17 changed files with 1,269 additions and 130 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [tiangolo]
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix:
# Python
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix:
16 changes: 14 additions & 2 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,26 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: tiangolo/latest-changes:latest
platforms: linux/amd64,linux/arm64
tags: |
tiangolo/latest-changes:latest
ghcr.io/tiangolo/latest-changes:latest
- name: Build and push tag
if: github.event_name == 'release'
uses: docker/build-push-action@v2
with:
push: true
tags: tiangolo/latest-changes:${{ github.event.release.tag_name }}
platforms: linux/amd64,linux/arm64
tags: |
tiangolo/latest-changes:${{ github.event.release.tag_name }}
ghcr.io/tiangolo/latest-changes:${{ github.event.release.tag_name }}
4 changes: 2 additions & 2 deletions .github/workflows/latest-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
latest-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: tiangolo/latest-changes@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
latest_changes_header: '### Latest Changes - Latest Changes 🤷\n\n'
latest_changes_header: '### Latest Changes - Latest Changes 🤷'
debug_logs: true
# - name: Secure tmate session
# run: curl https://github.com/tiangolo.keys > ~/.tmate_authorized_keys && echo 'set tmate-authorized-keys "~/.tmate_authorized_keys"' > ~/.xtmate.conf
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Test

on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: 'false'

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
# Allow debugging with tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
with:
limit-access-to-actor: true
- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements-test.txt') }}-v0
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: python -m pip install -r requirements-test.txt
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh
- run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}"

- name: Store coverage HTML
uses: actions/upload-artifact@v3
with:
name: coverage-html
path: htmlcov

# https://github.com/marketplace/actions/alls-green#why
alls-green: # This job does nothing and is only used for the branch protection
if: always()
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.mypy_cache
.vscode
*.pyc
.DS_Store
.coverage
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
FROM python:3.7
FROM python:3.10-slim

# Slim doesn't have git, install it manually
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*

COPY ./requirements.txt /app/requirements.txt

Expand Down
Loading

0 comments on commit 2b7fb7f

Please sign in to comment.