Skip to content

Fixing event editing #7602

Fixing event editing

Fixing event editing #7602

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: [master, dev]
pull_request:
branches: [master, dev]
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@v2
- 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/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_125.0.6422.76-1_amd64.deb
sudo apt-get install ./google-chrome-stable_125.0.6422.76-1_amd64.deb -y --allow-downgrades
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.0.0.4432-linux.zip
unzip sonar-scanner-cli-6.0.0.4432-linux.zip
sudo mv sonar-scanner-6.0.0.4432-linux /opt/sonar-scanner
- 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: Sonar scan
#continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: >
/opt/sonar-scanner/bin/sonar-scanner
-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.*
-Dsonar.tests=src
-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
run: |
npx ng build --configuration=stage --base-href=/GreenCityClient/
# npx ng build --prod --delete-output-path --base-href=/GreenCityClient/ --outputPath=dist_aot && rm -rf dist_aot
# npx ng build --prod --base-href=/GreenCityClient/ --aot=false --build-optimizer=false
- 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