Skip to content

Commit

Permalink
Merge pull request #411 from kedhammar/ci
Browse files Browse the repository at this point in the history
Introduce CI to repo
  • Loading branch information
kedhammar authored Jan 31, 2024
2 parents 1912ea8 + 7878b89 commit 40d141e
Show file tree
Hide file tree
Showing 98 changed files with 6,203 additions and 4,025 deletions.
52 changes: 25 additions & 27 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "TACA",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
"name": "TACA",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile",
},
"features": {},
"customizations": {
"vscode": {
"extensions": ["ms-python.python"],
},
"features": {},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
]
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
"postCreateCommand": "cd ../flowcell_parser/ && pip3 install -e . && cd ../TACA && pip3 install -e .",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
"mounts": [
"source=${localEnv:HOME}/repos/flowcell_parser,target=/workspaces/flowcell_parser,type=bind,consistency=cached"
]
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
"postCreateCommand": "cd ../flowcell_parser/ && pip3 install -e . && cd ../TACA && pip3 install -e .",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
"mounts": [
"source=${localEnv:HOME}/repos/flowcell_parser,target=/workspaces/flowcell_parser,type=bind,consistency=cached",
],
}
9 changes: 9 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Start adding here

# 2024-01-31, Non-invasive fixes after merge with master //AKe
a676908bb32d60bcbc5e42ce710f889980845af4
2ba0179015e380b3b7e0ce8b9b99666533a7443f
8ea4523b1c9789d03410178d75aea93b6b2ffa77
d5330f615b237beadcec22d5422dff3c02aa54ff
b9ee704ad4da26790e539b8fe1d39aa71f831ef1
6a3edf3710b6fdd8c233662ebf900e9bd24e6bd5
2 changes: 1 addition & 1 deletion .github/pr_labels.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '1'
version: "1"
invalidStatus: "pending"
labelRule:
values:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/check-log.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check VERSIONLOG.MD has been updated
on: [pull_request]

jobs:
check-versionlog:
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Check for VERSIONLOG.MD changes
id: versionlog_check
# 1) Find the common ancestor between the current HEAD and the base branch
# 2) Then see if the versionlog has been updated in the PR since it diverged
# from the common ancestor
run: |
PR_BASE_SHA=$(git merge-base HEAD ${{ github.event.pull_request.base.sha }})
FILE_CHANGED=$(git diff --name-only $PR_BASE_SHA HEAD | grep 'VERSIONLOG.md' || true)
if [ -n "$FILE_CHANGED" ]; then
echo "VERSIONLOG.MD has been changed."
else
echo "VERSIONLOG.MD has NOT been changed."
exit 1 # Fail the workflow if no changes in VERSIONLOG.MD
fi
124 changes: 124 additions & 0 deletions .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Lint code
on: [push, pull_request]

jobs:
# Use ruff to check for code style violations
ruff-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: ruff --> Check for style violations
# Configured in pyproject.toml
run: ruff check .

# Use ruff to check code formatting
ruff-format:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: ruff --> Check code formatting
run: ruff format --check .

# Use mypy for static type checking
mypy-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mypy
# Start by installing type stubs
- name: mypy --> Install stubs
run: echo -e "y" | mypy --install-types **/*.py || exit 0
- name: mypy --> Static type checking
# Configured in pyprojet.toml
run: mypy **/*.py

# Use pipreqs to check for missing dependencies
pipreqs-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install pipreqs
run: pip install pipreqs

- name: Install requirements
run: pip install -r requirements.txt

- name: Run pipreqs
run: pipreqs --savepath pipreqs.txt

- name: Compare requirements
run: |
# Extract and sort package names
awk -F'(=|==|>|>=|<|<=| @ )' '{print $1}' requirements.txt | sort -u > requirements.compare
awk -F'(=|==|>|>=|<|<=| @ )' '{print $1}' pipreqs.txt | sort -u > pipreqs.compare
# Compare package lists
if cmp -s requirements.compare pipreqs.compare
then
echo "Requirements are the same"
exit 0
else
echo "Requirements are different"
echo ""
echo "=== current requirements.txt ==="
echo ""
cat requirements.compare
echo ""
echo "=== pipreqs requirements ==="
echo ""
cat pipreqs.compare
exit 1
fi
# Use Prettier to check various file formats
prettier:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install Prettier
run: npm install -g prettier

- name: Run Prettier --check
run: prettier --check .
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ _build
.benchmarks
.coverage
__pycache__
.pytest_cache
.vscode
.ruff_cache
.mypy_cache
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# .pre-commit-config.yaml
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.7.1"
hooks:
- id: mypy
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

When contribution to this package please have the following things in mind:

__NOTE__: _Please make sure that there are no exisiting [issues]((https://github.com/SciLifeLab/TACA/issues)) relating to whatever you want to report._
**NOTE**: _Please make sure that there are no exisiting [issues](<(https://github.com/SciLifeLab/TACA/issues)>) relating to whatever you want to report._

####To contribute:

1. Create an issue describing the bug / suggestion / improvement / ... [here](https://github.com/SciLifeLab/TACA/issues).
2. Fork this repository to your GitHub account
3. Make the necessary changes / additions to your forked TACA repository
4. Please *make sure* that you've documented your code and changes using [sphinx](http://sphinx.readthedocs.org/en/latest/tutorial.html) syntax, as the documentation will be automatically generated using this engine, and published to [ReadTheDocs](http://project-management.readthedocs.org/)
4. Please _make sure_ that you've documented your code and changes using [sphinx](http://sphinx.readthedocs.org/en/latest/tutorial.html) syntax, as the documentation will be automatically generated using this engine, and published to [ReadTheDocs](http://project-management.readthedocs.org/)
5. Update the version number in `TACA/__init__.py`
6. Pull Request and wait for the responsible reviewer to review and merge the code

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ COPY requirements-dev.txt requirements-dev.txt
RUN python -m pip install -r requirements-dev.txt

RUN mkdir /root/.taca/
COPY tests/data/taca_test_cfg.yaml /root/.taca/taca.yaml
COPY tests/data/taca_test_cfg.yaml /root/.taca/taca.yaml
Loading

0 comments on commit 40d141e

Please sign in to comment.