Skip to content

Commit

Permalink
feat: initial feature and project setup
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed May 20, 2024
1 parent 565f021 commit 8e9ba22
Show file tree
Hide file tree
Showing 31 changed files with 1,884 additions and 1 deletion.
1 change: 1 addition & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
demucs
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build
.codespellignore
dist
.dockerignore
Dockerfile
.git
.gitignore
.pre-commit-config.yaml
UNKNOWN.egg-info
.vscode
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 🐛 Bug Report
description: |
Describe your problem here.
labels: [bug]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: description
attributes:
label: Bug Description
description: Tell us what happens and what should happen instead.
validations:
required: true
- type: input
id: version
attributes:
label: Version
description: What version of stemgen are you running?
placeholder: 0.1.0, main, ...
- type: input
id: os
attributes:
label: OS
description: What operating system (and distribution if you're on Linux) are you running?
placeholder: Windows 11, macOS Big Sur, Ubuntu 22.04, ...
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 🚀 Feature Request
description: |
What feature would you like to see added to stemgen?
labels: [feature]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to suggest a new feature!
- type: textarea
id: description
attributes:
label: Feature Description
description: Describe describe your use-case, not yet supported and a possible solution.
validations:
required: true
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
24 changes: 24 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
build:
- changed-files:
- any-glob-to-any-file:
- Dockerfile
- setup.py
- pyproject.toml
- requirements.txt
- .github/workflows/**

stembox:
- changed-files:
- any-glob-to-any-file:
- stembox/**

stemgen:
- changed-files:
- any-glob-to-any-file:
- stemgen/**

code quality:
- changed-files:
- any-glob-to-any-file:
- .pre-commit-config.yaml
- .codespellignore
111 changes: 111 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow

name: Build

on:
push:
pull_request:

permissions:
contents: read # to fetch code (actions/checkout)

env:
REGISTRY_IMAGE: aclmb/stemgen

jobs:
build:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true

- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
28 changes: 28 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
#
# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# https://github.com/actions/labeler

name: "Pull Request Labeler"
on:
- pull_request_target

permissions:
contents: read

jobs:
triage:
permissions:
contents: read # for actions/labeler to determine modified files
pull-requests: write # for actions/labeler to add labels to PRs
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: false
79 changes: 79 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow

name: pre-commit

on:
pull_request:

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
pre-commit:
name: Detecting code style issues
runs-on: ubuntu-latest
# The Dockerfile for this container can be found at:
# https://github.com/Holzhaus/mixxx-ci-docker
container: holzhaus/mixxx-ci:20220930@sha256:c219b780280a21566111e8bd3df7a0d495922aca96a927aa1fef12b2095fa5d8
steps:
- name: "Check out repository"
uses: actions/[email protected]
with:
# Unfortunately we need the whole history and can't use a shallow clone
# because the Appstream Metadata hook parses the history to find the
# latest changelog modification date. Otherwise, `fetch-depth: 2` would
# suffice.
fetch-depth: 0

- name: "Add GitHub workspace as a safe directory"
# Without this, git commands will fail due to mismatching permissions in
# the container. See actions/runner#2033 for details.
#
# The actions/checkout action should already take care of this thanks to
# commit actions/checkout@55fd82fc42c0cdd6f1f480dd23f60636a42f6f5c, but
# it seems like that's not working properly.
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
git config --global --list
- name: "Detect code style issues (push)"
uses: pre-commit/[email protected]
if: github.event_name == 'push'
# There are too many files in the repo that have formatting issues. We'll
# disable these checks for now when pushing directly (but still run these
# on Pull Requests!).
env:
SKIP: clang-format,eslint,no-commit-to-branch

- name: "Detect code style issues (pull_request)"
uses: pre-commit/[email protected]
if: github.event_name == 'pull_request'
env:
SKIP: no-commit-to-branch
with:
# HEAD is the not yet integrated PR merge commit +refs/pull/xxxx/merge
# HEAD^1 is the PR target branch and HEAD^2 is the HEAD of the source branch
extra_args: --from-ref HEAD^1 --to-ref HEAD

- name: "Generate patch file"
if: failure()
run: |
git diff-index -p HEAD > "${PATCH_FILE}"
[ -s "${PATCH_FILE}" ] && echo "UPLOAD_PATCH_FILE=${PATCH_FILE}" >> "${GITHUB_ENV}"
shell: bash
env:
PATCH_FILE: pre-commit.patch

- name: "Upload patch artifact"
if: failure() && env.UPLOAD_PATCH_FILE != null
uses: actions/[email protected]
with:
name: ${{ env.UPLOAD_PATCH_FILE }}
path: ${{ env.UPLOAD_PATCH_FILE }}

- name: "Upload pre-commit.log"
if: failure() && env.UPLOAD_PATCH_FILE == null
uses: actions/[email protected]
with:
name: pre-commit.log
path: /github/home/.cache/pre-commit/pre-commit.log
30 changes: 30 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow

name: "Detect stale issues and pull request"
on:
schedule:
- cron: "0 0 * * *"

permissions:
contents: read

jobs:
stale:
permissions:
issues: write # for actions/stale to close stale issues
pull-requests: write # for actions/stale to close stale PRs
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: "This PR is marked as stale because it has been open 90 days with no activity."
stale-pr-label: "stale"
days-before-pr-stale: 90
days-before-pr-close: -1
exempt-pr-labels: "needs review"
close-issue-message: "Expired for stemgen because there has been no activity for 60 days."
stale-issue-label: "stale"
days-before-issue-stale: 60
days-before-issue-close: 0
only-issue-labels: "incomplete"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,7 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/


# Project specific
stembox/stembox.cpp
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-merge-conflict
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.3
hooks:
- id: clang-format
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.3
hooks:
- id: check-github-workflows
- repo: https://github.com/pycqa/flake8
rev: "7.0.0"
hooks:
- id: flake8
files: ^tools/.*$
types: [text, python]
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.13.0
hooks:
- id: markdownlint-cli2
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: [
--ignore-words,
.codespellignore,
--write-changes
]
Loading

0 comments on commit 8e9ba22

Please sign in to comment.