1+ name : Build and Test on Pull Request
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - ' **'
7+
8+ env :
9+ CONTENT_PLUGIN_VERSION : ${{ vars.CONTENT_PLUGIN_VERSION || 'release-8.0.0' }}
10+
11+ jobs :
12+ build-test :
13+ runs-on : ubuntu-latest
14+ env :
15+ version_number : ${{ github.ref_name }}
16+ build_number : ${{ github.run_number }}
17+ steps :
18+ - name : Checkout code
19+ uses : actions/checkout@v3
20+
21+ - name : Set up Node.js 10
22+ uses : actions/setup-node@v3
23+ with :
24+ node-version : 10.24.1
25+
26+ - name : Cache node modules
27+ uses : actions/cache@v3
28+ with :
29+ path : node_modules
30+ key : ${{ runner.os }}-node-${{ hashFiles('package.json') }}
31+
32+ - name : Clone plugins (from fork)
33+ run : |
34+ git clone --branch ${{ env.CONTENT_PLUGIN_VERSION }} https://github.com/vinodbhorge/sunbird-content-plugins.git plugins
35+
36+ - name : Install dependencies
37+ run : |
38+ which bower || sudo npm install -g bower@1.8.0
39+ which grunt || sudo npm install -g grunt-cli@1.2.0
40+ which gulp || sudo npm install -g gulp@3.9.1
41+ sudo apt-get install build-essential libpng-dev
42+
43+ - name : Bower cache clean
44+ working-directory : app
45+ run : bower cache clean --allow-root
46+
47+ - name : Bower install
48+ working-directory : app
49+ run : bower install --force --allow-root
50+
51+ - name : Install global npm packages
52+ run : npm install --legacy-peer-deps
53+
54+ - name : Gulp packageCorePlugins
55+ run : gulp packageCorePlugins
56+
57+ - name : Plugin build
58+ run : npm run plugin-build
59+
60+ - name : Run build
61+ run : npm run build
62+
63+ - name : Test
64+ run : npm run test
65+ continue-on-error : true
66+
67+ - name : Set up Node.js 14 (for Sonar)
68+ uses : actions/setup-node@v3
69+ with :
70+ node-version : 14
71+
72+ - name : Install SonarQube scanner
73+ run : npm install -g sonarqube-scanner
74+
75+ - name : Run SonarQube scanner
76+ env :
77+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
78+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
79+ run : sonar-scanner
80+
81+ lint :
82+ needs : build-test
83+ runs-on : ubuntu-latest
84+
85+ steps :
86+ - name : Checkout code
87+ uses : actions/checkout@v3
88+
89+ - name : Set up Node.js 18
90+ uses : actions/setup-node@v3
91+ with :
92+ node-version : 18
93+
94+ - name : Cache node modules
95+ uses : actions/cache@v3
96+ with :
97+ path : node_modules
98+ key : ${{ runner.os }}-node-${{ hashFiles('package.json') }}
99+
100+ - name : Run Lint
101+ run : npm run lint
0 commit comments