From bea31cc6ade73d42fec43ebbe3d35fda09f4fa45 Mon Sep 17 00:00:00 2001 From: Adrien Perrin Date: Tue, 21 May 2024 08:08:37 +0000 Subject: [PATCH 1/6] setup.py: get version from git --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d15f0269..d166548f 100644 --- a/setup.py +++ b/setup.py @@ -213,7 +213,6 @@ def run_setup(skip_compile): setup( name=NAME, - version=VERSION, maintainer=MAINTAINER, maintainer_email=MAINTAINER_EMAIL, description=DESCRIPTION, @@ -237,6 +236,8 @@ def run_setup(skip_compile): cmdclass = {'install_scripts': my_install_scripts}, install_requires=REQS, test_suite="nansat.tests", + use_scm_version=True, + setup_requires=['setuptools_scm'], **kw ) From 47255a754a86af194d3b84ca43a1ed4934227ff5 Mon Sep 17 00:00:00 2001 From: Adrien Perrin Date: Tue, 21 May 2024 08:27:33 +0000 Subject: [PATCH 2/6] build package in docker container --- .github/workflows/tests_build.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/tests_build.yml b/.github/workflows/tests_build.yml index c89b9d46..86acb94d 100644 --- a/.github/workflows/tests_build.yml +++ b/.github/workflows/tests_build.yml @@ -107,13 +107,8 @@ jobs: - name: 'Checkout repository' uses: actions/checkout@v4 - - name: Set up Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: 3.11 - - name: Build package - run: NANSAT_RELEASE="${{ github.ref_type == 'tag' && github.ref_name || '0.0.0' }}" python setup.py sdist + run: docker run --rm -v "$(pwd):/src" "$BASE_IMAGE_NAME" python setup.py sdist shell: bash - name: Publish From d7a5114668d7b38b801ac0b34ac5de14a0a6a1aa Mon Sep 17 00:00:00 2001 From: Adrien Perrin Date: Tue, 21 May 2024 08:37:33 +0000 Subject: [PATCH 3/6] fetch full git repository --- .github/workflows/tests_build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests_build.yml b/.github/workflows/tests_build.yml index 86acb94d..58821173 100644 --- a/.github/workflows/tests_build.yml +++ b/.github/workflows/tests_build.yml @@ -26,6 +26,8 @@ jobs: steps: - name: 'Checkout repository' uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -106,6 +108,8 @@ jobs: steps: - name: 'Checkout repository' uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Build package run: docker run --rm -v "$(pwd):/src" "$BASE_IMAGE_NAME" python setup.py sdist From b624c736e2ca12ff30f5cd3d5cb9ce7c037ef95c Mon Sep 17 00:00:00 2001 From: Adrien Perrin Date: Tue, 21 May 2024 08:48:59 +0000 Subject: [PATCH 4/6] use the whole git repository in the Dockerfile --- Dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index e380747b..f0130d35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,14 +5,12 @@ ARG BASE_IMAGE ARG NANSAT_RELEASE -COPY utilities /tmp/utilities -COPY nansat /tmp/nansat -COPY setup.py /tmp/ -WORKDIR /tmp +COPY . /tmp/nansat/ +WORKDIR /tmp/nansat RUN apt update \ && apt install -y --no-install-recommends g++ \ && pip install . \ -&& rm -rf /tmp/{utilities,nansat,setup.py} \ +&& rm -rf /tmp/nansat \ && apt autoremove -y \ && apt clean \ && rm -rf /var/lib/apt/lists/* From 7124856a787c5429fdd4f90bf080d15c5196140a Mon Sep 17 00:00:00 2001 From: Adrien Perrin Date: Tue, 21 May 2024 11:08:54 +0200 Subject: [PATCH 5/6] remove useless line in github actions --- .github/workflows/tests_build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests_build.yml b/.github/workflows/tests_build.yml index 58821173..75361925 100644 --- a/.github/workflows/tests_build.yml +++ b/.github/workflows/tests_build.yml @@ -82,7 +82,6 @@ jobs: context: . build-args: | BASE_IMAGE=${{ env.BASE_IMAGE_NAME }}:${{ env.BASE_IMAGE_TAG }}-python${{ matrix.python_version }} - NANSAT_RELEASE=${{ github.ref_type == 'tag' && github.ref_name || '0.0.0' }} push: ${{ github.ref_type == 'tag' }} tags: | ${{ env.IMAGE_NAME }}:${{ github.ref_name }}-python${{ matrix.python_version }} From 75ccf3d17cee566017ece43d4685f3b64174d15d Mon Sep 17 00:00:00 2001 From: Adrien Perrin Date: Tue, 21 May 2024 11:48:43 +0200 Subject: [PATCH 6/6] run actions workflow on pre-releases --- .github/workflows/tests_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_build.yml b/.github/workflows/tests_build.yml index 75361925..ef6a831a 100644 --- a/.github/workflows/tests_build.yml +++ b/.github/workflows/tests_build.yml @@ -4,7 +4,7 @@ on: push: branches: ['**'] release: - types: [released] + types: [prereleased, released] env: IMAGE_NAME: "${{ vars.DOCKER_ORG }}/nansat" BASE_IMAGE_NAME: "${{ vars.DOCKER_ORG }}/nansat_base"