-
Notifications
You must be signed in to change notification settings - Fork 2
117 lines (93 loc) · 3.81 KB
/
unit-integration-test.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
name: GitHub Actions Workflow
on:
push:
branches:
- '*'
jobs:
build:
runs-on: self-hosted
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
E2E_ENVIRONMENT: 'CI'
AB2D_V2_ENABLED: 'true'
SEARCH_BENE_BATCH_SIZE: '10'
AWS_DEFAULT_REGION: "us-east-1"
WORKSPACE: ${{ github.workspace }}
AB2D_BFD_KEYSTORE_LOCATION: "${{ github.workspace }}/opt/ab2d/ab2d_bfd_keystore"
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
maven-version: '3.6.3'
- name: Download bfd keystore
run: |
aws s3 cp s3://bcda-opensbx-access-logs/ab2d_sbx_keystore /tmp/ab2d_sbx_keystore
- name: Set env vars from AWS params
uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main
env:
AWS_REGION: ${{ vars.AWS_REGION }}
ECR_REPO_ENV_AWS_ACCOUNT_NUMBER: ${{ vars.SBX_ACCOUNT_NUMBER }}
with:
params: |
ARTIFACTORY_URL=/artifactory/url
ARTIFACTORY_USER=/artifactory/user
ARTIFACTORY_PASSWORD=/artifactory/password
CC_TEST_REPORTER_ID=cc-test-reporter-id
- name: Assume role in target account
uses: aws-actions/configure-aws-credentials@v3
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::${{ vars.DEV_ACCOUNT_NUMBER }}:role/delegatedadmin/developer/github-actions-runner-role
- name: Set env vars from AWS params
uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main
env:
AWS_REGION: ${{ vars.AWS_REGION }}
with:
params: |
OKTA_CLIENT_ID=/okta/client-id
OKTA_CLIENT_PASSWORD=/okta/client-secret
SECONDARY_USER_OKTA_CLIENT_ID=/secondary-okta/client-id
SECONDARY_USER_OKTA_CLIENT_PASSWORD=/secondary-okta/client-secret
- name: Remove Maven Directory
run: |
if [ -d "/opt/maven/apache-maven-3.6.3" ]; then
sudo rm -rf /opt/maven/apache-maven-3.6.3
echo "Maven directory removed."
else
echo "Maven directory does not exist."
fi
- name: Install Maven 3.6.3
run: |
wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar xzvf apache-maven-3.6.3-bin.tar.gz
sudo mv apache-maven-3.6.3 /opt/maven
echo "PATH=$PATH:/opt/maven/bin" >> $GITHUB_ENV
- name: Create ab2d workspace directory and copy in keystore
run: sudo mkdir -p "$WORKSPACE/opt/ab2d"
- name: Download Code Coverage
run: |
mkdir -p codeclimate
if [ ! -f ./codeclimate/cc-test-reporter ]; then
curl -L --no-progress-meter https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 \
> ./codeclimate/cc-test-reporter && chmod +x ./codeclimate/cc-test-reporter
fi
- name: Set directory permissions
run: |
sudo chmod -R 777 /opt/actions-runner/_work/ab2d/ab2d/common/
# Add other commands if necessary
- name: Clean maven
run: |
mvn --version
echo $WORKSPACE
mvn -U clean
- name: Run unit and integration tests
run: |
mvn -s settings.xml -X -Dusername=${ARTIFACTORY_USER} -Dpassword=${ARTIFACTORY_PASSWORD} -Drepository_url=${ARTIFACTORY_URL} test -pl common,job,coverage,api,worker
- name: Cleanup - first pass of docker deletions part 1
run: |
docker volume ls -qf dangling=true | xargs -I name docker volume rm name
docker ps -aq | xargs -I name docker rm --force name