Skip to content

Commit

Permalink
ci: add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyzyngeraneo committed May 13, 2024
1 parent a5294df commit 9f86065
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
67 changes: 67 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
pull_request:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-format:
name: Check linting and formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
fetch-depth: 0

- name: pip update
run: python -m pip install --upgrade pip

- name: Install dependencies
run: python -m pip install build setuptools_scm[toml]

- name: Install dependencies
run: python -m pip install .[dev]

- name: Lint
run: python -m ruff .

- name: Check format
run: python -m ruff format .

- name: Check Diff
run: |
DIFF="$(git diff --name-only)"
if [ -z "$DIFF" ]; then
echo "OK: Format is clean"
else
echo "Error: Format was not clean"
echo "List of files:"
echo "$DIFF"
git diff
exit 1
fi
build-test:
name: Build and test Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
fetch-depth: 0

- name: pip update
run: python -m pip install --upgrade pip

- name: Install dependencies
run: python -m pip install build setuptools_scm[toml]

- name: Install dependencies
run: python -m pip install .[tests]

- name: Run tests
run: python -m pytest tests

5 changes: 4 additions & 1 deletion src/armonik_cli/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def list_results(client: ArmoniKResults, result_filter: Filter):
results = client.list_results(result_filter, page=page)
while len(results[1]) > 0:
for result in results[1]:
print(f'Result ID: {result.result_id}')
print(f'Result ID: {result}')
page += 1
results = client.list_results(result_filter, page=page)

Expand Down Expand Up @@ -175,6 +175,9 @@ def get_task_durations(client: ArmoniKTasks, task_filter: Filter):
for partition, duration in durations.items():
print(f"Partition: {partition} = {duration} secondes")

def hello():
return "Hello, World!"


def main():

Expand Down
Empty file added tests/conftest.py
Empty file.
4 changes: 4 additions & 0 deletions tests/unit/test_hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from armonik_cli.admin import hello

def test_hello():
assert hello() == "Hello, World!"

0 comments on commit 9f86065

Please sign in to comment.