From 2025fbd35276e776a7ab5d28b0809255cf2406c6 Mon Sep 17 00:00:00 2001 From: Isaac Cheng <47993930+IsaacCheng9@users.noreply.github.com> Date: Tue, 25 Jun 2024 23:10:59 +0100 Subject: [PATCH] Add test.yml workflow --- .github/workflows/test.yml | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7f97c2a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +name: Test + +# Controls when the action will run. +on: + # Triggers the workflow on push events but only for the main branch. + push: + # Allows you to run this workflow manually from the Actions tab. + workflow_dispatch: + +jobs: + test: + # The type of runner that the job will run on. + runs-on: macos-latest + # Configures the build to use the latest version of Python 3. + strategy: + matrix: + python-version: [3.12.x] + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can + # access it. + - uses: actions/checkout@main + + - name: Switch to current branch + run: git checkout ${{ env.BRANCH }} + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@main + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + run: | + python -m pip install --upgrade pip + pip install poetry + + - name: Install Python dependencies with Poetry + run: | + poetry install + + - name: Run unit tests with Pytest + run: poetry run coverage run --source=src/travel_buddy -m pytest -v + + - name: Get code coverage report + run: poetry run coverage report -m