Skip to content

Commit

Permalink
ci: Add workflows (#2)
Browse files Browse the repository at this point in the history
* ci: Add workflows

* fix

* fix coverage report

* clone repo

---------

Co-authored-by: Massimiliano Pippi <[email protected]>
  • Loading branch information
shadeMe and masci authored May 22, 2024
1 parent 34bfc3d commit c833979
Show file tree
Hide file tree
Showing 13 changed files with 262 additions and 189 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
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
18 changes: 18 additions & 0 deletions .github/workflows/licensing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Licensing

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

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
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 }}
40 changes: 40 additions & 0 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Project release on PyPi

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"

env:
HATCH_VERSION: "1.9.4"

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
86 changes: 86 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# If you change this name also do it in tests_skipper.yml and ci_metrics.yml
name: Tests

on:
# Activate this workflow manually
workflow_dispatch:

# Run tests nightly against Haystack's main branch
schedule:
- cron: "0 0 * * *"

push:
branches:
- main

pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
paths:
# Keep the list in sync with the paths defined in the `tests_skipper.yml` workflow
- "haystack_experimental/**/*.py"
- "test/**/*.py"
- "pyproject.toml"

env:
PYTHON_VERSION: "3.8"
HATCH_VERSION: "1.9.4"

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Check code format
run: hatch fmt

- name: Linting
run: hatch run test:lint

- name: Typing
run: hatch run test:typing

unit-tests:
name: Unit / ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"

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

- name: Run
run: hatch run test:cov

- name: Coveralls
# We upload only coverage for ubuntu as handling both os
# complicates the workflow too much for little to no gain
if: matrix.os == 'ubuntu-latest'
uses: coverallsapp/github-action@v2
with:
path-to-lcov: coverage.xml

- name: Nightly - run unit tests with Haystack main branch
if: github.event_name == 'schedule'
id: nightly-haystack-main
run: |
hatch run pip install git+https://github.com/deepset-ai/haystack.git
hatch run test:unit
19 changes: 19 additions & 0 deletions .github/workflows/workflows_linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Github workflows linter

on:
pull_request:
paths:
- ".github/workflows"

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

- name: Install actionlint
run: go install github.com/rhysd/actionlint/cmd/actionlint@latest

- name: Run actionlint
run: actionlint
3 changes: 3 additions & 0 deletions haystack_experimental/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2022-present deepset GmbH <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
7 changes: 1 addition & 6 deletions haystack_experimental/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@
#
# SPDX-License-Identifier: Apache-2.0

from importlib import metadata

try:
__version__ = str(metadata.version("haystack-experimental"))
except metadata.PackageNotFoundError:
__version__ = "main"
__version__ = "0.0.0"
Loading

0 comments on commit c833979

Please sign in to comment.