Skip to content

8.0.0 GitHub action #14

8.0.0 GitHub action

8.0.0 GitHub action #14

Workflow file for this run

name: CI/CD
on:
push:
branches:
- release-8.0.0
pull_request:
branches:
- release-8.0.0
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install client dependencies and build
working-directory: src/app/client
run: |
yarn install --no-progress --production=true
npm run build
- name: List dist directory contents
working-directory: src/app/client
run: ls -l dist
- name: Move index.html to index.ejs if it exists
working-directory: src/app/client
run: |
if [ -f dist/index.html ]; then
mv dist/index.html dist/index.ejs
else
echo "File dist/index.html does not exist"
fi
- name: Set up dependencies for server
run: |
mkdir -p /usr/src/app/app_dist
cp -r src/app/libs src/app/helpers src/app/proxy src/app/resourcebundles src/app/package.json src/app/framework.config.js src/app/sunbird-plugins src/app/routes src/app/constants src/app/controllers src/app/server.js /usr/src/app/app_dist/
shell: /usr/bin/bash -e {0}
- name: Install server dependencies
working-directory: /usr/src/app/app_dist
run: yarn install --ignore-engines --no-progress --production=true
- name: Run server build script
working-directory: /usr/src/app/app_dist
run: node helpers/resourceBundles/build.js -task="phraseAppPull"
- name: Test cases
working-directory: src/app/client
run: |
yarn config set ignore-engines true
yarn install
npm run test:ci
- name: Install Sonar Scanner
run: |
cd /tmp
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip
sudo apt-get install -y unzip
unzip sonar-scanner-cli-5.0.1.3006-linux.zip
cd -
- name: Run Sonar Scanner
run: /tmp/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner