Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE/bugfix_pr_template.md

This file was deleted.

9 changes: 0 additions & 9 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md

This file was deleted.

16 changes: 16 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## General Instructions
- Keep it simple.
- Work in small, incremental changes.
- Do not add new dependencies unless given explicit permission.

## Task Tracking
- Always start each step by referencing and updating your tasks in `.github/tasks.md`.
- Use checkboxes to track progress.
- Work on one task at a time.
- Do not mark tasks as complete until they are fully done. Ask for confirmation if unsure.

## Repository Style
- Follow existing code style and conventions.
- Use `snake_case` for variable and function names.
- Use `PascalCase` for class names.
- Avoid using `Any` type hints if possible; be specific. Get permission from the user before using `Any`.
2 changes: 1 addition & 1 deletion .github/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
bug: ['fix/*', 'bugfix/*', 'hotfix/*']

enhancement: ['feature/*', 'enhancement/*']
enhancement: ['feature/*', 'enhancement/*']
8 changes: 8 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Description

## PR Checklist
- [ ] Merged latest master
- [ ] Updated version number in `pyproject.toml`.
- [ ] Update README.md if needed.

## Breaking Changes
2 changes: 2 additions & 0 deletions .github/tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Tasks
- []
11 changes: 11 additions & 0 deletions .github/workflows/feature_branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Feature branch
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]

jobs:
lint-test:
name: Lint and test
uses: ./.github/workflows/lint_and_test.yaml
secrets: inherit
25 changes: 25 additions & 0 deletions .github/workflows/lint_and_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Lint and Test"
on: workflow_call

jobs:
lint_and_test:
name: Lint and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: uv sync --dev

- name: Run pre-commit hooks
run: uv run pre-commit run --all-files
84 changes: 84 additions & 0 deletions .github/workflows/main_branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Main branch
on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
- main

jobs:
lint-test:
name: Lint and test
uses: ./.github/workflows/lint_and_test.yaml
secrets: inherit

release:
name: Create GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Check if PR was merged
run: |
if [ ${{ github.event_name }} == 'pull_request' ]; then
if [ ${{ github.event.pull_request.merged }} == 'false' ]; then
echo "This PR was closed without merging. Exiting..."
exit 0
fi
fi

- name: Checkout code
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0

- name: TOML Reader
id: read_toml
uses: SebRollen/toml-action@2bd04b06a3ebc3e6a3eb6060de115710cad16cd6 #v1.0.2
with:
file: 'pyproject.toml'
field: 'project.version'

- name: Define TAG
run: |
export VERSION="${{ steps.read_toml.outputs.value }}"
echo "TAG=v$VERSION" >> $GITHUB_ENV

- name: Check if tag exists
id: check_tag
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const tag = process.env.TAG;
const { owner, repo } = context.repo;
try {
await github.rest.git.getRef({
owner,
repo,
ref: `tags/${tag}`,
});
// If the API call doesn't throw an error, the tag exists
return true;
} catch (error) {
// If the API call throws an error, the tag doesn't exist
return false;
}
env:
TAG: ${{ env.TAG }}

- name: Create Release and Tag
uses: actions/github-script@v6
with:
result-encoding: string
retries: 3
script: |
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: process.env.TAG,
target_commitish: context.sha,
name: process.env.TAG,
generate_release_notes: true
})
8 changes: 4 additions & 4 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ name: PR Labeler
on:
workflow_dispatch:
pull_request:
types: [ opened ]
types: [ opened ]
branches: [ '*' ]


# Tag jobs
jobs:
pr-labeler:
runs-on: ubuntu-latest
runs-on: ubuntu-latest
permissions:
contents: read
contents: read
pull-requests: write
steps:
- uses: TimonVS/pr-labeler-action@v4
with:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
congiruation-path: .github/pr-labeler.yml
24 changes: 0 additions & 24 deletions .github/workflows/tag-it.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__pycache__
__pycache__
S3MP.egg-info
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
exclude: ^uv\.lock$
- id: check-merge-conflict
- id: check-toml

- repo: local
hooks:
# Run the linter
- id: ruff
name: ruff
language: system
entry: uv run ruff check --fix
types_or: [python, pyi]
# Run the formatter
- id: ruff-format
name: ruff-format
language: system
entry: uv run ruff format
types_or: [python, pyi]

- repo: local
hooks:
- id: mypy
name: mypy
language: system
entry: uv run mypy
types_or: [python, pyi]
exclude: ^S3MP/utils/image_utils\.py$
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM amazon/aws-lambda-python:3.10 as s3mp-lambda-img

COPY S3MP ./S3MP
COPY pyproject.toml ./pyproject.toml
RUN pip3 install .
RUN pip3 install .
Loading