From 3f15113fd3ffe9be0819c6189e4616e2c1770f2a Mon Sep 17 00:00:00 2001 From: Luis Linares Date: Wed, 19 Jun 2024 10:01:34 +0200 Subject: [PATCH] simplification for tests --- .github/workflows/ci.yaml | 182 ------------------ .../workflows/generate-oss-license-report.yml | 108 ----------- 2 files changed, 290 deletions(-) delete mode 100644 .github/workflows/generate-oss-license-report.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 59821e6..76a5280 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,142 +35,8 @@ jobs: with: python-version: '3.11' - pre-commit: - name: Pre-commit - runs-on: [self-hosted, X64] - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Run Pre-commit - uses: pre-commit/action@v3.0.1 - - unit-tests: - name: Unit Tests - runs-on: [self-hosted, X64] - container: ubuntu:22.04 - timeout-minutes: 20 - needs: [pre-commit] - steps: - - name: Install system requirements - run: | - apt-get -y update && \ - apt install -y curl gcc python3-dev make \ - software-properties-common git \ - xvfb libgl1-mesa-glx libxrender1 libglib2.0-0 - - - name: Setup Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v5 - id: py - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Mock wasi-sdk - run: | - mkdir /opt/wasi-sdk - touch /opt/wasi-sdk/bin - - - name: Checkout - uses: actions/checkout@v4 - - - name: Install local-console in editable mode - # This is required in order for coverage.py - # to be able to catch coverage data. - run: | - ${{ steps.py.outputs.python-path }} -m venv .venv - . .venv/bin/activate - pip install -e local-console/ - pip install -r tests/requirements.txt - - - name: Run Unit Test - id: unit-test - run: | - . .venv/bin/activate - xvfb-run coverage run -m pytest tests -o junit_family=xunit1 --junitxml=xunit-result.xml --hypothesis-seed=42 - coverage xml - - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@v2.1.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - windows-installer: - name: Windows Installer - runs-on: windows-latest - needs: [pre-commit, wheel] - env: - ARTIFACT_NAME: windows-installer - outputs: - artifact: ${{ env.ARTIFACT_NAME }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Get local-console wheel - uses: actions/download-artifact@v4 - with: - name: ${{ needs.wheel.outputs.artifact }} - merge-multiple: true - - - name: Build the Inno Setup Installer - uses: Minionguyjpro/Inno-Setup-Action@v1.2.4 - with: - path: ./inno-setup.iss - options: /O+ - - - name: Upload the Inno Setup Installer - uses: actions/upload-artifact@v4 - with: - name: ${{ env.ARTIFACT_NAME }} - path: ./Output/local-console-setup.exe - - verify: - name: Verify if already published - runs-on: [self-hosted, X64] - if: github.ref == 'refs/heads/main' - outputs: - exists: ${{ steps.check-tag.outputs.exists }} - tag: ${{ steps.tag.outputs.string }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Extract version - id: tag - run: | - echo "string=v$(cat local-console/VERSION)" >> "$GITHUB_OUTPUT" - - name: Check - uses: mukunku/tag-exists-action@v1.6.0 - id: check-tag - with: - tag: ${{ steps.tag.outputs.string }} - - system-tests: - name: System Tests - needs: [pre-commit] - runs-on: [self-hosted, X64] - steps: - - name: Run external System Tests - uses: convictional/trigger-workflow-and-wait@v1.6.5 - with: - owner: midokura - repo: wedge-cli - github_token: ${{ secrets.TEMPORARY_PAT_TOKEN }} - github_user: ${{ secrets.TEMPORARY_PAT_USER }} - workflow_file_name: execute-system-tests.yaml - ref: main - client_payload: '{"lc-commit":"${{ github.event.pull_request.head.sha }}"}' - e2e-tests: name: E2E Tests - needs: [pre-commit] runs-on: [self-hosted, X64] steps: - name: Run external System Tests @@ -183,51 +49,3 @@ jobs: workflow_file_name: execute-e2e.yaml ref: main client_payload: '{"lc-commit":"${{ github.event.pull_request.head.sha }}"}' - - publish: - name: Publish and tag - runs-on: [self-hosted, X64] - needs: - - verify - - pre-commit - - wheel - - unit-tests - - e2e-tests - - system-tests - - windows-installer - if: needs.verify.outputs.exists == 'false' - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Tag new version - uses: tvdias/github-tagger@v0.0.2 - with: - repo-token: ${{ secrets.TOKEN_PACKAGES }} - tag: ${{ needs.verify.outputs.tag }} - - - name: Get local-console wheel - uses: actions/download-artifact@v4 - with: - name: ${{ needs.wheel.outputs.artifact }} - merge-multiple: true - - - name: Get Windows Installer - uses: actions/download-artifact@v4 - with: - name: ${{ needs.windows-installer.outputs.artifact }} - merge-multiple: true - - - uses: softprops/action-gh-release@v2 - with: - name: ${{ needs.verify.outputs.tag }} - tag_name: ${{ needs.verify.outputs.tag }} - generate_release_notes: true - files: | - local-console-setup.exe - local_console-*-py3-*.whl diff --git a/.github/workflows/generate-oss-license-report.yml b/.github/workflows/generate-oss-license-report.yml deleted file mode 100644 index 019fe45..0000000 --- a/.github/workflows/generate-oss-license-report.yml +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright 2024 Sony Semiconductor Solutions Corp. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - ---- -name: Generate OSS License report - -on: - workflow_dispatch: - push: - branches: - - main - # TODO: remove - pull_request: - -env: - PYTHON_VERSION: "3.11" - -jobs: - generate-oss-license-report: - runs-on: [ self-hosted, X64 ] - container: ubuntu:22.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Install build requirements - run: | - apt-get -y update && apt install -y git - - name: Install CycloneDX - run: pip3 install cyclonedx-bom==4.1.2 - - name: Install package - run: | - python3 -m venv venv - . venv/bin/activate - pip3 install local-console/ - - name: Collect source files - run: python3 oss/download_src.py - - name: Upload source code - uses: actions/upload-artifact@v4 - with: - name: code - retention-days: 21 - path: | - venv/lib - tools - - name: Generate Python SBOM - run: | - cyclonedx-py environment venv > oss/autogenerated-sbom.json - - name: Generate SBOM - run: | - python3 oss/sbom2csv.py \ - --input \ - oss/autogenerated-sbom.json \ - oss/manual-application-python-sbom.json \ - oss/manual-application-tools-sbom.json \ - --output oss/local-console-application-sbom-report.csv - python3 oss/sbom2csv.py \ - --input \ - oss/manual-package-sbom.json \ - --output oss/local-console-package-sbom-report.csv - - name: Upload autogenerated SBOM - uses: actions/upload-artifact@v4 - with: - name: autogenerated-sbom.json - retention-days: 21 - path: oss/autogenerated-sbom.json - - name: Upload application report - uses: actions/upload-artifact@v4 - with: - name: local-console-application-sbom-report.csv - retention-days: 21 - path: oss/local-console-application-sbom-report.csv - - name: Upload package report - uses: actions/upload-artifact@v4 - with: - name: local-console-package-sbom-report.csv - retention-days: 21 - path: oss/local-console-package-sbom-report.csv - - check-headers: - name: Check license headers - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Check licensing - run: | - docker run --network=none -v ${PWD}:/src ghcr.io/google/addlicense:latest \ - -c 'Sony Semiconductor Solutions Corp.' -l apache -check .