Skip to content

Commit

Permalink
simplification for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lulingar committed Jun 25, 2024
1 parent faf5b7b commit 3f15113
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 290 deletions.
182 changes: 0 additions & 182 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]

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/[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: [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/[email protected]
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/[email protected]
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
Expand All @@ -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/[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
108 changes: 0 additions & 108 deletions .github/workflows/generate-oss-license-report.yml

This file was deleted.

0 comments on commit 3f15113

Please sign in to comment.