Skip to content

Commit

Permalink
All projects starts (#1)
Browse files Browse the repository at this point in the history
first version
  • Loading branch information
valentin-gauthier-geosiris authored Apr 4, 2024
1 parent ee692be commit 32b962c
Show file tree
Hide file tree
Showing 118 changed files with 550,574 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .github/actions/prepare-poetry/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
##
## Copyright (c) 2022-2023 Geosiris.
## SPDX-License-Identifier: Apache-2.0
##
---

name: Prepare Python and Poetry
Description: Install Python, Poetry and dev dependencies, cached for speed

inputs:
python-version:
description: 'Python version to use'
required: true
default: '3.x'

runs:
using: "composite"
steps:
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

- name: Load cached Poetry installation
uses: actions/cache@v4
with:
path: ~/.local # the path depends on the OS
key: poetry-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-4 # increment to reset cache

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: false

- name: Install Poetry Plugins
run: |
python -m pip install --upgrade pip
pip install poetry-dynamic-versioning
shell: bash
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-1

- name: Install dependencies and library
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction
shell: bash

- name: Install Poetry Plugins
run: poetry self add "poetry-dynamic-versioning[plugin]"
shell: bash
83 changes: 83 additions & 0 deletions .github/workflows/ci_energyml_utils_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
##
## Copyright (c) 2023-2024 Geosiris.
## SPDX-License-Identifier: Apache-2.0
##
---

name: Publish (pypiTest)

defaults:
run:
working-directory: energyml-utils

on:
push:
branches:
- main
pull_request:

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install poetry
uses: ./.github/actions/prepare-poetry
with:
python-version: 3.9

- name: Build
run: |
poetry build
- name: Display folder
shell: bash
if: always()
run: |
echo "::debug::listing folder"
ls -R
echo `ls -R`
echo "GITHUB_WORKSPACE ${{ github.workspace }}"
echo `ls GITHUB_WORKSPACE ${{ github.workspace }}`
- name: Save build artifacts
uses: actions/upload-artifact@v4
with:
name: Build-Artifact
if-no-files-found: error
path: ${{ github.workspace }}/energyml-utils/dist

publish:
name: Publish to PyPI
needs: [build]
runs-on: ubuntu-latest
steps:

# Retrieve the code and GIT history so that poetry-dynamic-versioning knows which version to upload
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get build artifacts
uses: actions/download-artifact@v4
with:
name: Build-Artifact
path: ${{ github.workspace }}/energyml-utils/dist

- name: Install poetry
uses: ./.github/actions/prepare-poetry
with:
python-version: 3.9

- name: Upload to PyPI TEST
run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi ${{ secrets.POETRY_PYPI_TEST_TOKEN_VALUE }}
poetry publish --repository test-pypi
76 changes: 76 additions & 0 deletions .github/workflows/ci_energyml_utils_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
##
## Copyright (c) 2023-2024 Geosiris.
## SPDX-License-Identifier: Apache-2.0
##
---

name: Publish release

on:
release:
types: [published]

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install poetry
uses: ./.github/actions/prepare-poetry
with:
python-version: 3.9

- name: Build
run: |
poetry build
- name: Display folder
shell: bash
if: always()
run: |
echo "::debug::listing folder"
ls -R
echo `ls -R`
echo "GITHUB_WORKSPACE ${{ github.workspace }}"
echo `ls GITHUB_WORKSPACE ${{ github.workspace }}`
- name: Save build artifacts
uses: actions/upload-artifact@v4
with:
name: Build-Artifact
if-no-files-found: error
path: ${{ github.workspace }}/energyml-utils/dist

publish:
name: Publish to PyPI
needs: [build]
runs-on: ubuntu-latest
steps:

# Retrieve the code and GIT history so that poetry-dynamic-versioning knows which version to upload
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get build artifacts
uses: actions/download-artifact@v4
with:
name: Build-Artifact
path: ${{ github.workspace }}/energyml-utils/dist

- name: Install poetry
uses: ./.github/actions/prepare-poetry
with:
python-version: 3.9

- name: Upload to PyPI
run: |
poetry config pypi-token.pypi ${{ secrets.POETRY_PYPI_TOKEN_PASSWORD }}
poetry publish
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# IDE settings
.idea
.vscode
*.sublime-project
*.sublime-workspace

# Checkpoints
.ipynb_checkpoints
__pycache__/
.pyc
*.pyo
.DS_Store

# Unit tests
pytest.xml
.pytest_cache
.coverage
htmlcov/

# Built Documentation
docs/_build
docs/_autosummary
docs/html

# Build artifacts
build
dist
*.egg-info
venv/

# Poetry
*.lock
*/dist/

# Dask
dask-worker-space

# Example for local test
example-local/
# utils/

# Other files
requirements.txt
#doc/
sample/
gen*/
manip*
zip/
*.epc
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2023 GEOSIRIS

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 32b962c

Please sign in to comment.