diff --git a/.devbox/virtenv/bin/initHook.sh b/.devbox/virtenv/bin/initHook.sh new file mode 120000 index 00000000..5ee70171 --- /dev/null +++ b/.devbox/virtenv/bin/initHook.sh @@ -0,0 +1 @@ +/home/deepak/Projects/devops-directive-github-actions-course/.devbox/virtenv/poetry/bin/initHook.sh \ No newline at end of file diff --git a/.devbox/virtenv/bin/venvShellHook.sh b/.devbox/virtenv/bin/venvShellHook.sh new file mode 120000 index 00000000..d0a8fdaf --- /dev/null +++ b/.devbox/virtenv/bin/venvShellHook.sh @@ -0,0 +1 @@ +/home/deepak/Projects/devops-directive-github-actions-course/.devbox/virtenv/python312/bin/venvShellHook.sh \ No newline at end of file diff --git a/.devbox/virtenv/poetry/bin/initHook.sh b/.devbox/virtenv/poetry/bin/initHook.sh new file mode 100755 index 00000000..e4a5a0ea --- /dev/null +++ b/.devbox/virtenv/poetry/bin/initHook.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +poetry env use $(command -v python) --directory="${DEVBOX_PYPROJECT_DIR:-$DEVBOX_DEFAULT_PYPROJECT_DIR}" --no-interaction --quiet >&2 diff --git a/.devbox/virtenv/python312/bin/venvShellHook.sh b/.devbox/virtenv/python312/bin/venvShellHook.sh new file mode 100755 index 00000000..84c5ab10 --- /dev/null +++ b/.devbox/virtenv/python312/bin/venvShellHook.sh @@ -0,0 +1,55 @@ +#!/bin/sh +set -eu +STATE_FILE="$DEVBOX_PROJECT_ROOT/.devbox/venv_check_completed" + +is_valid_venv() { + [ -f "$1/bin/activate" ] && [ -f "$1/bin/python" ] +} + +is_devbox_venv() { + [ "$1/bin/python" -ef "$DEVBOX_PACKAGES_DIR/bin/python" ] +} + +create_venv() { + python -m venv "$VENV_DIR" --clear + echo "*\n.*" >> "$VENV_DIR/.gitignore" +} + +# Check that Python version supports venv +if ! python -c 'import venv' 1> /dev/null 2> /dev/null; then + echo "WARNING: Python version must be > 3.3 to create a virtual environment." + touch "$STATE_FILE" + exit 1 +fi + +# Check if the directory exists +if [ -d "$VENV_DIR" ]; then + if is_valid_venv "$VENV_DIR"; then + # Check if we've already run this script + if [ -f "$STATE_FILE" ]; then + # "We've already run this script. Exiting..." + exit 0 + fi + if ! is_devbox_venv "$VENV_DIR"; then + echo "WARNING: Virtual environment at $VENV_DIR doesn't use Devbox Python." + echo "Do you want to overwrite it? (y/n)" + read reply + echo + case "$reply" in + [Yy]) echo "Overwriting existing virtual environment..." + create_venv ;; + [Nn]) echo "Using your existing virtual environment. We recommend changing \$VENV_DIR to a different location" + touch "$STATE_FILE" + exit 0 ;; + *) echo "Invalid input. Exiting..." + exit 1 ;; + esac + fi + else + echo "Directory exists but is not a valid virtual environment. Creating a new one..." + create_venv + fi +else + echo "Virtual environment directory doesn't exist. Creating new one..." + create_venv +fi diff --git a/.github/workflows/03-core-features--02-step-types.yaml b/.github/workflows/03-core-features--02-step-types.yaml index 8abea6b1..3fc70b46 100644 --- a/.github/workflows/03-core-features--02-step-types.yaml +++ b/.github/workflows/03-core-features--02-step-types.yaml @@ -7,12 +7,12 @@ jobs: say-hello-inline-bash: runs-on: ubuntu-24.04 steps: - - run: echo "Hello from an inline bash script in a GitHub Action Workflow!" + - run: echo "Hello from an inline bash script in a GitHub Action Workflow! By Deepak" say-hello-inline-python: runs-on: ubuntu-24.04 steps: - - run: print("Hello from an inline python script in a GitHub Action Workflow!") + - run: print("Hello from an inline python script in a GitHub Action Workflow! By Deepak") shell: python say-hello-action: @@ -21,4 +21,4 @@ jobs: - uses: actions/hello-world-javascript-action@081a6d193d1dcb38460df1e6927486d748730f9d # v1.1 # - uses: actions/hello-world-javascript-action@v1 # This would work, but it would be less stable and less secure: with: - who-to-greet: "from an action in the GitHub Action marketplace! 👋" + who-to-greet: "from an action in the GitHub Action marketplace! 👋 By Marian" \ No newline at end of file diff --git a/.github/workflows/03-core-features--03-workflows-jobs-steps.yaml b/.github/workflows/03-core-features--03-workflows-jobs-steps.yaml index cbb562c0..c4cc02da 100644 --- a/.github/workflows/03-core-features--03-workflows-jobs-steps.yaml +++ b/.github/workflows/03-core-features--03-workflows-jobs-steps.yaml @@ -5,11 +5,14 @@ on: jobs: job-1: runs-on: ubuntu-24.04 + needs: + - job-5 # a new job to explore the realtion and working of the jobs in a workflow steps: - run: echo "A job consists of" - run: echo "one or more steps" - run: echo "which run sequentially" - run: echo "within the same compute environment" + - run: echo "And now I am adding a few lines of my own here to know and get familiarized with the operations" job-2: runs-on: ubuntu-24.04 steps: @@ -19,6 +22,7 @@ jobs: needs: - job-1 - job-2 + - job-5 # a new job to explore the realtion and working of the jobs in a workflow steps: - run: echo "They can also depend on one another..." job-4: @@ -28,3 +32,16 @@ jobs: - job-3 steps: - run: echo "...to form a directed acyclic graph (DAG)" + +# By Deepak + job-5: + runs-on: ubuntu-24.04 + steps: + - run: echo "This is a new job that I have added to this workflow which is independent of the other jobs and can run in parallel with them." + - run: echo "This is a second step in the new job of this workflow" + +# By Deepak + job-6: + runs-on: ubuntu-24.04 + steps: + - run: echo "This job is independent of all and runs in parallel with all the other jobs in this workflow" \ No newline at end of file diff --git a/.github/workflows/03-core-features--04-triggers-and-filters.yaml b/.github/workflows/03-core-features--04-triggers-and-filters.yaml index d5d72d3b..4958f0f4 100644 --- a/.github/workflows/03-core-features--04-triggers-and-filters.yaml +++ b/.github/workflows/03-core-features--04-triggers-and-filters.yaml @@ -23,8 +23,8 @@ on: - "!03-core-features/filters/*.txt" ### https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule - # schedule: - # - cron: "0 0 * * *" # Midnight UTC + schedule: + - cron: "0 0 * * *" # Midnight UTC ## Manual Trigger workflow_dispatch: