-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (105 loc) · 3.48 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright 2020 大明二代
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 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: Express Postgres Ts Starter CI Workflow
on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
env:
REGISTRY_NAME: github.com
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [20.x]
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install yarn
run: npm install -g yarn
- name: Install 3rd library
run: yarn
- name: Lint check
if: matrix.os == 'ubuntu-latest'
run: yarn lint
- name: Build check
run: yarn build
- name: Test check
if: matrix.os == 'ubuntu-latest'
run: yarn test:ci
build-muilt-node-version:
runs-on: ${{ matrix.os }}
needs: [build]
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install yarn
run: npm install -g yarn
- name: Install 3rd library
run: yarn
- name: Lint check
run: yarn lint
- name: Build check
run: yarn build
- name: Test check
run: yarn test:ci
- name: bazel build
run: yarn bazel build //...
build-docker:
runs-on: ubuntu-latest
needs: [build, build-muilt-node-version]
steps:
- uses: actions/checkout@master
# Container build
- name: Build docker
id: build-docker
run: |
docker build . -t ${{ env.REGISTRY_NAME }}/damingerdai/express-postgres-ts-starter:${{ github.sha }} -f Dockerfile
- name: Image digest
run: echo ${{ steps.build-docker.outputs.digest }}