ci: 调整测试ci

This commit is contained in:
禾几海
2020-10-08 11:22:47 +08:00
parent 23aec69b4f
commit 1d994d16b1
4 changed files with 16 additions and 48 deletions

View File

@@ -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
on:
@@ -18,8 +15,8 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install -g @angular/cli
- run: bash build.sh
- run: npm install
- run: npm run lint && npm run build:prod
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.1.4
@@ -27,8 +24,12 @@ jobs:
name: dist
path: ./dist/index/*
- name: Package products
- run: cd dist/index/ && tar -cf index.tar ./* && cp index.tar ../../
- name: SCP
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}

View File

@@ -1,4 +1,4 @@
name: test
name: Test
on:
push:
@@ -16,5 +16,11 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install -g @angular/cli
- run: bash build.sh
- run: npm install
- 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/*

View File

@@ -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

View File

@@ -5,6 +5,7 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build:prod": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"