Skip to content

Commit

Permalink
Run image build and dispatch only on push event
Browse files Browse the repository at this point in the history
  • Loading branch information
MukuFlash03 committed Sep 30, 2024
1 parent 2c5d379 commit 9fff4bf
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 117 deletions.
61 changes: 31 additions & 30 deletions .github/workflows/image_build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
build:
runs-on: ubuntu-latest
needs: [test-with-docker, test-with-manual-install]
if: ${{ github.event_name == 'push' }}

outputs:
date: ${{ steps.date.outputs.date }}
Expand Down Expand Up @@ -112,33 +113,33 @@ jobs:
git push origin
fi
dispatch:
needs: build
runs-on: ubuntu-latest

strategy:
matrix:
include:
- repo: MukuFlash03/nrel-openpath-join-page
branch: cleanup-cicd
- repo: MukuFlash03/op-admin-dashboard
branch: cleanup-cicd
- repo: MukuFlash03/em-public-dashboard
branch: cleanup-cicd
# - repo: e-mission/op-admin-dashboard
# branch: master
# - repo: e-mission/em-public-dashboard
# branch: main

steps:
- uses: actions/checkout@v4

- name: Trigger workflow in admin-dash, public-dash
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_FG_PAT_TAGS }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ matrix.repo }}/actions/workflows/image_build_push.yml/dispatches \
-d '{"ref":"${{ matrix.branch }}"}'
# dispatch:
# needs: build
# runs-on: ubuntu-latest

# strategy:
# matrix:
# include:
# - repo: MukuFlash03/nrel-openpath-join-page
# branch: cleanup-cicd
# - repo: MukuFlash03/op-admin-dashboard
# branch: cleanup-cicd
# - repo: MukuFlash03/em-public-dashboard
# branch: cleanup-cicd
# # - repo: e-mission/op-admin-dashboard
# # branch: master
# # - repo: e-mission/em-public-dashboard
# # branch: main

# steps:
# - uses: actions/checkout@v4

# - name: Trigger workflow in admin-dash, public-dash
# run: |
# curl -L \
# -X POST \
# -H "Accept: application/vnd.github+json" \
# -H "Authorization: Bearer ${{ secrets.GH_FG_PAT_TAGS }}" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# https://api.github.com/repos/${{ matrix.repo }}/actions/workflows/image_build_push.yml/dispatches \
# -d '{"ref":"${{ matrix.branch }}"}'
57 changes: 29 additions & 28 deletions .github/workflows/test-with-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,37 @@ on:

workflow_call:

# jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - name: Run test-with-docker for 30 seconds
# run: |
# echo "Starting 30-second workflow"
# sleep 30
# echo "30-second workflow completed"

# - name: Success-Failure Test Case
# run: |
# echo "Test successful" && exit 0
# # echo "Test failed" && exit 1

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v2
- name: Run test-with-docker for 30 seconds
run: |
echo "Starting 30-second workflow"
sleep 30
echo "30-second workflow completed"
- name: Success-Failure Test Case
run: |
echo "Test successful" && exit 0
# echo "Test failed" && exit 1
# # A workflow run is made up of one or more jobs that can run sequentially or in parallel
# jobs:
# # This workflow contains a single job called "build"
# build:
# # The type of runner that the job will run on
# runs-on: ubuntu-latest

# # Steps represent a sequence of tasks that will be executed as part of the job
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - name: Checkout
# uses: actions/checkout@v2

- name: Make sure that the workflow works
run: echo Smoke test
# - name: Make sure that the workflow works
# run: echo Smoke test

- name: Run the tests using docker-compose
run: docker compose -f setup/docker-compose.tests.yml up --exit-code-from web-server
# - name: Run the tests using docker-compose
# run: docker compose -f setup/docker-compose.tests.yml up --exit-code-from web-server
118 changes: 59 additions & 59 deletions .github/workflows/test-with-manual-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,72 +19,72 @@ on:

workflow_call:

# jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - name: Run test-with-manual-install for 1 minute
# run: |
# echo "Starting 1-minute workflow"
# sleep 60
# echo "1-minute workflow completed"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Run test-with-manual-install for 1 minute
run: |
echo "Starting 1-minute workflow"
sleep 60
echo "1-minute workflow completed"
# - name: Success-Failure Test Case
# run: |
# echo "Test successful" && exit 0
# # echo "Test failed" && exit 1
- name: Success-Failure Test Case
run: |
echo "Test successful" && exit 0
# echo "Test failed" && exit 1
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
# # A workflow run is made up of one or more jobs that can run sequentially or in parallel
# jobs:
# # This workflow contains a single job called "build"
# build:
# # The type of runner that the job will run on
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# # Steps represent a sequence of tasks that will be executed as part of the job
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - uses: actions/checkout@v2

- name: Install and start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 4.4.0
# - name: Install and start MongoDB
# uses: supercharge/[email protected]
# with:
# mongodb-version: 4.4.0

- name: Check existing version of miniconda
shell: bash -l {0}
run: conda info -a
# - name: Check existing version of miniconda
# shell: bash -l {0}
# run: conda info -a

- name: Install miniconda
shell: bash -l {0}
run: |
source setup/setup_conda.sh Linux-x86_64
# - name: Install miniconda
# shell: bash -l {0}
# run: |
# source setup/setup_conda.sh Linux-x86_64

- name: Check whether the CI environment variable is set
shell: bash -l {0}
run: |
source setup/activate_conda.sh
echo $CI
# - name: Check whether the CI environment variable is set
# shell: bash -l {0}
# run: |
# source setup/activate_conda.sh
# echo $CI

- name: Setup the emission environment for testing
shell: bash -l {0}
run: |
conda --version
which conda
source setup/activate_conda.sh
conda --version
source setup/setup_tests.sh
# - name: Setup the emission environment for testing
# shell: bash -l {0}
# run: |
# conda --version
# which conda
# source setup/activate_conda.sh
# conda --version
# source setup/setup_tests.sh

- name: Switch to emission and run the tests
shell: bash -l {0}
run: |
source setup/activate_tests.sh
conda --version
./runAllTests.sh
# - name: Switch to emission and run the tests
# shell: bash -l {0}
# run: |
# source setup/activate_tests.sh
# conda --version
# ./runAllTests.sh

- name: Teardown the test environment
shell: bash -l {0}
run: source setup/teardown_tests.sh
# - name: Teardown the test environment
# shell: bash -l {0}
# run: source setup/teardown_tests.sh

0 comments on commit 9fff4bf

Please sign in to comment.