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

update main with new Actions workflow #5

Merged
merged 15 commits into from
Sep 28, 2023
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
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ updates:
directory: "/"
schedule:
interval: daily
# Raise pull requests for version updates
# to pip against the `develop` branch
target-branch: "develop"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
# Raise pull requests for version updates
# to pip against the `develop` branch
target-branch: "develop"
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Description

A short description of the changes in this PR.

## Jira Issue ID

## Local Test Steps

## PR Acceptance Checklist
* [ ] Jira ticket acceptance criteria met.
* [ ] Tests added/updated and passing.
* [ ] Documentation updated (if needed).
* [ ] `CHANGELOG.md` updated
38 changes: 0 additions & 38 deletions .github/workflows/lint_and_test_on_pull_request.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ on:
workflow_dispatch:

jobs:
build-linux:
name: Lint and Test
runs-on: ubuntu-latest
run_tests:
uses: ./.github/workflows/run_tests.yml

bump_version:
needs: run_tests
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Retrieve repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

Expand Down Expand Up @@ -77,18 +83,6 @@ jobs:
echo "software_version=$(poetry version | awk '{print $2}')" >> $GITHUB_ENV
echo "venue=ops" >> $GITHUB_ENV

- name: Install concat_batcher
run: poetry install

- name: Lint
run: |
poetry run ruff batcher

- name: Test with pytest
run: |
poetry run pytest tests/test_filename_grouping.py
# TODO: expand tests to include full concatenation runs, i.e., don't just run test_group_handling.py

# - name: Commit Version Bump
# # If building develop, a release branch, or main then we commit the version bump back to the repo
# if: |
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This workflow will install Python dependencies, run tests,
# and report test results and code coverage as artifacts. It will
# be called by the workflow that run tests against new PRs and as
# a first step in the workflow that publishes new Docker images.

name: A reusable workflow to build and run the unit test suite

on:
workflow_call:
workflow_dispatch:

jobs:
build_and_test:
runs-on: ubuntu-latest

steps:
- name: Retrieve repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Set up Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.3.2

- name: Install package
run: poetry install

- name: Run linting
run: |
poetry run ruff batcher

- name: Run tests with coverage
run: |
poetry run coverage run -m pytest >& test_results.txt
# poetry run pytest tests/test_filename_grouping.py >& test_results.txt
# TODO: expand tests to include full concatenation runs, i.e., don't just run test_group_handling.py

- name: Generate coverage report
if: ${{ always() }}
run: |
poetry run coverage report -m >& coverage_report.txt
poetry run coverage html --dir htmlcov

- name: Archive test results
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: test result
path: test_results.txt

- name: Archive code coverage report (plain text)
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: code coverage report (plain text)
path: coverage_report.txt

- name: Archive code coverage report (HTML)
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: code coverage report (HTML)
path: htmlcov/*
15 changes: 15 additions & 0 deletions .github/workflows/run_tests_on_pull_requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Receive PR

# read-only repo token
# no access to secrets
on:
pull_request:
# Sequence of patterns matched against refs/heads
branches:
- feature/**
- issue/**
- issues/**

jobs:
build_and_test:
uses: ./.github/workflows/run_tests.yml
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
### Changed
### Deprecated
### Removed
### Fixed
Loading