-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #525 from oceansize/refactor-test-workflow
Refactor test workflow
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 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,47 @@ | ||
name: Build and Test | ||
|
||
on: | ||
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 | ||
|
||
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 |
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,10 @@ | ||
name: Run Build & Test | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
run-build-and-test: | ||
uses: ./.github/workflows/build-and-test-workflow.yml | ||
|
||
|