Skip to content

Commit

Permalink
Merge pull request #3 from IFCA-Advanced-Computing/develop
Browse files Browse the repository at this point in the history
Use github actions instead of CI/CD gitlab pipeline
  • Loading branch information
judithspd authored May 13, 2024
2 parents 5e327bc + 271af57 commit 377d8bc
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 88 deletions.
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

0 comments on commit 377d8bc

Please sign in to comment.