Skip to content

Bump tar, npm-check-updates, @angular-eslint/schematics and @angular/cli #9815

Bump tar, npm-check-updates, @angular-eslint/schematics and @angular/cli

Bump tar, npm-check-updates, @angular-eslint/schematics and @angular/cli #9815

Workflow file for this run

name: CI/CD GreenCityClient
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the dev branch
push:
branches: [prod-branch, dev]
pull_request:
branches: [prod-branch, dev]
workflow_dispatch:
permissions:
contents: read
checks: write
pull-requests: write
env:
repository: client
dockerRepoName: skyere/greencity-front
# 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:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
# Steps
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: 1.18
# Runs a set of commands using the runners shell
- name: Install
run: |
npm install
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt-get install ./google-chrome-stable_current_amd64.deb -y --allow-downgrades
- name: Build Test Environment
run: npx ts-node ./scripts/setenv.ts
- name: JS Linter
run: npm run lint
- name: CSS Linter
run: npm run stylelint
- name: Unit Tests
run: npx ng test --watch=false --progress=false --code-coverage=true --browsers=ChromeHeadless
- name: Normalize lcov paths
run: |
IN=coverage/GreenCityClient/lcov.info
if [ -f "$IN" ]; then
sed -E 's|SF:.*/(src/.*)|SF:\1|' "$IN" > "$IN.tmp" && mv "$IN.tmp" "$IN"
else
echo "Missing lcov: $IN" >&2
exit 1
fi
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v5.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=ita-social-projects
-Dsonar.projectKey=ita-social-projects-green-city-client
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.sources=src
-Dsonar.exclusions=**/node_modules/**,src/app/component/user/components/profile/calendar/calendar-image.*,src/app/component/user/components/profile/calendar/calendar-week/calendar-image.*,src/environments/environment.prod.*,src/app/image-pathes/auth-images.*,src/app/image-pathes/profile-icons.*,src/app/image-pathes/profile-images.*,src/app/image-pathes/single-news-images.*,src/app/image-pathes/sign-in-icons.*,src/app/component/about/about-routing.module.*,src/app/component/about/about.module.*,src/app/component/eco-news/eco-news-routing.module.*,src/app/component/eco-news/eco-news.module.*,src/app/component/map/map-routing.module.*,src/app/component/map/map.module.*,src/app/component/user/user-routing.module.*,src/app/component/user/user.module.*,src/app/app-routing.module.*,src/app/component/shared/shared.module.*,src/app/component/admin/admin-routing.module.*,src/app/component/admin/admin.module.*,src/app/app.module.*,src/app/component/auth/auth.module.*,src/app/component/core/core.module.*,src/app/component/home/home.module.*,src/app/component/layout/layout.module.*,src/app/model/weekDays.model.*,src/app/model/achievement/AchievementDto.*,src/app/model/advice/AdviceDto.*,src/app/model/filtering/filter-discount-dto.model.*,src/app/model/filtering/filter-distance-dto.model.*,src/app/model/filtering/filter-place-dto.model.*,src/app/model/habit-fact/HabitFactDto.*,src/app/model/habit/HabitStatisticLogDto.*,src/app/model/habit/HabitStatisticMapDto.*,src/app/model/habit/HabitStatisticsDto.*,src/app/model/habit/NewHabitDto.*,src/app/component/home/models/NewsDto.*,src/app/service/subscription/SubscriptionDto.*,src/app/model/user/userFilterDto.model.*,src/app/store/effects/ecoEvents.effects.*,src/app/ubs/ubs-admin/components/ubs-admin-certificate/ubs-admin-certificate.component.*,src/app/shared/interceptors/interceptor.service.*,src/app/store/reducers/ecoEvents.reducer.*,**/*.mock.ts,**/greencity.routing.module.*,**/*.model.ts
-Dsonar.test.inclusions=**/*.spec.ts
-Dsonar.javascript.lcov.reportPaths=coverage/GreenCityClient/lcov.info
# - name: E2E Tests
# run: npx ng e2e --protractor-config=e2e/protractor-ci.conf.js
- name: Build Environment
env:
PROD_SECRET: ${{ secrets.ENV_PROD }}
STAGE_SECRET: ${{ secrets.ENV_STAGE }}
run: |
if [[ "${{ github.ref }}" == "refs/heads/prod-branch" ]]; then
echo "${{ env.PROD_SECRET }}" > .env.prod
npx ts-node ./scripts/setenv.ts prod
else
echo "${{ env.STAGE_SECRET }}" > .env.stage
npx ts-node ./scripts/setenv.ts stage
fi
- name: Build
run: |
if [[ "${{ github.ref }}" == "refs/heads/prod-branch" ]]; then
npx ng build --configuration production --base-href=/GreenCityClient/
else
npx ng build --configuration=stage --base-href=/GreenCityClient/
fi
- name: Set outputs
run: echo "GITHUB_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Docker Login
uses: docker/login-action@v2.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v3.0.0
with:
context: .
file: Dockerfile
push: true
tags: ${{ env.dockerRepoName }}:test-${{ env.GITHUB_SHA_SHORT }}
- name: Docker Login
uses: docker/login-action@v2.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v3.0.0
with:
context: .
file: Dockerfile
push: true
tags: ${{ env.dockerRepoName }}:test-${{ env.GITHUB_SHA_SHORT }}
# - name: Kubernetes Set Context
# uses: Azure/k8s-set-context@v3.0
# with:
# kubeconfig: ${{ secrets.KUBE_CONFIG }}
# - name: Kubernetes tests
# run: |
# cd chart-test
# go test -v ./...
# - name: Deploy 🚀
# if: ${{ github.event_name == 'push' }}
# uses: JamesIves/github-pages-deploy-action@3.7.1
# with:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# BRANCH: gh-pages
# FOLDER: dist/GreenCityClient
# CLEAN: true