-
Notifications
You must be signed in to change notification settings - Fork 24
152 lines (128 loc) · 5.37 KB
/
build-test.yml
File metadata and controls
152 lines (128 loc) · 5.37 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
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
name: 'build-test'
on: [pull_request, push]
defaults:
run:
working-directory: Development
env:
SECRET_GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
SECRET_RESULTS_SHEET_ID: ${{ secrets.RESULTS_SHEET_ID }}
jobs:
build_and_test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v4
- name: set environment variables
shell: bash
run: |
GITHUB_COMMIT=`echo "${{ github.sha }}" | cut -c1-7`
echo "GITHUB_COMMIT=$GITHUB_COMMIT" >> $GITHUB_ENV
- name: install nmos-js
run: |
yarn install
- name: unit test nmos-js
run: |
yarn run lint-check
yarn run build
yarn test --passWithNoTests --coverage --watchAll=false
- name: install python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: install pip
run: |
python -m pip install --upgrade pip
- name: install Chrome
run: |
CHROME_VERSION="141.0.7390.54"
wget -q "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/${CHROME_VERSION}/linux64/chrome-linux64.zip"
unzip -q chrome-linux64.zip
sudo mv chrome-linux64 /opt/
sudo ln -sf /opt/chrome-linux64/chrome /usr/bin/google-chrome
rm chrome-linux64.zip
- name: install ChromeDriver
run: |
# chromedriver 141.0.7390.54 is recommended for chrome 141.*
CHROMEDRIVER_VERSION="141.0.7390.54"
echo "Installing ChromeDriver version: $CHROMEDRIVER_VERSION"
wget -q "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROMEDRIVER_VERSION/linux64/chromedriver-linux64.zip"
unzip chromedriver-linux64.zip
chmod +x chromedriver-linux64/chromedriver
sudo mv chromedriver-linux64/chromedriver /usr/local/bin/
- name: install TestingFacade dependencies
run: |
cd ..
cd TestingFacade
python -m pip install --upgrade pip
pip install -r requirements.txt
cd ..
- name: setup google credentials
if: env.SECRET_GOOGLE_CREDENTIALS
shell: bash
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
mkdir -p gdrive
echo "${{ env.SECRET_GOOGLE_CREDENTIALS }}" > secret.b64
openssl base64 -d -A -in secret.b64 -out gdrive/credentials.json
echo "GDRIVE_CREDENTIALS=`pwd`/gdrive/credentials.json" >> $GITHUB_ENV
- name: controller testing
shell: bash
working-directory: ${{ env.RUNNER_WORKSPACE }}
run: |
set -x
root_dir=`pwd`
chmod +x ${root_dir}/Sandbox/run_controller_tests.sh
# Install AMWA NMOS Testing Tool
git clone https://github.com/AMWA-TV/nmos-testing.git
cd nmos-testing
pip install -r requirements.txt
pip install -r utilities/run-test-suites/gsheetsImport/requirements.txt
mkdir results
mkdir badges
testing_dir=`pwd`
${root_dir}/Sandbox/run_controller_tests.sh ${root_dir}/Development/ ${root_dir}/TestingFacade/ ${testing_dir} results badges $GITHUB_STEP_SUMMARY "127.0.0.1" "${{ env.GITHUB_COMMIT }}-"
- name: upload to google sheets
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
working-directory: ${{ env.RUNNER_WORKSPACE }}
shell: bash
run: |
export SHEET=https://docs.google.com/spreadsheets/d/${{ env.SECRET_RESULTS_SHEET_ID }}
python nmos-testing/utilities/run-test-suites/gsheetsImport/resultsImporter.py --credentials ${{ env.GDRIVE_CREDENTIALS }} --sheet "$SHEET" --insert --json nmos-testing/results/${{ env.GITHUB_COMMIT }}-*.json || echo "upload failed"
- uses: actions/upload-artifact@v4
with:
name: badges
path: ${{ runner.workspace }}/nmos-js/nmos-testing/badges
- uses: actions/upload-artifact@v4
with:
name: results
path: ${{ runner.workspace }}/nmos-js/nmos-testing/results
make_badges:
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
needs: [build_and_test]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: set environment variables
shell: bash
run: |
GITHUB_COMMIT=`echo "${{ github.sha }}" | cut -c1-7`
echo "GITHUB_COMMIT=$GITHUB_COMMIT" >> $GITHUB_ENV
echo "GITHUB_WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV
echo "RUNNER_WORKSPACE=${{ runner.workspace }}" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
path: ${{ runner.workspace }}/artifacts
- name: make badges
run: |
chmod +x ${{ github.workspace }}/Sandbox/make_badges.sh
${{ github.workspace }}/Sandbox/make_badges.sh ${{ github.workspace }} ${{ runner.workspace }}/artifacts
# force push to github onto an orphan 'badges' branch
cd ${{ github.workspace }}
git checkout --orphan badges-${{ env.GITHUB_COMMIT }}
git rm -rfq --ignore-unmatch .
git add *.svg
git remote set-url --push `git remote` https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git config --global user.name 'test-results-uploader'
git config --global user.email 'test-results-uploader@nmos-cpp.iam.gserviceaccount.com'
git commit -qm "Badges for README at ${{ env.GITHUB_COMMIT }}"
git push -f `git remote` badges-${{ env.GITHUB_COMMIT }}:badges