Skip to content

Commit

Permalink
ci: Add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
shadeMe committed May 17, 2024
1 parent 7806f70 commit c1797f9
Show file tree
Hide file tree
Showing 14 changed files with 715 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://help.github.com/articles/about-codeowners/ for syntax

# Core Engineering will be the default owners for everything
# in the repo. Unless a later match takes precedence,
# @deepset-ai/core-engineering will be requested for review
# when someone opens a pull request.
* @deepset-ai/open-source-engineering

# Documentation
*.md @deepset-ai/documentation @deepset-ai/open-source-engineering
releasenotes/notes/* @deepset-ai/documentation @deepset-ai/open-source-engineering
3 changes: 3 additions & 0 deletions .github/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
self-hosted-runner:
# Labels of self-hosted runner in array of string
labels: ["cml", "ubuntu-latest-4-cores"]
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: 'daily'
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### Related Issues

- fixes #issue-number

### Proposed Changes:

<!--- In case of a bug: Describe what caused the issue and how you solved it -->
<!--- In case of a feature: Describe what did you add and how it works -->

### How did you test it?

<!-- unit tests, integration tests, manual verification, instructions for manual tests -->

### Notes for the reviewer

<!-- E.g. point out section where the reviewer -->

### Checklist

- I have read the [contributors guidelines](https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md) and the [code of conduct](https://github.com/deepset-ai/haystack/blob/main/code_of_conduct.txt)
- I have updated the related issue with new insights and changes
- I added unit tests and updated the docstrings
- I've used one of the [conventional commit types](https://www.conventionalcommits.org/en/v1.0.0/) for my PR title: `fix:`, `feat:`, `build:`, `chore:`, `ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`.
- I documented my code
- I ran [pre-commit hooks](https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md#installation) and fixed any issue
20 changes: 20 additions & 0 deletions .github/workflows/docstrings_linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: run docstrings linting

on:
push:
branches:
- docstrings-linting

jobs:
docstrings-linting:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Hatch
run: pip install hatch=="1.9.3"

- name: ruff docstrings linting
run: hatch run ruff check haystack-experimental
84 changes: 84 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# If you change this name also do it in linting-skipper.yml and ci_metrics.yml
name: Linting

on:
pull_request:
paths:
- "haystack-experimental/**/*.py"
- "test/**/*.py"
- "pyproject.toml"

env:
PYTHON_VERSION: "3.8"
HATCH_VERSION: "1.9.3"

jobs:
license-header:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check License Header
run: docker run --rm -v "$(pwd):/github/workspace" ghcr.io/korandoru/hawkeye check

mypy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# With the default value of 1, there are corner cases where tj-actions/changed-files
# fails with a `no merge base` error
fetch-depth: 0

- name: Get changed files
id: files
uses: tj-actions/changed-files@v44
with:
files: |
**/*.py
files_ignore: |
test/**
- uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Mypy
if: steps.files.outputs.any_changed == 'true'
run: |
mkdir .mypy_cache
hatch run test:types ${{ steps.files.outputs.all_changed_files }}
pylint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# With the default value of 1, there are corner cases where tj-actions/changed-files
# fails with a `no merge base` error
fetch-depth: 0

- name: Get changed files
id: files
uses: tj-actions/changed-files@v44
with:
files: |
haystack-experimental/**/*.py
- uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Pylint
if: steps.files.outputs.any_changed == 'true'
run: |
hatch run test:lint ${{ steps.files.outputs.all_changed_files }}
29 changes: 29 additions & 0 deletions .github/workflows/linting_skipper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# If you change this name also do it in linting.yml and ci_metrics.yml
name: Linting

on:
pull_request:
paths-ignore:
- "haystack/preview/**/*.py"
- "test/preview/**/*.py"
- "e2e/preview/**/*.py"
- "**/pyproject.toml"

jobs:
license-header:
runs-on: ubuntu-latest
steps:
- name: Skip mypy
run: echo "Skipped mypy"

mypy:
runs-on: ubuntu-latest
steps:
- name: Skip mypy
run: echo "Skipped mypy"

pylint:
runs-on: ubuntu-latest
steps:
- name: Skip pylint
run: echo "Skipped pylint"
16 changes: 16 additions & 0 deletions .github/workflows/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Track issues with Github project

on:
issues:
types:
- opened

jobs:
add-to-project:
name: Add new issues to project for triage
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
project-url: https://github.com/orgs/deepset-ai/projects/5
github-token: ${{ secrets.GH_PROJECT_PAT }}
42 changes: 42 additions & 0 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Project release on PyPi

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
# We must not release versions tagged with -rc0 suffix
- "!v[0-9]+.[0-9]+.[0-9]-rc0"

env:
HATCH_VERSION: "1.9.3"

jobs:
release-on-pypi:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Build Haystack Experimental
run: hatch build

- name: Publish on PyPi
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.HAYSTACK_AI_PYPI_TOKEN }}
run: hatch publish -y

- name: Notify Slack
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
VERSION: ${{ github.ref_name }}
if: always()
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
channel: "#haystack-notifications"
config: .github/config/pypi-release-slack-notification.yml
15 changes: 15 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'Stalebot'
on:
schedule:
- cron: '30 1 * * *'

jobs:
makestale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
any-of-labels: 'proposal,community-triage'
stale-pr-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
days-before-stale: 30
days-before-close: 10
Loading

0 comments on commit c1797f9

Please sign in to comment.