From 0edb95be8040c988428daf50ebb8137460fd7e11 Mon Sep 17 00:00:00 2001 From: Wolfgang Preimesberger Date: Fri, 11 Oct 2024 15:07:18 +0200 Subject: [PATCH 1/5] Add docker build --- .github/workflows/build.yml | 50 +++++++++++++++++++++++++++++++++--- .github/workflows/docker.yml | 45 -------------------------------- 2 files changed, 46 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45fbaf3..b559828 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,8 +21,8 @@ jobs: include: - os: "ubuntu-latest" python-version: '3.8' # first supported -# - os: "windows-latest" -# python-version: '3.8' # first supported + - os: "windows-latest" + python-version: '3.8' # first supported - os: "ubuntu-latest" python-version: '3.12' # latest supported - os: "windows-latest" @@ -89,6 +89,7 @@ jobs: python setup.py sdist --dist-dir artifacts/dist fi ls artifacts/dist + coveralls: name: Submit Coveralls 👚 needs: build @@ -100,8 +101,10 @@ jobs: pip3 install --upgrade coveralls && coveralls --service=github --finish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - publish: + + publish-pypi-package: name: Upload to PyPI 🚀 + # Will only trigger when the Tests have passed, and this is a release / tag branch from the TUW-GEO repository if: startsWith(github.ref, 'refs/tags/v') && startsWith(github.repository, 'TUW-GEO') needs: build runs-on: ubuntu-latest @@ -126,4 +129,43 @@ jobs: verify_metadata: true packages_dir: Artifacts/dist/ user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} # this needs to be uploaded to github actions secrets \ No newline at end of file + password: ${{ secrets.PYPI_API_TOKEN }} # this needs to be uploaded to github actions secrets + + publish-docker-image: + name: Upload to Container Registry 📦 + # Will only trigger when the Tests have passed, and this is a release / tag branch from the TUW-GEO repository + if: startsWith(github.ref, 'refs/tags/v') && startsWith(github.repository, 'TUW-GEO') + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index c3f2bc0..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Create and publish a Docker image -on: - workflow_dispatch: # can be trigger manually (tag: ) - push: # ... or on version tags / release (tag: , "latest") - tags: - - 'v*' -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - attestations: write - id-token: write - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Build and push Docker image - id: push - uses: docker/build-push-action@v6 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v1 - with: - subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} - subject-digest: ${{ steps.push.outputs.digest }} - push-to-registry: true \ No newline at end of file From 8c2b73b630276d3cdf2f5ee65c2ca1aacbd3a376 Mon Sep 17 00:00:00 2001 From: Wolfgang Preimesberger Date: Fri, 11 Oct 2024 15:16:16 +0200 Subject: [PATCH 2/5] Update workflow --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b559828..9142db7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: - os: "ubuntu-latest" python-version: '3.8' # first supported - os: "windows-latest" - python-version: '3.8' # first supported + python-version: '3.10' # first supported - os: "ubuntu-latest" python-version: '3.12' # latest supported - os: "windows-latest" @@ -90,7 +90,7 @@ jobs: fi ls artifacts/dist - coveralls: + publish-coverage: name: Submit Coveralls 👚 needs: build runs-on: ubuntu-latest @@ -135,6 +135,7 @@ jobs: name: Upload to Container Registry 📦 # Will only trigger when the Tests have passed, and this is a release / tag branch from the TUW-GEO repository if: startsWith(github.ref, 'refs/tags/v') && startsWith(github.repository, 'TUW-GEO') + needs: build runs-on: ubuntu-latest permissions: contents: read From cee6cad7e4cbfc9dfd11f279dcb2ee53035f2d44 Mon Sep 17 00:00:00 2001 From: Wolfgang Preimesberger Date: Fri, 11 Oct 2024 15:17:58 +0200 Subject: [PATCH 3/5] Update workflow --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9142db7..e3f808c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ on: jobs: build: - name: py${{ matrix.python-version }} @ ${{ matrix.os }} + name: py${{ matrix.python-version }}@${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -91,7 +91,7 @@ jobs: ls artifacts/dist publish-coverage: - name: Submit Coveralls 👚 + name: Publish Coverage 👚 needs: build runs-on: ubuntu-latest container: python:3-slim @@ -103,7 +103,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} publish-pypi-package: - name: Upload to PyPI 🚀 + name: Publish PyPI 🚀 # Will only trigger when the Tests have passed, and this is a release / tag branch from the TUW-GEO repository if: startsWith(github.ref, 'refs/tags/v') && startsWith(github.repository, 'TUW-GEO') needs: build @@ -132,7 +132,7 @@ jobs: password: ${{ secrets.PYPI_API_TOKEN }} # this needs to be uploaded to github actions secrets publish-docker-image: - name: Upload to Container Registry 📦 + name: Publish Docker 📦 # Will only trigger when the Tests have passed, and this is a release / tag branch from the TUW-GEO repository if: startsWith(github.ref, 'refs/tags/v') && startsWith(github.repository, 'TUW-GEO') needs: build From 1d76c330921d09cea5f90d55c0e441e215e83ab1 Mon Sep 17 00:00:00 2001 From: Wolfgang Preimesberger Date: Fri, 11 Oct 2024 15:24:03 +0200 Subject: [PATCH 4/5] Update dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6a000a3..52589fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,6 @@ RUN micromamba install -y -n base -f /app/environment.yml && pip install /app/. RUN micromamba clean --all --yes # Clean up the src code, as it is installed now -RUN rm -rf smos +RUN rm -rf /app ENTRYPOINT ["/usr/local/bin/_entrypoint.sh"] \ No newline at end of file From fa9172897056a118a574169b2bb337e3e70922f9 Mon Sep 17 00:00:00 2001 From: Wolfgang Preimesberger Date: Fri, 11 Oct 2024 15:36:17 +0200 Subject: [PATCH 5/5] Update README --- .github/workflows/build.yml | 2 -- README.rst | 9 +++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3f808c..e57cff5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,8 +21,6 @@ jobs: include: - os: "ubuntu-latest" python-version: '3.8' # first supported - - os: "windows-latest" - python-version: '3.10' # first supported - os: "ubuntu-latest" python-version: '3.12' # latest supported - os: "windows-latest" diff --git a/README.rst b/README.rst index b0114ec..2444bb3 100644 --- a/README.rst +++ b/README.rst @@ -38,7 +38,8 @@ Before installing this package via pip, please install the necessary .. code:: - $ conda install -c conda-forge netcdf4 pyresample + $ conda create -n smos python=3.12 + $ conda env update -f environment.yml -n smos Then @@ -86,9 +87,9 @@ Supported Products Currently the following products are supported, additional products can be added. -- `SMOS IC `_: SMOS INRA-CESBIO (SMOS-IC) 25km -- `SMOS L4 RZSM `_: SMOS CATDS-CESBIO (SMOS L4 RZSM) 25km -- SMOS L2 +- `SMOS IC `_: SMOS INRA-CESBIO (SMOS-IC) 25 km +- `SMOS L4 RZSM `_: SMOS CATDS-CESBIO (SMOS L4 RZSM) 25 km +- `SMOS L2 Science Product `_: SMOS L2 Science Products (MIR_SMUDP2) 25 km - SMOS L3 Build Docker image