update workflow : merge 2 workflow to single setup env workflow
This commit is contained in:
parent
80f70ca873
commit
8904adef8a
99
.gitea/workflows/init_setup_environment.yml
Normal file
99
.gitea/workflows/init_setup_environment.yml
Normal file
@ -0,0 +1,99 @@
|
||||
name: Setup Native Action
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
native:
|
||||
if: contains(github.event.head_commit.message, '@native')
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DB_USER: ${{ secrets.DB_USER }}
|
||||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
||||
DB_SERVER: ${{ vars.DB_SERVER }}
|
||||
DB_PORT: ${{ vars.DB_PORT }}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.12.7]
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref_name }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Create Python virtual environment
|
||||
run: python -m venv venv
|
||||
|
||||
- name: Activate virtual environment and install dependencies
|
||||
run: make install
|
||||
|
||||
- name: Generate Config
|
||||
run: make gen_config
|
||||
|
||||
- name: Run Tests
|
||||
run: make run_test
|
||||
|
||||
docker:
|
||||
if: contains(github.event.head_commit.message, '@docker')
|
||||
needs: [native]
|
||||
runs-on: host
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.12.7]
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref_name }}
|
||||
|
||||
- name: Create Python virtual environment
|
||||
run: python -m venv venv
|
||||
|
||||
- name: Activate virtual environment and install dependencies
|
||||
run: make install
|
||||
|
||||
- name: Update Tag
|
||||
run: make update_tag CURR_BRANCH=${{ github.ref_name }}
|
||||
|
||||
- name: Stop Server Docker
|
||||
run: make stop_server_docker
|
||||
|
||||
- name: Generate Config
|
||||
run: make gen_config_docker
|
||||
|
||||
- name: Build Image
|
||||
run: make build_image
|
||||
|
||||
- name: Start Server
|
||||
run: make run_server_docker
|
||||
|
||||
- name: Sleep for 10 seconds
|
||||
run: sleep 10s
|
||||
|
||||
- name: Restore Database
|
||||
run: make restore_database
|
||||
|
||||
- name: Run Tests
|
||||
if: contains(github.event.head_commit.message, '@run_test')
|
||||
run: make run_test_docker
|
||||
|
||||
- name: Login Docker hub
|
||||
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin ${{ secrets.DOCKER_HUB }}
|
||||
|
||||
- name: Push Image
|
||||
if: contains(github.event.head_commit.message, '@push_image')
|
||||
run: make push_image
|
||||
|
||||
- name: Logout Docker hub
|
||||
run: docker logout ${{ secrets.DOCKER_HUB }}
|
||||
|
||||
- name: Clean Up
|
||||
if: "!contains(github.event.head_commit.message, '@no_cleanup')"
|
||||
run: make clean_up
|
@ -1,86 +0,0 @@
|
||||
name: Setup Docker Action
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
setup_docker:
|
||||
if: contains(github.event.head_commit.message, '@docker')
|
||||
runs-on: host
|
||||
strategy:
|
||||
matrix:
|
||||
python:
|
||||
- 3.12.7
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref_name }}
|
||||
- name: Clean up Virtual Environment
|
||||
run: ./setup/clean_up_virtualenvs.sh 0
|
||||
|
||||
- name: Create Virtual Environment
|
||||
run: |
|
||||
export PATH="$HOME/.pyenv/bin:$PATH"
|
||||
eval "$(pyenv init --path)"
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
pyenv virtualenv ${{ matrix.python }} "${{ github.ref_name }}-$(git rev-parse --short "$GITHUB_SHA")"
|
||||
|
||||
- name: Activate Virtual Environment
|
||||
run: |
|
||||
export PATH="$HOME/.pyenv/bin:$PATH"
|
||||
eval "$(pyenv init --path)"
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
pyenv activate "${{ github.ref_name }}-$(git rev-parse --short "$GITHUB_SHA")"
|
||||
|
||||
- name: Install dotenv
|
||||
run: |
|
||||
export PATH="$HOME/.pyenv/bin:$PATH"
|
||||
eval "$(pyenv init --path)"
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
pyenv activate "${{ github.ref_name }}-$(git rev-parse --short "$GITHUB_SHA")"
|
||||
pip install python-dotenv
|
||||
|
||||
- name: Update Tag
|
||||
run: make update_tag CURR_BRANCH=${{ github.ref_name }}
|
||||
|
||||
- name: Stop Server Docker
|
||||
run: make stop_server_docker
|
||||
|
||||
- name: Generate Config
|
||||
run: |
|
||||
export PATH="$HOME/.pyenv/bin:$PATH"
|
||||
eval "$(pyenv init --path)"
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
pyenv activate "${{ github.ref_name }}-$(git rev-parse --short "$GITHUB_SHA")"
|
||||
make gen_config_docker
|
||||
|
||||
- name: Build Image
|
||||
run: make build_image
|
||||
|
||||
- name: Start Server
|
||||
run: make run_server_docker
|
||||
- name: Sleep for 10 seconds
|
||||
run: sleep 10s
|
||||
|
||||
- name: Restore Database
|
||||
run: make restore_database
|
||||
|
||||
- name: Run Tests
|
||||
if: contains(github.event.head_commit.message, '@run_test')
|
||||
run: make run_test_docker
|
||||
|
||||
- name: Login Docker hub
|
||||
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin ${{ secrets.DOCKER_HUB }}
|
||||
- name: Push Image
|
||||
if: contains(github.event.head_commit.message, '@push_image')
|
||||
run: make push_image
|
||||
- name: Logout Docker hub
|
||||
run: docker logout ${{ secrets.DOCKER_HUB }}
|
||||
- name: Clean Up
|
||||
if: "!contains(github.event.head_commit.message, '@no_cleanup')"
|
||||
run: make clean_up
|
@ -1,41 +0,0 @@
|
||||
name: Setup Native Action
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
setup_native:
|
||||
if: contains(github.event.head_commit.message, '@native')
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DB_USER: ${{ secrets.DB_USER }}
|
||||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
||||
DB_SERVER: ${{ vars.DB_SERVER }}
|
||||
DB_PORT: ${{ vars.DB_PORT }}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.12.7]
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref_name }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Create Python virtual environment
|
||||
run: python -m venv venv
|
||||
|
||||
- name: Activate virtual environment and install dependencies
|
||||
run: make install
|
||||
|
||||
- name: Generate Config
|
||||
run: make gen_config
|
||||
|
||||
- name: Run Tests
|
||||
run: make run_test
|
Loading…
Reference in New Issue
Block a user