[英]Running a Node.js API in Github Actions
I have a Monorepo which contains a front-end app and a node.js API.我有一个 Monorepo,其中包含一个前端应用程序和一个 node.js API。 I would like to run both the front-end app and the node.js API, in order to run some end-to-end tests.我想同时运行前端应用程序和 node.js API,以便运行一些端到端测试。 However I can not figure out how to run these two applications before running the tests.但是,在运行测试之前,我无法弄清楚如何运行这两个应用程序。 Here is my actions file so far.到目前为止,这是我的操作文件。
name: Test Client
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Initial Setup
run: |
npm install yarn -g
- name: yarn install, build, and test
working-directory: client-app
run: |
yarn install
yarn build
yarn test
env:
CI: true
I would like to run an API in a different directory, before running the client-app tests.在运行客户端应用程序测试之前,我想在不同的目录中运行 API。 Is this possible without using a third-party service?在不使用第三方服务的情况下这可能吗?
You can ensure the pipeline does not hang on a command by adding "&" to the end of the command: see: https://github.community/t5/GitHub-Actions/How-do-I-run-commands-concurrently/td-p/36057您可以通过在命令末尾添加“&”来确保管道不会挂在命令上:请参阅: https : //github.community/t5/GitHub-Actions/How-do-I-run-commands-concurrently /td-p/36057
For example now I can do:例如现在我可以这样做:
yarn start-api &
yarn start-client &
yarn test
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.