Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This is a basic workflow to help you get started with Actions

name: Quality

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

tests:
runs-on: ubuntu-latest

steps:
- uses: actions/setup-python@v2
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: Gr1N/setup-poetry@v4
- run: poetry install
- run: |
poetry run coverage run -m pytest src
mkdir coverage-reports
poetry run coverage xml -o coverage-reports/coverage-tests.xml
ls coverage-reports
- name: Upload coverage reports
uses: actions/upload-artifact@v2
with:
name: coverage-reports
path: coverage-reports/coverage-tests.xml

# This workflow contains a single job called "build"
quality:
needs: tests
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Download coverage reports
uses: actions/download-artifact@v2
with:
name: coverage-reports
path: coverage-reports
- run: find .

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v1.5
with:
projectBaseDir: src
args: >
-Dsonar.organization=xtofl
-Dsonar.projectKey=xtofl_natan_mastermind
-Dsonar.python.coverage.reportPaths=coverage-reports/coverage-tests.xml
env:
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
11 changes: 11 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: psf/black@stable
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool.poetry]
name = "natan-mastermind"
version = "0.1.0"
description = "Mastermind"
authors = ["natan"]
license = "LGPLv3"
packages = [
{ include = "nmastermind", from="src" }
]

[tool.poetry.scripts]
natan-mastermind = "nmastermind.GUI:main"

[tool.poetry.dependencies]
python = "^3.8"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
15 changes: 10 additions & 5 deletions GUI.py → src/nmastermind/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Label,
messagebox)

import MasterMindAsked
from . import MasterMindAsked
import random

ALL_COLORS = ("red", "green", "blue", "yellow", "orange", "white")
Expand Down Expand Up @@ -197,7 +197,12 @@ def color(color_name):



root = Tk()
draw_board(root)
random_combination = MasterMindAsked.create_combination(NUMBER_OF_CIRCLES)
root.mainloop()
def main():
root = Tk()
draw_board(root)
random_combination = MasterMindAsked.create_combination(NUMBER_OF_CIRCLES)
root.mainloop()


if __name__ == "__main__":
main()
File renamed without changes.
Empty file added src/nmastermind/__init__.py
Empty file.
File renamed without changes.