diff --git a/.github/workflows/cicd_deploy.yml b/.github/workflows/cicd_deploy.yml new file mode 100644 index 0000000..ed1733b --- /dev/null +++ b/.github/workflows/cicd_deploy.yml @@ -0,0 +1,59 @@ +name: cicd_deploy + +on: + push: + # Run deployment on every new tag + tags: + - '*' + +env: + DOCKER_REPO: ignimagelidar/pdal_ign_plugin + +jobs: + + build_and_deploy_docker: + runs-on: ubuntu-latest + + steps: + - name: Checkout branch + uses: actions/checkout@v3 + + - name: install cppunit + run: sudo apt install -y libcppunit-dev + + - name: compil + run: ./build.sh + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and export to Docker + uses: docker/build-push-action@v4 + with: + context: . + load: true + tags: ${{ env.DOCKER_REPO }}:test + + - name: Run tests in docker + run: > + docker run + --ipc=host + ${{ env.DOCKER_REPO }}:test + python -m pytest -m docker -s --log-cli-level DEBUG + + - name: Set version number + run: | + echo "VERSION=$(python -m test.version)" >> $GITHUB_ENV + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ env.DOCKER_REPO }}:latest,${{ env.DOCKER_REPO }}:${{ env.VERSION }} diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml deleted file mode 100644 index fb21f9c..0000000 --- a/.github/workflows/code-quality.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Check Quality -on: [pull_request] - - -jobs: - tests-python: - runs-on: ubuntu-latest - name: Checks - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 # A personaliser selon langage de développement - with: - python-version: 3.8 #Spécifier votre version de dev ou version latest si vous voulez vous en abstraire - - name : Checkout librairie-commune # - uses: actions/checkout@v3 - with: - repository: "ignf-sidc/librairie-commune" - ref: "dev" - path: python_lib/librairie-commune - ssh-key: ${{ secrets.RSA_GITHUB_WORKFLOW }} - - name: Install dependencies of librairie-commune - run: pip install -r python_lib/librairie-commune/install/requirements.txt - - name: Install dependencies - run: pip install -r install/requirements.txt - - name: "Analyse code with black" - run: black --diff --check bin - - name: "Analyse code with pylint" - run: pylint --rcfile=.pylintrc --disable=fixme bin --recursive=y - - name: "Analyse code with mypy" - run: mypy --strict bin - - name: "Run unit tests" - run: python3 -m unittest discover -b -s ignf_bag.tests.unit -p *TestCase.py - working-directory: bin diff --git a/test/__init__.py b/test/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/test/version.py b/test/version.py new file mode 100755 index 0000000..dc9f20a --- /dev/null +++ b/test/version.py @@ -0,0 +1,5 @@ +__version__ = "0.1.0.dev" + + +if __name__ == "__main__": + print(__version__) \ No newline at end of file