From a79a91e771527fcbc9847de41e49043f4c2d18ac Mon Sep 17 00:00:00 2001 From: Roi Driscoll Date: Fri, 17 Nov 2023 17:26:31 +0100 Subject: [PATCH 1/5] Adds workflow for tests --- .github/workflows/test.yml | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..4eace56c9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,40 @@ +# The name of the workflow +# Testing new branch +name: Build and Test + +# This workflow will run on any push to the repository +on: + push: + branches: + - test + +jobs: + test: + # Similar to docker, we set up a virtual machine to run our tests + runs-on: ubuntu-latest + + steps: + # Each step has a name, some code, and some options + - name: Checkout Repository + uses: actions/checkout@v4 # This is a reference to some code to run + + # This step installs the Node version we want + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + # This step installs pip, pipenv, and our dependencies + - name: Install Dependencies + run: npm install + + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.10.0 + with: + mongodb-version: 5.0 + + # Now we run our tests + - name: Test with Jest, Cypress + uses: cypress-io/github-action@v6 + with: + start: npm run start:test From e83821d0a6183a6ac86054ad9557ef78d7aff50f Mon Sep 17 00:00:00 2001 From: Roi Driscoll Date: Fri, 17 Nov 2023 17:28:30 +0100 Subject: [PATCH 2/5] Updates branch name --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4eace56c9..9f0383028 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ name: Build and Test on: push: branches: - - test + - ci-workflow-testing jobs: test: From e8f596b6b5cd35942079257ed57e56c9a048b36d Mon Sep 17 00:00:00 2001 From: Roi Driscoll Date: Fri, 17 Nov 2023 17:42:02 +0100 Subject: [PATCH 3/5] Comments out workflow stages to test branch --- .github/workflows/test.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9f0383028..c47caf644 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,23 +18,23 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 # This is a reference to some code to run - # This step installs the Node version we want - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 + # # This step installs the Node version we want + # - name: Setup Node.js + # uses: actions/setup-node@v3 + # with: + # node-version: 18 - # This step installs pip, pipenv, and our dependencies - - name: Install Dependencies - run: npm install + # # This step installs pip, pipenv, and our dependencies + # - name: Install Dependencies + # run: npm install - - name: Start MongoDB - uses: supercharge/mongodb-github-action@1.10.0 - with: - mongodb-version: 5.0 + # - name: Start MongoDB + # uses: supercharge/mongodb-github-action@1.10.0 + # with: + # mongodb-version: 5.0 - # Now we run our tests - - name: Test with Jest, Cypress - uses: cypress-io/github-action@v6 - with: - start: npm run start:test + # # Now we run our tests + # - name: Test with Jest, Cypress + # uses: cypress-io/github-action@v6 + # with: + # start: npm run start:test From 61b54ec64a1b6a399d89fcf4bddd57cd678e793b Mon Sep 17 00:00:00 2001 From: Roi Driscoll Date: Fri, 17 Nov 2023 17:44:32 +0100 Subject: [PATCH 4/5] Removes branch restrictions --- .github/workflows/test.yml | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c47caf644..4c3c708f3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,8 +5,6 @@ name: Build and Test # This workflow will run on any push to the repository on: push: - branches: - - ci-workflow-testing jobs: test: @@ -18,23 +16,23 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 # This is a reference to some code to run - # # This step installs the Node version we want - # - name: Setup Node.js - # uses: actions/setup-node@v3 - # with: - # node-version: 18 + # This step installs the Node version we want + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 - # # This step installs pip, pipenv, and our dependencies - # - name: Install Dependencies - # run: npm install + # This step installs pip, pipenv, and our dependencies + - name: Install Dependencies + run: npm install - # - name: Start MongoDB - # uses: supercharge/mongodb-github-action@1.10.0 - # with: - # mongodb-version: 5.0 + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.10.0 + with: + mongodb-version: 5.0 - # # Now we run our tests - # - name: Test with Jest, Cypress - # uses: cypress-io/github-action@v6 - # with: - # start: npm run start:test + # Now we run our tests + - name: Test with Jest, Cypress + uses: cypress-io/github-action@v6 + with: + start: npm run start:test From aec252988cecaf3c13498dfa21d8c7c9b210a18e Mon Sep 17 00:00:00 2001 From: Roi Driscoll Date: Mon, 20 Nov 2023 12:53:12 +0100 Subject: [PATCH 5/5] Refactors build & test into callable separate module --- .../{test.yml => build-and-test-workflow.yml} | 17 +++++++++++++---- .github/workflows/on-push.yml | 10 ++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) rename .github/workflows/{test.yml => build-and-test-workflow.yml} (71%) create mode 100644 .github/workflows/on-push.yml diff --git a/.github/workflows/test.yml b/.github/workflows/build-and-test-workflow.yml similarity index 71% rename from .github/workflows/test.yml rename to .github/workflows/build-and-test-workflow.yml index 4c3c708f3..d5ae49bfb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -1,12 +1,21 @@ -# The name of the workflow -# Testing new branch name: Build and Test -# This workflow will run on any push to the repository on: - push: + workflow_call: + inputs: + username: + description: 'A username passed from the caller workflow' + default: 'some software dev' + required: false + type: string jobs: + print-username: + runs-on: ubuntu-latest + + steps: + - name: Print the input name to STDOUT + run: echo The username is ${{ inputs.username }} test: # Similar to docker, we set up a virtual machine to run our tests runs-on: ubuntu-latest diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml new file mode 100644 index 000000000..6bf9a79d2 --- /dev/null +++ b/.github/workflows/on-push.yml @@ -0,0 +1,10 @@ +name: Run Build & Test + +on: + push: + +jobs: + run-build-and-test: + uses: ./.github/workflows/build-and-test-workflow.yml + +