Skip to content

Commit

Permalink
Merge pull request #10 from phac-nml/gha
Browse files Browse the repository at this point in the history
Gha
  • Loading branch information
mattheww95 authored Dec 4, 2024
2 parents ebfbc57 + aed1ab4 commit 42f7c2d
Show file tree
Hide file tree
Showing 38 changed files with 388 additions and 801 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Branch Protection
# This workflow is triggered on PRs to master branch on the repository
# It fails when someone tries to make a PR against the `main` branch instead of `dev`
on:
pull_request_target:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check PRs
if: github.repository == 'phac-nml/profile_dists'
run: |
{ [[ ${{github.event.pull_request.head.repo.full_name }} == phac-nml/profile_dists]] && [[ $GITHUB_HEAD_REF == "dev" ]]; } || [[ $GITHUB_HEAD_REF == "patch" ]]
# If the above check failed, post a comment on the PR explaining the failure
# NOTE - this doesn't currently work if the PR is coming from a fork, due to limitations in GitHub actions secrets
- name: Post PR comment
if: failure()
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2
with:
message: |
## This PR is against the `main` branch :x:
* Do not close this PR
* Click _Edit_ and change the `base` to `dev`
* This CI test will remain failed until you push a new commit
---
Hello @${{ github.event.pull_request.user.login }}, This pull request is being made against the main branch, Please change your PR to be to the dev branch.
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: false
38 changes: 38 additions & 0 deletions .github/workflows/profile_dists-pytest-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@


name: profile_dists

on:
push:
branches: ["main", "tests", "dev"]
pull_request:
branches: ["main", "tests", "dev"]



jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-workflow==2.0.1
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest -o log_cli=true --git-aware
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
**__pycache__
*.pyc
*.pyc
build
*.egg
*.egg-info
41 changes: 0 additions & 41 deletions build/lib/profile_dists/constants.py

This file was deleted.

238 changes: 0 additions & 238 deletions build/lib/profile_dists/profile_dists.py

This file was deleted.

Empty file.
Loading

0 comments on commit 42f7c2d

Please sign in to comment.