Skip to content

Modify contactus URLs, and correct wedge-platform team to local-console team #12

Modify contactus URLs, and correct wedge-platform team to local-console team

Modify contactus URLs, and correct wedge-platform team to local-console team #12

Workflow file for this run

# 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: CI
on:
pull_request:
workflow_dispatch:
push:
branches: [main]
env:
PYTHON_VERSION: '3.11'
jobs:
wheel:
name: Build python wheel
uses: ./.github/workflows/build-wheel.yaml
secrets: inherit
with:
python-version: '3.11'
pre-commit:
name: Pre-commit
runs-on: [ubuntu-22.04]
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/[email protected]
unit-tests:
name: Unit Tests
# TODO: If possible use the public runners 'runs-on: [ubuntu-22.04]'
# Also this job not always works (maybe because you are using the container)
runs-on: [evp-dev, amd64, stable]
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
coverage xml
- name: SonarCloud Scan
uses: SonarSource/[email protected]
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/[email protected]
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: [ubuntu-22.04]
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/[email protected]
id: check-tag
with:
tag: ${{ steps.tag.outputs.string }}
system-tests:
name: System Tests
needs: [pre-commit, wheel]
runs-on: [ubuntu-22.04]
steps:
- name: Run external System Tests
uses: convictional/[email protected]
with:
owner: midokura
repo: wedge-cli
github_token: ${{ secrets.EXTENSIONS_CI_TOKEN }}
github_user: ${{ secrets.EXTENSIONS_CI_USER }}
workflow_file_name: execute-system-tests.yaml
ref: main
client_payload: |
{
"lc-artifact-name": "${{ needs.wheel.outputs.artifact }}",
"lc-artifact-repo": "${{ github.repository }}",
"lc-artifact-run-id": "${{ github.run_id }}"
}
e2e-tests:
name: E2E Tests
needs: [pre-commit, wheel]
runs-on: [ubuntu-22.04]
steps:
- name: Run external System Tests
uses: convictional/[email protected]
with:
owner: midokura
repo: wedge-cli
github_token: ${{ secrets.EXTENSIONS_CI_TOKEN }}
github_user: ${{ secrets.EXTENSIONS_CI_USER }}
workflow_file_name: execute-e2e.yaml
ref: main
client_payload: |
{
"lc-artifact-name": "${{ needs.wheel.outputs.artifact }}",
"lc-artifact-repo": "${{ github.repository }}",
"lc-artifact-run-id": "${{ github.run_id }}"
}
publish:
name: Publish and tag
runs-on: [ubuntu-22.04]
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/[email protected]
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