-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (64 loc) · 2.22 KB
/
node-ci.yaml
File metadata and controls
79 lines (64 loc) · 2.22 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
name: Node JS CI
on:
workflow_call:
secrets:
CVS_MGMT_AWS_ROLE:
required: true
CVS_SERVICES_S3:
required: true
jobs:
node-ci:
runs-on: ubuntu-latest
steps:
- name: Branching
run: |
echo ${{ github.base_ref }}
echo ${{ github.ref }}
echo ${{ github.head_ref }}
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{ github.base_ref == 'develop' && '' || github.base_ref }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v5.1.0
with:
role-to-assume: ${{ secrets.CVS_MGMT_AWS_ROLE }}
aws-region: eu-west-1
role-session-name: MGMTGHA
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies
run: npm ci --prefer-offline
- name: Configure Tools
run: npm run tools-setup
- name: Run Linting
run: npm run lint
- name: Build
run: npm run build
- name: Run Tests
run: npm run test
- name: Run Integration Tests
run: npm run test-i
- name: Sonar Scanner
continue-on-error: true
run: sonar-scanner
- name: Package
env:
ZIP_NAME: ${{ github.sha }}
run: |
npm run package
- name: Upload
run: |
SERVICE_NAME_SHORT=$(echo ${GITHUB_REPOSITORY#dvsa/cvs-svc-})
NODE_SHA=$(openssl dgst -sha256 -binary ${{ github.sha }}.zip | openssl enc -base64)
aws s3 cp ${{github.sha}}.zip s3://${{ secrets.CVS_SERVICES_S3 }}/$SERVICE_NAME_SHORT/${{github.sha}}.zip --metadata "sha256sum=$NODE_SHA,Tag=$SERVICE_NAME_SHORT"
- name: Record Hash
run: |
SERVICE_NAME_SHORT=$(echo ${GITHUB_REPOSITORY#dvsa/cvs-svc-})
unfeature=$(echo ${GITHUB_REF_NAME#feature/})
branch=$(python3 -c "print('$unfeature'.lower())")
echo ${{ github.sha }} > latestHash_$branch.txt
aws s3 cp latestHash_$branch.txt s3://${{ secrets.CVS_SERVICES_S3 }}/$SERVICE_NAME_SHORT/latestHash_$branch.txt --metadata "Tag=$SERVICE_NAME_SHORT"