and on develop #950
This file contains hidden or 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: Docker | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| branches: | |
| - develop | |
| pull_request: | |
| env: | |
| IMAGE_NAME: OpenAlprWebhookProcessor | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Run build | |
| run: docker build . --file ./OpenAlprWebhookProcessor.Server/Dockerfile | |
| back-end-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| distribution: 'zulu' | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v1 | |
| with: | |
| dotnet-version: 9.x | |
| - name: Install SonarQube Cloud scanner | |
| run: | | |
| dotnet tool install --global dotnet-sonarscanner | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Start SonarQube Analysis | |
| run: | | |
| dotnet-sonarscanner begin \ | |
| /k:"mlapaglia_OpenAlprWebhookProcessor" \ | |
| /o:"openalprwebhookprocessor" \ | |
| /d:sonar.token="${{ secrets.SONAR_TOKEN }}" \ | |
| /d:sonar.cs.opencover.reportsPaths="coverage/**/coverage.opencover.xml" \ | |
| /d:sonar.javascript.lcov.reportPaths="**/lcov.info" | |
| - name: Build and Test Backend | |
| run: | | |
| dotnet restore | |
| dotnet build --no-restore | |
| dotnet test --no-build --collect:"XPlat Code Coverage;Format=opencover" --results-directory ./coverage | |
| - name: Build and Test Frontend | |
| working-directory: ./openalprwebhookprocessor.client | |
| run: | | |
| npm ci | |
| npm run test:prod | |
| - name: End SonarQube Analysis | |
| run: | | |
| dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
| front-end-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Run frontend lint | |
| working-directory: ./openalprwebhookprocessor.client | |
| run: | | |
| npm ci | |
| npm run lint | |
| front-end-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Run frontend tests | |
| working-directory: ./openalprwebhookprocessor.client | |
| run: | | |
| npm ci | |
| npm run test:prod | |
| windows-build-push: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@main | |
| - name: Setup Buildx | |
| uses: actions/setup-dotnet@v1 | |
| with: | |
| dotnet-version: '9.x' | |
| include-prerelease: true | |
| - name: Build Artifact | |
| run: | | |
| tag=$(git describe --tags --abbrev=0) | |
| release_name="OpenAlprWebHookProcessor-${tag}-windows64" | |
| dotnet restore "OpenAlprWebhookProcessor.Server/OpenAlprWebhookProcessor.Server.csproj" | |
| dotnet build "OpenAlprWebhookProcessor.Server/OpenAlprWebhookProcessor.Server.csproj" -c Release | |
| dotnet publish "OpenAlprWebhookProcessor.Server/OpenAlprWebhookProcessor.Server.csproj" -c Release -o "$release_name" | |
| tar czvf "${release_name}.tar.gz" "$release_name" | |
| - name: Publish | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: "OpenAlprWebHookProcessor*" | |
| prerelease: ${{ contains(github.ref, 'alpha') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| docker-build-push: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v2 | |
| - name: Setup Buildx | |
| uses: docker/setup-buildx-action@v1 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v1 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| - name: Get git tag | |
| id: get_version | |
| run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
| - name: Push to Docker Hub | |
| uses: docker/build-push-action@v2 | |
| with: | |
| file: ./OpenAlprWebhookProcessor.Server/Dockerfile | |
| push: true | |
| tags: | | |
| mlapaglia/openalprwebhookprocessor:${{ steps.get_version.outputs.VERSION }} | |
| ${{ contains(github.ref, 'alpha') && 'mlapaglia/openalprwebhookprocessor:alpha' || 'mlapaglia/openalprwebhookprocessor:latest' }} |