From 9da562c11335b2608f6bf240f216e5702ae7d6df Mon Sep 17 00:00:00 2001 From: Granty1 Date: Fri, 10 Apr 2020 09:18:14 +0800 Subject: [PATCH] Add build test ci script --- .../workflows/{go.yml => backend_deploy.yml} | 29 +++++--- .github/workflows/build_test.yml | 66 +++++++++++++++++++ 2 files changed, 87 insertions(+), 8 deletions(-) rename .github/workflows/{go.yml => backend_deploy.yml} (71%) create mode 100644 .github/workflows/build_test.yml diff --git a/.github/workflows/go.yml b/.github/workflows/backend_deploy.yml similarity index 71% rename from .github/workflows/go.yml rename to .github/workflows/backend_deploy.yml index ad4797a5..23c42806 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/backend_deploy.yml @@ -1,8 +1,21 @@ -name: gin-vue-admin-backend ci&cd +name: gin-vue-admin backend deploy on: push: - branches: [ action-ci ] + branches: + - master + - action-ci + paths: + - './server/**' + paths-ignore: + - './db/**' + pull_request: + branches: + - master + paths: + - './server/**' + paths-ignore: + - './db/**' jobs: @@ -30,8 +43,7 @@ jobs: - name: Build run: | - su root -p $ROOT_PASS - go build -o /usr/local/projects/gin-vue/run -v + go build -o run -v working-directory: ./server - name: Modify config params @@ -43,9 +55,10 @@ jobs: sed -i 's/%{redis_password}/'$REDIS_PASSWORD'/' config.yaml working-directory: ./server - - name: Move config file - run: | - su root -p $ROOT_PASS - mv ./config.yaml /usr/local/projects/gin-vue/config.yaml + deploy: + - name: Run Dockerfile + run: | + echo 'There is nothing for the time being' working-directory: ./server + diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml new file mode 100644 index 00000000..0122c207 --- /dev/null +++ b/.github/workflows/build_test.yml @@ -0,0 +1,66 @@ +name: gin-vue-admin build test + +on: + push: + branches: + - '*' + paths-ignore: + - './db/**' + pull_request: + branches: + - '*' + paths-ignore: + - './db/**' + - '**.md' + +jobs: + frontend: + name: Frontend build + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x] + steps: + + - name: Check out branch + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: | + npm install + npm run build + working-directory: ./web + env: + CI: true + + + backend: + name: Backend build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + + - name: Check out branch + uses: actions/checkout@v2 + + - name: Download dependencies + run: | + go get -v -t -d ./... + if [ -f Gopkg.toml ]; then + curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + dep ensure + fi + working-directory: ./server + + - name: Test and Build + run: | + go build -v -race + working-directory: ./server \ No newline at end of file