feat(ecotag) : add slimfaas UI component to savec the planet #160
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
types: [opened, synchronize, reopened] | |
jobs: | |
sonarcloud: | |
name: SonarCloud | |
environment: ml-cli | |
runs-on: windows-latest | |
steps: | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'zulu' # Alternative distribution options are available. | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache SonarCloud scanner | |
id: cache-sonar-scanner | |
uses: actions/cache@v3 | |
with: | |
path: .\.sonar\scanner | |
key: ${{ runner.os }}-sonar-scanner | |
restore-keys: ${{ runner.os }}-sonar-scanner | |
- uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: global.json | |
- name: Install SonarCloud scanner | |
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
shell: powershell | |
run: | | |
New-Item -Path .\.sonar\scanner -ItemType Directory | |
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: npm install | |
run: npm install | |
working-directory: src/Ecotag/ClientApp | |
- name: npm test | |
run: npm test -- --runInBand --coverage --watchAll=false | |
working-directory: src/Ecotag/ClientApp | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
shell: powershell | |
run: | | |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"AxaGuilDEv_ml-cli" /o:"axaguildev" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.exclusions="**/*.spec.js,**/*.stories.js,**/ClientApp/src/Toolkit/**,**/ClientApp/coverage/**,Scripts/**,**/*.scss,**/__snapshots__/**,**/*Sould.cs,**/*[Tt]ests.cs,**/node_modules/**,**/ClientApp/build-local/**,**/ClientApp/build-server/**,**/ClientApp/.storybook/**,**/ClientApp/storybook-static/**,**/obj/**,**/__mocks__/**,**/ClientApp/src/serviceWorker.ts,**/ClientApp/public/**" /d:sonar.javascript.lcov.reportPaths="**/ClientApp/coverage/lcov.info" | |
dotnet tool install --global dotnet-coverage | |
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml" | |
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
build-linux: | |
environment: ml-cli | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: npm install | |
run: npm install | |
working-directory: src/Ecotag/ClientApp | |
- name: npm test | |
run: npm test -- --runInBand --coverage --watchAll=false | |
working-directory: src/Ecotag/ClientApp | |
- name: npm run build-storybook | |
run: npm run build-storybook | |
working-directory: src/Ecotag/ClientApp | |
- uses: actions/setup-dotnet@v3 | |
#- name: Sonarqube Begin | |
# if: ${{ github.actor != 'dependabot[bot]' }} | |
# run: | | |
# dotnet tool install --global dotnet-sonarscanner | |
# dotnet test -p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./coverage/opencover.xml | |
# dotnet sonarscanner begin /d:sonar.login=${{ secrets.SONAR_TOKEN }} /o:AxaGuilDev /k:AxaGuilDev_ml-cli /s:$GITHUB_WORKSPACE/SonarQube.Analysis.xml | |
- run: dotnet test /p:CollectCoverage=true | |
#- name: Sonarqube end | |
# if: ${{ github.actor != 'dependabot[bot]' }} | |
# run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tags: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
outputs: | |
new_version: ${{ steps.tag.outputs.new_version }} | |
steps: | |
- uses: actions/checkout@master | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add tag to output step | |
id: tag | |
run: echo "::set-output name=new_version::${{ steps.tag_version.outputs.new_version }}" | |
- name: Add changelog to output step | |
id: changelog | |
run: echo "::set-output name=changelog::${{ steps.tag_version.outputs.changelog }}" | |
push_to_registry_from_pull_request: | |
environment: ml-cli | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
if: github.ref != 'refs/heads/master' | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: axaguildev/ecotag | |
- name: Build and push Docker image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push_to_registry: | |
environment: ml-cli | |
needs: tags | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: axaguildev/ecotag | |
- name: Build and push Docker image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
context: . | |
push: true | |
labels: ${{ steps.meta.outputs.labels }} | |
tags: axaguildev/ecotag:${{ needs.tags.outputs.new_version }},axaguildev/ecotag:latest | |
release: | |
environment: ml-cli | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
needs: tags | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: release | |
uses: actions/create-release@v1 | |
id: create_release | |
with: | |
draft: false | |
prerelease: false | |
body: | | |
${{ needs.tags.outputs.changelog }} | |
release_name: "v${{ needs.tags.outputs.new_version }}" | |
tag_name: "v${{ needs.tags.outputs.new_version }}" | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- uses: actions/setup-dotnet@v3 | |
- run: dotnet publish ./src/MlCli/MlCli.csproj -c Release -r osx-x64 --self-contained=true /p:PublishSingleFile=true /p:PublishReadyToRun=true /p:AssemblyVersion=${{ needs.tags.outputs.new_version }} --output ./drop/osx-x64/ml-cli | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.0 | |
with: | |
filename: ml-cli-osx-x64.zip | |
path: . | |
directory: ./drop/osx-x64/ml-cli | |
- name: upload artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./drop/osx-x64/ml-cli/ml-cli-osx-x64.zip | |
asset_name: ml-cli-osx-x64.zip | |
asset_content_type: application/zip4 | |
- run: dotnet publish ./src/MlCli/MlCli.csproj -c Release -r linux-x64 --self-contained=true /p:PublishSingleFile=true /p:PublishReadyToRun=true /p:AssemblyVersion=${{ needs.tags.outputs.new_version }} --output ./drop/linux-x64/ml-cli | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.0 | |
with: | |
filename: ml-cli-linux-x64.zip | |
path: . | |
directory: ./drop/linux-x64/ml-cli | |
- name: upload artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./drop/linux-x64/ml-cli/ml-cli-linux-x64.zip | |
asset_name: ml-cli-linux-x64.zip | |
asset_content_type: application/zip4 | |
- run: dotnet publish ./src/MlCli/MlCli.csproj -c Release -r win-x64 --self-contained=true /p:PublishReadyToRun=true /p:AssemblyVersion=${{ needs.tags.outputs.new_version }} --output ./drop/win-x64/ml-cli | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.0 | |
with: | |
filename: ml-cli-win-x64.zip | |
path: . | |
directory: ./drop/win-x64/ml-cli | |
- name: upload artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./drop/win-x64/ml-cli/ml-cli-win-x64.zip | |
asset_name: ml-cli-win-x64.zip | |
asset_content_type: application/zip | |
- run: dotnet publish ./src/Ecotag/Ecotag.csproj -c Release -r linux-x64 --self-contained=true /p:PublishSingleFile=true /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:AssemblyVersion=${{ needs.tags.outputs.new_version }} --output ./drop/linux-x64/ecotag | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.0 | |
with: | |
filename: ecotag-linux-x64.zip | |
path: . | |
directory: ./drop/linux-x64/ecotag | |
- name: upload artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./drop/linux-x64/ecotag/ecotag-linux-x64.zip | |
asset_name: ecotag-linux-x64.zip | |
asset_content_type: application/zip | |
- run: dotnet publish ./src/MlCli.DemoApi/MlCli.DemoApi.csproj -c Release -r linux-x64 --self-contained=true /p:PublishSingleFile=true /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:AssemblyVersion=${{ needs.tags.outputs.new_version }} --output ./drop/linux-x64/demo-api | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.0 | |
with: | |
filename: demo-api-linux-x64.zip | |
path: . | |
directory: ./drop/linux-x64/demo-api | |
- name: upload artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./drop/linux-x64/demo-api/demo-api-linux-x64.zip | |
asset_name: demo-api-linux-x64.zip | |
asset_content_type: application/zip | |
- run: dotnet publish ./src/Ecotag/Ecotag.csproj -c Release -r win-x64 --self-contained=true /p:PublishSingleFile=true /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:AssemblyVersion=${{ needs.tags.outputs.new_version }} --output ./drop/win-x64/ecotag | |
- name: LibreOffice install Windows x64 | |
run: | | |
git clone https://github.com/guillaume-chervet/LibreOfficePortal_7.4.2_winx64.git --depth 1 LibreOffice | |
mv LibreOffice drop/win-x64/ecotag | |
ls ./drop/win-x64/ecotag/ | |
echo "---------------" | |
cd drop/win-x64/ecotag | |
rm appsettings-server.Production.json | |
cp appsettings-server.DesktopWinx64.json appsettings-server.Production.json | |
cd ClientApp/build-server | |
rm environment.json | |
cp environment.desktop.json environment.json | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.0 | |
with: | |
filename: ecotag-win-x64.zip | |
path: . | |
directory: ./drop/win-x64/ecotag | |
- name: upload artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./drop/win-x64/ecotag/ecotag-win-x64.zip | |
asset_name: ecotag-win-x64.zip | |
asset_content_type: application/zip | |
- run: dotnet publish ./src/MlCli.DemoApi/MlCli.DemoApi.csproj -c Release -r win-x64 --self-contained=true /p:PublishSingleFile=true /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:AssemblyVersion=${{ needs.tags.outputs.new_version }} --output ./drop/win-x64/demo-api | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.0 | |
with: | |
filename: demo-api-win-x64.zip | |
path: . | |
directory: ./drop/win-x64/demo-api | |
- name: upload artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./drop/win-x64/demo-api/demo-api-win-x64.zip | |
asset_name: demo-api-win-x64.zip | |
asset_content_type: application/zip | |
- run: dotnet publish ./src/Ecotag/Ecotag.csproj -c Release -r osx-x64 --self-contained=true /p:PublishSingleFile=true /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:AssemblyVersion=${{ needs.tags.outputs.new_version }} --output ./drop/osx-x64/ecotag | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.0 | |
with: | |
filename: ecotag-osx-x64.zip | |
path: . | |
directory: ./drop/osx-x64/ecotag | |
- name: upload artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./drop/osx-x64/ecotag/ecotag-osx-x64.zip | |
asset_name: ecotag-osx-x64-.zip | |
asset_content_type: application/zip | |
- run: dotnet publish ./src/MlCli.DemoApi/MlCli.DemoApi.csproj -c Release -r osx-x64 --self-contained=true /p:PublishSingleFile=true /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:AssemblyVersion=${{ needs.tags.outputs.new_version }} --output ./drop/osx-x64/demo-api | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.0 | |
with: | |
filename: demo-api-osx-x64.zip | |
path: . | |
directory: ./drop/osx-x64/demo-api | |
- name: upload artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./drop/osx-x64/demo-api/demo-api-osx-x64.zip | |
asset_name: demo-api-osx-x64.zip | |
asset_content_type: application/zip | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.0 | |
with: | |
filename: demo.zip | |
path: . | |
directory: ./demo | |
- name: upload artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./demo/demo.zip | |
asset_name: demo.zip | |
asset_content_type: application/zip |