-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (140 loc) · 5.32 KB
/
pne-workflow.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# CI for NVIP
name: Product Name Extractor Workflow
on:
pull_request:
branches:
- main
- dev
push:
branches:
- main
- dev
- 'cicd/**'
paths-ignore:
- 'crawler/**'
- 'exploitfinder/**'
- 'patchfinder/**'
- 'reconciler/**'
env:
AWS_REGION: 'us-east-1'
DB_TYPE: 'mysql'
HIKARI_URL: 'jdbc:mysql://localhost:3306/nvip?useSSL=false&allowPublicKeyRetrieval=true'
HIKARI_USER: 'root'
HIKARI_PASSWORD: 'root'
RESOURCE_DIR: 'nvip_data'
DATA_DIR: 'data'
NLP_DIR: 'nlp'
CHAR_2_VEC_CONFIG: 'c2v_model_config_50.json'
CHAR_2_VEC_WEIGHTS: 'c2v_model_weights_50.h5'
WORD_2_VEC: 'w2v_model_250.bin'
NER_MODEL: 'NERallModel.bin'
NER_MODEL_NORMALIZER: 'NERallNorm.bin'
SENTENCE_MODEL: 'en-sent.bin'
PRODUCT_DETECTOR_MODEL: 'en-pos-perceptron.bin'
jobs:
# Build and Test Product Extraction Component
build-test-product-extractor:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
lfs: 'true'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
# Grab large files (w2v model) from S3 bucket
- name: Pull file from S3 bucket
run: |
cd productnameextractor/nvip_data/data
aws s3 cp s3://binaries-for-crawler/w2v_model_250.bin .
# Setup MySQL DB for tests that require connection (Might not need this)
- name: Start MySQL Service
run: sudo /etc/init.d/mysql start
# run: |
# sudo /etc/init.d/mysql start
# mysql -e 'CREATE DATABASE nvip;' -uroot -proot
# mysql -e 'SHOW DATABASES;' -uroot -proot
# mysql -e 'source nvip_data/mysql-database/CreateAndInitializeDb.sql' -uroot -proot
- name: Initialize DB
env:
LIQUIBASE_COMMAND_URL: ${{ env.HIKARI_URL }}
LIQUIBASE_COMMAND_USERNAME: ${{ env.HIKARI_USER }}
LIQUIBASE_COMMAND_PASSWORD: ${{ env.HIKARI_PASSWORD }}
run: |
mysql -e 'CREATE DATABASE nvip;' -u${{ env.HIKARI_USER }} -p${{ env.HIKARI_PASSWORD }}
mvn liquibase:update --no-transfer-progress --projects=productnameextractor
- name: Test and Build Product Extractor with Maven
run: |
cd productnameextractor
mvn dependency:go-offline
mvn package
- name: Publish Test Report
if: success() || failure()
uses: scacap/action-surefire-report@v1
with:
check_name: PNE Test Report
# Deploy product extractor component project to container registry
staging-deploy:
runs-on: ubuntu-latest
needs: build-test-product-extractor
if: ${{ success() && github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
# Pull large files (w2v model) so they're in the container
- name: Pull file from S3 bucket
run: |
cd productnameextractor/nvip_data/data
aws s3 cp s3://binaries-for-crawler/w2v_model_250.bin .
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image for Product Extractor
run: |
docker build . -f productnameextractor/Dockerfile -t nvip-productnameextractor:staging -t ghcr.io/softwaredesignlab/nvip-productnameextractor:staging
docker push ghcr.io/softwaredesignlab/nvip-productnameextractor:staging
# Deploy product extractor component project to container registry
production-deploy:
runs-on: ubuntu-latest
environment: production
needs: staging-deploy
steps:
- uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
# Pull large files (w2v model) so they're in the container
- name: Pull file from S3 bucket
run: |
cd productnameextractor/nvip_data/data
aws s3 cp s3://binaries-for-crawler/w2v_model_250.bin .
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image for Product Extractor
run: |
docker build . -f productnameextractor/Dockerfile -t nvip-productnameextractor -t ghcr.io/softwaredesignlab/nvip-productnameextractor
docker push ghcr.io/softwaredesignlab/nvip-productnameextractor