Skip to content

Commit

Permalink
Merge pull request #525 from oceansize/refactor-test-workflow
Browse files Browse the repository at this point in the history
Refactor test workflow
  • Loading branch information
oceansize committed Nov 20, 2023
2 parents c3c66ed + aec2529 commit 6356fe2
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build-and-test-workflow.yml
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
10 changes: 10 additions & 0 deletions .github/workflows/on-push.yml
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


0 comments on commit 6356fe2

Please sign in to comment.