ci: 调整测试ci
This commit is contained in:
11
.github/workflows/build.yml
vendored
11
.github/workflows/build.yml
vendored
@@ -1,6 +1,3 @@
|
|||||||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
||||||
|
|
||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -18,8 +15,8 @@ jobs:
|
|||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '12.x'
|
||||||
- run: npm install -g @angular/cli
|
- run: npm install
|
||||||
- run: bash build.sh
|
- run: npm run lint && npm run build:prod
|
||||||
|
|
||||||
- name: Upload a Build Artifact
|
- name: Upload a Build Artifact
|
||||||
uses: actions/upload-artifact@v2.1.4
|
uses: actions/upload-artifact@v2.1.4
|
||||||
@@ -27,8 +24,12 @@ jobs:
|
|||||||
name: dist
|
name: dist
|
||||||
path: ./dist/index/*
|
path: ./dist/index/*
|
||||||
|
|
||||||
|
- name: Package products
|
||||||
|
- run: cd dist/index/ && tar -cf index.tar ./* && cp index.tar ../../
|
||||||
|
|
||||||
- name: SCP
|
- name: SCP
|
||||||
uses: appleboy/scp-action@master
|
uses: appleboy/scp-action@master
|
||||||
|
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.SSH_HOST }}
|
host: ${{ secrets.SSH_HOST }}
|
||||||
username: ${{ secrets.SSH_USERNAME }}
|
username: ${{ secrets.SSH_USERNAME }}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: test
|
name: Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -16,5 +16,11 @@ jobs:
|
|||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '12.x'
|
||||||
- run: npm install -g @angular/cli
|
- run: npm install
|
||||||
- run: bash build.sh
|
- run: npm run lint && npm run build
|
||||||
|
|
||||||
|
- name: Upload a Build Artifact
|
||||||
|
uses: actions/upload-artifact@v2.1.4
|
||||||
|
with:
|
||||||
|
name: devDist
|
||||||
|
path: ./dist/index/*
|
||||||
40
build.sh
40
build.sh
@@ -1,40 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basePath=$(pwd)
|
|
||||||
|
|
||||||
$(hash node 2>/dev/null)
|
|
||||||
if ! [ $? ]; then
|
|
||||||
echo -e "\t\t请先安装nodejs -------> https://nodejs.org/"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo -e "\t\t nodejs\t\t $(node --version)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
$(hash npm 2>/dev/null)
|
|
||||||
if ! [ $? ]; then
|
|
||||||
echo -e "\t\t Can't find command npm"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo -e "\t\t npm\t\t $(npm --version)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
$(hash ng 2>/dev/null)
|
|
||||||
if ! [ $? ]; then
|
|
||||||
echo -e "\t\tinstall angular cli to build the project"
|
|
||||||
npm install -g @angular/cli
|
|
||||||
else
|
|
||||||
echo -e "\t\t angular-cli\t\t $(ng --version)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# index
|
|
||||||
echo -e "\t\tBuild for index page "
|
|
||||||
npm install && ng build --prod
|
|
||||||
|
|
||||||
cd ./dist/index/ && tar -cf index.tar ./* && cp index.tar $basePath
|
|
||||||
|
|
||||||
#cd "$basePath"
|
|
||||||
|
|
||||||
## admin
|
|
||||||
#echo -e "\t\tBuild for admin page "
|
|
||||||
#cd $basePath/admin && npm install && ng build --prod
|
|
||||||
#cd ./dist/admin/ && sed '6s/\"\/\"/\"\/admin\/\"/g' index.html > index.txt && cp index.txt index.html
|
|
||||||
# cd .. && tar -cf admin.tar ./admin/ && cp admin.tar $basePath
|
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
|
"build:prod": "ng build --prod",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "ng e2e"
|
"e2e": "ng e2e"
|
||||||
|
|||||||
Reference in New Issue
Block a user