diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml index 2020612..4089e1b 100644 --- a/.github/workflows/formatter.yml +++ b/.github/workflows/formatter.yml @@ -6,11 +6,19 @@ jobs: linter_name: name: Code formatter runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11"] + fail-fast: true steps: - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - run: pip install black isort - name: Format code with black and isort run: | - pip install black isort isort . black . - name: Commit changes diff --git a/.github/workflows/smokeshow.yml b/.github/workflows/smokeshow.yml index 40caa43..a6d6b75 100644 --- a/.github/workflows/smokeshow.yml +++ b/.github/workflows/smokeshow.yml @@ -22,7 +22,10 @@ jobs: Smokeshow: needs: Context runs-on: ubuntu-latest - + strategy: + matrix: + python-version: ["3.11"] + fail-fast: true steps: - name: Dump GitHub context env: @@ -30,15 +33,12 @@ jobs: run: echo "$GITHUB_CONTEXT" - uses: actions/setup-python@v5 with: - python-version: '3.11' - + python-version: ${{ matrix.python-version }} - run: pip install smokeshow - - uses: dawidd6/action-download-artifact@v2.28.0 with: workflow: tests.yml commit: ${{ github.event.workflow_run.head_sha }} - - run: smokeshow upload coverage env: SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage} diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 0000000..f2dd48a --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,23 @@ +name: SonarCloud Scan +on: + workflow_run: + workflows: [Test] + types: [completed] + +jobs: + sonarcloud: + name: SonarCloud + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - uses: actions/download-artifact@master + with: + name: coverage + path: coverage + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c04431f..d44fd95 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,7 +38,7 @@ jobs: pip install -r requirements.txt pip install -r requirements-tests.txt - name: Test - run: python -m pytest -n auto tests --cov=src --cov=tests --cov-report=html:coverage --cov-fail-under=85 + run: python -m pytest -n auto tests --cov=src --cov=tests --cov-report=xml --cov-report=html:coverage --cov-fail-under=85 - name: Store coverage files uses: actions/upload-artifact@v3 with: diff --git a/README.md b/README.md index 8d7aa76..38b5b7a 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,77 @@ # NTHU-Data-API -[![CodeFactor](https://www.codefactor.io/repository/github/nthu-sa/nthu-data-api/badge)](https://www.codefactor.io/repository/github/nthu-sa/nthu-data-api) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Smokeshow coverage](https://coverage-badge.samuelcolvin.workers.dev/NTHU-SA/NTHU-Data-API.svg)](https://coverage-badge.samuelcolvin.workers.dev/redirect/NTHU-SA/NTHU-Data-API) +

+ NTHU-Data-API is a project designed for NTHU developers. +
+ It provides an easy way to fetch data from the NTHU website. +

+

+ + Codefactor Score + + + Code style: black + + + Test Coverage + +
+ + Lines of Code + + + Technical Debt + +

+ ## Introduction -This is a project for NTHU students to get data from NTHU website. +NTHU-Data-API is a project designed for NTHU developers. It provides an easy way to fetch data from the NTHU website. -## Usage -### Install +## Getting Started +### Prerequisites +Ensure you have Python 3 installed on your machine. You can verify this by running `python3 --version` in your terminal. If you don't have Python 3 installed, you can download it [here](https://www.python.org/downloads/). +### Installation +1. Clone the repository: ```sh -pip3 install -r requirements.txt +git clone https://github.com/NTHU-SA/NTHU-Data-API.git ``` -### Config +2. Navigate to the project directory: ```sh -cp .env.template .env +cd NTHU-Data-API ``` -### Run +3. Install the required dependencies: ```sh -python3 main.py +pip3 install -r requirements.txt ``` - -## Notes -### Commit: -#### Type: -- feat: 新增/修改功能 (feature)。 -- fix: 修補 bug (bug fix)。 -- docs: 文件 (documentation)。 -- style: 格式 (不影響程式碼運行的變動 white-space, formatting, missing semi colons, etc)。 -- refactor: 重構 (既不是新增功能,也不是修補 bug 的程式碼變動)。 -- perf: 改善效能 (A code change that improves performance)。 -- test: 增加測試 (when adding missing tests)。 -- chore: 建構程序或輔助工具的變動 (maintain)。 -- revert: 撤銷回覆先前的 commit 例如:revert: type(scope): subject (回覆版本:xxxx)。 -#### Message Format: +### Configuration +Copy the environment template file and fill in your details: ```sh -(): - - - -