-
Notifications
You must be signed in to change notification settings - Fork 2
132 lines (118 loc) · 5.84 KB
/
main.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
# Build for fourfront
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
name: Test Suite for fourfront (Python 3.8, Node 18)
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Build matrix
strategy:
matrix:
test_type: ['UNIT', 'NPM', 'Docker']
# We are really not set up for these next two to be multiplicative, so be careful adding more.
python_version: ['3.8']
node_version: ['18']
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
# Per doc for node install at https://github.com/actions/setup-node#usage
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
check-latest: false
- name: Install/Link Postgres
if: ${{ matrix.test_type == 'NPM' || matrix.test_type == 'UNIT' }}
run: |
sudo apt-get install curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql-14 postgresql-client-14
echo "/usr/lib/postgresql/14/bin" >> $GITHUB_PATH
sudo ln -s /usr/lib/postgresql/14/bin/initdb /usr/local/bin/initdb
- name: Install Deps
if: ${{ matrix.test_type == 'NPM' || matrix.test_type == 'UNIT' }}
run: |
node --version
make build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: QA (NPM)
if: ${{ matrix.test_type == 'NPM' }}
env:
S3_ENCRYPT_KEY: ${{ secrets.S3_ENCRYPT_KEY }}
# The need for this old environment variable name will go away soon.
# Once the new snovault is in, we should retain these for a little while to make sure the right
# variable is being used, and then this can go away. -kmp 9-Mar-2021
# I have named the ID slightly differently so we can see if the old names are in use.
TRAVIS_JOB_ID: ff-npm-x-test-${{ github.run_number }}-
# This will be the new environment variable name.
TEST_JOB_ID: ff-npm-test-${{ github.run_number }}-
GLOBAL_ENV_BUCKET: ${{ secrets.GLOBAL_ENV_BUCKET }}
ACCOUNT_NUMBER: $ {{ secrets.ACCOUNT_NUMBER }}
run: |
make remote-test-npm
- name: Cleanup (NPM)
if: ${{ always() && matrix.test_type == 'NPM' }}
env:
S3_ENCRYPT_KEY: ${{ secrets.S3_ENCRYPT_KEY }}
# The need for this old environment variable name will go away soon.
# Once the new snovault is in, we should retain these for a little while to make sure the right
# variable is being used, and then this can go away. -kmp 9-Mar-2021
# I have named the ID slightly differently so we can see if the old names are in use.
TRAVIS_JOB_ID: ff-npm-x-test-${{ github.run_number }}-
# This will be the new environment variable name.
TEST_JOB_ID: ff-npm-test-${{ github.run_number }}-
GLOBAL_ENV_BUCKET: ${{ secrets.GLOBAL_ENV_BUCKET }}
ACCOUNT_NUMBER: $ {{ secrets.ACCOUNT_NUMBER }}
run: |
poetry run wipe-test-indices $TEST_JOB_ID search-fourfront-testing-opensearch-kqm7pliix4wgiu4druk2indorq.us-east-1.es.amazonaws.com:443
- name: QA (UNIT)
if: ${{ matrix.test_type == 'UNIT' }}
env:
S3_ENCRYPT_KEY: ${{ secrets.S3_ENCRYPT_KEY }}
# The need for this old environment variable name will go away soon.
TRAVIS_JOB_ID: ff-unit-x-test-${{ github.run_number }}-
# This will be the new environment variable name.
TEST_JOB_ID: ff-unit-test-${{ github.run_number }}-
GLOBAL_ENV_BUCKET: ${{ secrets.GLOBAL_ENV_BUCKET }}
ACCOUNT_NUMBER: $ {{ secrets.ACCOUNT_NUMBER }}
run: |
make remote-test-unit
- name: Cleanup (UNIT)
if: ${{ always() && matrix.test_type == 'UNIT' }}
env:
S3_ENCRYPT_KEY: ${{ secrets.S3_ENCRYPT_KEY }}
# The need for this old environment variable name will go away soon.
TRAVIS_JOB_ID: ff-unit-x-test-${{ github.run_number }}-
# This will be the new environment variable name.
TEST_JOB_ID: ff-unit-test-${{ github.run_number }}-
GLOBAL_ENV_BUCKET: ${{ secrets.GLOBAL_ENV_BUCKET }}
ACCOUNT_NUMBER: $ {{ secrets.ACCOUNT_NUMBER }}
run: |
poetry run wipe-test-indices $TEST_JOB_ID search-fourfront-testing-opensearch-kqm7pliix4wgiu4druk2indorq.us-east-1.es.amazonaws.com:443
- name: Docker Build
if: ${{ matrix.test_type == 'Docker' && matrix.node_version == '18' && matrix.python_version == '3.8' }}
run: |
# The docker_development.ini has node 18 and Python 3.8 wired into it.
touch deploy/docker/local/docker_development.ini # cheap substitute for prepare-docker to make ignored file
docker build .