Skip to content

8.0.0 GitHub action #16

8.0.0 GitHub action

8.0.0 GitHub action #16

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
working-directory: src/app/client
run: yarn install --no-progress --production=true
- name: Build client
working-directory: src/app/client
run: npm run build
- name: List all files after build
working-directory: src/app/client
run: find . -type f
- name: Check if dist directory exists and list contents
working-directory: src/app/client
run: |
if [ -d dist ]; then
echo "dist directory exists. Listing contents:"
ls -l dist
else
echo "dist directory does not exist"
fi
- 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 $GITHUB_WORKSPACE/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 $GITHUB_WORKSPACE/app_dist/
shell: /usr/bin/bash -e {0}
- name: Install server dependencies
working-directory: $GITHUB_WORKSPACE/app_dist
run: yarn install --ignore-engines --no-progress --production=true
- name: Run server build script
working-directory: $GITHUB_WORKSPACE/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