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

Use github actions instead of CI/CD gitlab pipeline #3

Merged
merged 8 commits into from
May 13, 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
84 changes: 84 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI/CD Pipeline

on:
push:
branches:
- "*"
pull_request:
branches:
- main

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install and configure poetry
run: |
pip install poetry
poetry config virtualenvs.create false
poetry install

- name: Install dependencies
run: |
pip install --upgrade pip
pip install tox

- name: Linting
run: tox -e bandit,black,flake8

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"

- name: Install and configure poetry
run: |
pip install poetry
poetry config virtualenvs.create false
poetry install

- name: Install dependencies
run: |
pip install --upgrade pip
pip install tox

- name: Testing
run: tox -e py39,py310,py311,py312

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install dependencies
run: |
pip install --upgrade pip
pip install poetry

- name: Build package
run: |
poetry build
pip install dist/*.whl
35 changes: 35 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Package in PyPI

on:
release:
types: [published]

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build

- name: Build and upload package
run: |
python -m build
python -m twine upload dist/*
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

82 changes: 0 additions & 82 deletions .gitlab-ci.yml

This file was deleted.

7 changes: 5 additions & 2 deletions anjana/anonymity/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,12 @@ def generate_intervals(
sup: typing.Union[int, float],
step: int,
) -> list:
"""Given a quasi-identifier of numeric type, creates a list containing an
"""
Generate intervals as hierarchies.

Given a quasi-identifier of numeric type, creates a list containing an
interval-based generalization (hierarchy) of the values of the quasi-identifier.
The intervals will have the length entered in the parameter step.
The intervals will have the length entered in step.

:param quasi_ident: values of the quasi-identifier on which the interval-based
generalization is to be obtained
Expand Down
5 changes: 1 addition & 4 deletions examples/hospital.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@
0: data["gender"].values,
1: np.array(["*"] * len(data["gender"].values)),
},
"city": {
0: data["city"].values,
1: np.array(["*"] * len(data["city"].values))
},
"city": {0: data["city"].values, 1: np.array(["*"] * len(data["city"].values))},
}
data_anon = k_anonymity(data, ident, quasi_ident, k, supp_level, hierarchies)
print(data_anon)
Expand Down
Loading