Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github actions for testing MRs #5

Merged
merged 6 commits into from
May 23, 2024
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
2 changes: 2 additions & 0 deletions .devcontainer/.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ export PATH=$PATH:$HOME/.local/bin

#check if package is already installed before installing it
if ! python -c "import seismometer" 2> /dev/null; then
pip install pre-commit
pip install -r /home/seismo/workspace/requirements.txt
pre-commit install
fi
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Restrict all files related to deploying to require maintainer approval.

.github/workflows/ @epic-open-source/ai-trust-and-assurance-core
.github/CODEOWNERS @epic-open-source/ai-trust-and-assurance-core
src/seisomemeter/_version.py @epic-open-source/ai-trust-and-assurance-core
pyproject.toml @epic-open-source/ai-trust-and-assurance-core
setup.cfg @epic-open-source/ai-trust-and-assurance-core
33 changes: 33 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Enforce changelog fragment creation

on:
pull_request: {}

permissions: "read-all"

jobs:
check-changelog-entry:
name: changelog entry
runs-on: ubuntu-latest
# skip job if label is present
if: "!contains(github.event.pull_request.labels.*.name, 'skip changelog')"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# `towncrier check` needs full history to compare
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install towncrier
run: |
pip install --upgrade pip
pip install towncrier
- name: Validate changelog
run: |
if ! towncrier check --compare-with origin/${{ github.base_ref }}; then
echo "Please add a change fragment; see https://github.com/epic-open-source/seismometer/blob/main/changelog/README.rst for details."
false
fi
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push: {}
pull_request: {}
workflow_dispatch: {}

permissions: "read-all"

jobs:
run-linting:
name: linting via pre-commit
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install pre-commit
run: |
pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit steps
run: |
pre-commit run --all-files
run-tests:
name: tests via pytest
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e .[dev,audit]
- name: Run tests
run: |
pytest .
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-data
path: coverage/coverage.xml
if-no-files-found: error
File renamed without changes.
21 changes: 21 additions & 0 deletions changelog/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This directory contains changelog `fragments`; small per-fix or per-PR files **ReST**-formatted text that will
be added to ``CHANGES.rst`` by `towncrier <https://towncrier.readthedocs.io/en/latest/>`_.

The result is a documentation page meant for **users**. With this focus in mind, describe the change in the user
experience over the internal implementation detail.

Use full sentences, in the past tense, with proper punctuation, examples::

Added support for displaying a fairness audit visualization.

Upgraded event merging to be compatible with pandas v2.

Each file should be named ``<ISSUE>.<TYPE>.rst``, where ``<ISSUE>`` is an issue number, and ``<TYPE>`` is one of
the five towncrier types: feature, bugfix, doc, removal, or misc.

Such as ``1234.bugfix.rst`` or ``2345.doc.rst``

If a pull request fixes an issue, use that number in its file name. If there is no issue, then use the pull
request instead.
nhayes-rich marked this conversation as resolved.
Show resolved Hide resolved

If your change does not deserve a changelog entry, apply the `skip changelog` GitHub label to your pull request.
4 changes: 3 additions & 1 deletion docs/release_notes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ This is a list of changes that have been made between releases of the ``seismome

Breaking changes may occur between minor versions prior to the v1 release; afterwhich API changes will be restricted to major version updates.

.. towncrier release notes start

v0.1.0
------

Initial release!
Initial release!
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
[build-system]
requires = ["setuptools >= 65.6.0", "wheel >= 0.36.0"]
build-backend = 'setuptools.build_meta'

[tool.towncrier]
package = "seismometer"
package_dir = "src"
filename = "docs/release_notes/index.rst"
directory = "changelog"
issue_format = "`#{issue} <https://github.com/epic-open-source/seismometer/issues/{issue}>`__"
title_format = "{version}"
underlines = ["-","~"]
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ docs =


[tool:pytest]
addopts = --cov-config=setup.cfg --cov-report=html --cov=seismometer
addopts = --cov-config=setup.cfg --cov=seismometer --cov-report=term --cov-report=html --cov-report=xml:coverage/coverage.xml
testpaths = tests
json_report = coverage/test-report.json
jsonapi = True
Expand Down