This repository was archived by the owner on Apr 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (107 loc) · 3.72 KB
/
continuous-integration.yml
File metadata and controls
123 lines (107 loc) · 3.72 KB
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
116
117
118
119
120
121
122
123
name: Continous Integration
on:
workflow_call:
secrets:
NPM_USER:
description: 'repository NPM_USER secret passed on'
required: false
NPM_PASS:
description: 'repository NPM_PASS secret passed on'
required: false
inputs:
enterprise:
description: "Flag to use enterprise registry"
type: boolean
required: false
default: false
node_version:
description: "Node versions to test"
type: string
required: false
default: "['16', '18']"
env:
HUSKY: 0
jobs:
scanning:
name: GitGuardian scan
if: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history so multiple commits can be scanned
- name: GitGuardian scan
uses: GitGuardian/ggshield-action@v1.22.0
with:
args: -v
env:
GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}
GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}
run-ci:
name: Run CI
runs-on: ubuntu-latest
strategy:
matrix:
node_version: ${{ fromJson(inputs.node_version) }}
permissions:
contents: read
id-token: write
timeout-minutes: 120
steps:
- name: Expose github environment as shell variables
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}
VARS_CONTEXT: ${{ toJson(vars) }}
run: |
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
to_envs() { jq -r "to_entries[] | \"\(.key)<<$EOF\n\(.value)\n$EOF\n\""; }
echo "$SECRETS_CONTEXT" | to_envs >> $GITHUB_ENV
- name: Checkout code 🛎️
uses: actions/checkout@v3
- name: Setup node 🏗️
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
- name: Get cache 🗄️
id: cache
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-${{ matrix.node_version }}
- name: Log into Verdaccio
if: ${{ inputs.enterprise }}
shell: bash
run: |
npm install -g npm-cli-login
npm-cli-login -u "${{ secrets.NPM_USER }}" -p "${{ secrets.NPM_PASS }}" -e doesntmatter@example.com -r https://registrynpm.storefrontcloud.io
- name: Install dependencies (OS)
if: ${{ !steps.cache.outputs.cache-hit }}
shell: bash
run: yarn --frozen-lockfile
- name: Detect circular dependencies 🔄
uses: vuestorefront/vue-storefront/actions/circular-dependencies@main
with:
filesPath: 'packages/**/*.{ts,vue}'
- name: Check licenses 🧪
uses: vuestorefront/vue-storefront/actions/check-licenses@main
with:
projectPath: ${{ github.workspace }}
- name: Build project
run: yarn build
- name: Run tests
run: yarn test
- name: Upload test coverage
uses: actions/upload-artifact@v3
with:
name: coverage-${{ runner.os }}-${{ github.event.pull_request.head.sha }}
path: |
coverage
packages/**/coverage
- name: Lint project
run: yarn lint