-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* upDate clean main * Cleaned TODO add img * update requirements * update CI.yml * update read previous version * fix 1 * fix 2 * fix3 * fix4 * fix6 * fix7 * fix8 * fix9 * fix10 * fix11 * fix12 * fix 13 * fix14 * fix15 * fix 16 * fix17 * img added * fix colors * fix colors2 * deploy on GH page --------- Co-authored-by: Esteban Lascourreges <esteban.lascourreges@corpowerocean.com>
- Loading branch information
1 parent
4261927
commit 48b1c29
Showing
20 changed files
with
2,949 additions
and
1,371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: CI/CD Realase Candidate | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- RC | ||
|
||
jobs: | ||
test-Realease-Candidate: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: check origin | ||
run: | | ||
echo "origin= $(git remote get-url origin)" | ||
echo "origin= $(git ls-remote origin)" | ||
- name: update pip | ||
run: python -m pip install --upgrade pip | ||
|
||
- name: Install Dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Uvicorn Run for Test | ||
run: | | ||
uvicorn ThroneAPI:app --host 0.0.0.0 --port 8000 --reload & echo $! > uvicorn_pid | ||
- name: Get Current Version | ||
id: get_current_version | ||
run: echo "CURRENT_VERSION=$(curl http://localhost:8000/version)" >> $GITHUB_ENV | ||
|
||
- name: Get Previous Version | ||
id: get_previous_version | ||
run: | | ||
git fetch origin RC | ||
git checkout RC | ||
version=$(git show origin/RC:ThroneAPI.py | grep -oP "API_VERSION = \"\K[0-9.]+" ThroneAPI.py || echo "0.0.0") | ||
echo "Version: $version" | ||
echo "PREVIOUS_VERSION=$version" >> $GITHUB_ENV | ||
- name: Compare Versions | ||
id: compare_versions | ||
run: | | ||
pip install semantic_version | ||
current_version=${{ env.CURRENT_VERSION }} | ||
previous_version=${{ env.PREVIOUS_VERSION }} | ||
echo "Current Version: $current_version" | ||
echo "Previous Version: $previous_version" | ||
python -c "from semantic_version import Version; import sys; sys.exit(0 if Version('${{ env.CURRENT_VERSION }}') > Version('${{ env.PREVIOUS_VERSION }}') else 1)" | ||
- name: Check Version Comparison Result | ||
run: | | ||
if [ ${{ steps.compare_versions.outcome }} == "failure" ]; then | ||
echo "Error: Current version is not superior to the previous version." | ||
exit 1 | ||
fi | ||
- name: Test Throne data | ||
run: | | ||
test_result=$(curl http://localhost:8000/test?username=lordlumineer&display_currency=eur) # Perform a request to /test | ||
if [ "$test_result" == "false" ]; then | ||
echo "Test failed: /test returned false" | ||
exit 1 | ||
fi | ||
- name: End Uvicorn Run | ||
run: | | ||
uvicorn_pid=$(cat uvicorn_pid) | ||
kill $uvicorn_pid || true # Kill the Uvicorn process if it's still running, ignore errors | ||
- name: Test Docker Build | ||
run: | | ||
docker-compose build | ||
- name: Test Docker Up | ||
run: | | ||
docker-compose up -d | ||
sleep 5 | ||
- name: Test Docker | ||
run: | | ||
test_result=$(curl http://localhost:8000/test?username=lordlumineer) # Perform a request to /test | ||
if [ "$test_result" == "false" ]; then | ||
echo "Test failed: /test returned false" | ||
exit 1 | ||
fi | ||
- name: Stop Docker | ||
run: | | ||
docker-compose down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Deploy on GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: [ "latest" ] | ||
|
||
jobs: | ||
deploy-github-pages: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: update pip | ||
run: python -m pip install --upgrade pip | ||
|
||
- name: Install Dependencies | ||
run: pip install -r requirements.txt | ||
|
||
- name: Uvicorn Run for Test | ||
run: uvicorn ThroneAPI:app --port 8000 --reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Publish Docker Image on Release Candidate | ||
|
||
on: | ||
push: | ||
branches: | ||
- RC | ||
|
||
jobs: | ||
publish-Release-Candidate: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get Version | ||
id: get_version | ||
run: | | ||
version=$(grep -oP "API_VERSION = \"\K[0-9.]+" ThroneAPI.py || echo "0.0.0") | ||
echo "Version: $version" | ||
echo "$version" > version | ||
- name: Login to DockerHub | ||
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | ||
|
||
- name: Build and Push Docker Image | ||
run: | | ||
version=$(cat version) | ||
docker build -t lordlumineer/throne-api:RC-${version} . | ||
docker push lordlumineer/throne-api:RC-${version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.