Skip to content

refactor the method 'nan_labels_to_float' in 'ml/utils' #2437

refactor the method 'nan_labels_to_float' in 'ml/utils'

refactor the method 'nan_labels_to_float' in 'ml/utils' #2437

name: CI/CD
on: [push]
jobs:
ci-cd:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Display Python version
run: python -c "import sys; print(sys.version)"
# Compare requirement files
- name: Compare requirement files
run: |
# Extract requirements from setup.cfg, remove leading spaces, and store in req_compare.txt
sed -n '/install_requires/,/^\[/{//!p}' setup.cfg | awk '/^ *$/ { next; } { print; }' | sed 's/^ //' > req_compare.txt
# Compare req_compare.txt with requirements.txt
# If files are different, echo the differences and exit with error status
if DIFF=$(diff req_compare.txt requirements.txt) ; then
echo "Files are the same"
else
echo "Files are different:"
diff req_compare.txt requirements.txt
exit 1
fi
- name: Install dependencies
run: |
sudo apt install python3.10-venv -y
python -m pip install --upgrade pip
pip install flake8 pytest build
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- 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: |
pip install -e . && pytest src/tests
- name: Build Package
run: |
python3 -m build .
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }} # For testing purposes: use secrets.PYPI_TEST_TOKEN
print_hash: true
verbose: true
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: tdspora
password: ${{ secrets.DOCKER_HUB_TOKEN }}
-
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta (BASE)
id: docker_meta_base
uses: docker/metadata-action@v5
with:
images: tdspora/syngen
tags: |
type=ref,event=branch
type=semver,pattern={{raw}}
- name: Build and push (BASE)
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.docker_meta_base.outputs.tags }}
labels: ${{ steps.docker_meta_base.outputs.labels }}
cache-from: type=registry,ref=tdspora/syngen:buildcache
cache-to: type=registry,ref=tdspora/syngen:buildcache,mode=max