54 lines
1.2 KiB
YAML
54 lines
1.2 KiB
YAML
name: Deployment
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- dev
|
|
|
|
env:
|
|
MONGODB_CLUSTER_ADDRESS: 127.0.0.1
|
|
MONGODB_USERNAME: mongo
|
|
MONGODB_PASSWORD: mongo
|
|
MONGODB_DB_NAME: mongo
|
|
PORT: 3216
|
|
|
|
jobs:
|
|
test:
|
|
environment: testing
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Get Code
|
|
uses: actions/checkout@v3
|
|
- name: Install NodeJS
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18'
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: '1.20'
|
|
- uses: actions/go-hashfiles@v0.0.1
|
|
id: get-cache-hash
|
|
with:
|
|
patterns: |-
|
|
**/package-lock.json
|
|
- name: Check Chache
|
|
uses: https://github.com/actions/cache@v3
|
|
with:
|
|
path: ~/.npm
|
|
key: deps-node-modules-${{ steps.get-cache-hash.outputs.hash }}
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
- name: Run server
|
|
run: npm start & npx wait-on http://127.0.0.1:$PORT
|
|
- name: Run tests
|
|
run: npm test
|
|
- name: Output information
|
|
run: echo "..."
|
|
deploy:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Output information
|
|
run: |
|
|
echo "..."
|