Run Tests #37
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is a GitHub Actions yaml file. | |
| # This file will build and test the application. | |
| # The name of the workflow. This is the name that will be displayed on the Actions tab. | |
| name: Run Tests | |
| # The event that triggers the workflow. | |
| # In GitHub Actions, the 'on' mapping is used to specify the events that will | |
| # trigger the workflow. The on mapping is a required key in the workflow file | |
| # and must be present in order to define when the workflow should run. | |
| # In this case, this 'on': | |
| # Triggers the workflow on a push or pull-request event to the 'main' or 'test-github-actions' branch. | |
| # A new commit pushed to the branch is considered a push event. | |
| on: | |
| push: | |
| paths: | |
| - "cloudgoat/**/*.py" | |
| - "cloudgoat/*.py" | |
| pull_request: | |
| paths: | |
| - "cloudgoat/**/*.py" | |
| - "cloudgoat/*.py" | |
| workflow_dispatch: | |
| # A job is a set of steps in a workflow that is executed on the same runner. | |
| # Each step is either: | |
| # - a shell script that will be executed | |
| # - an action that will be run. | |
| # Steps are executed in order and are dependent on each other. | |
| # Since each step can share data from one step to another. | |
| # For example, you can have a step that builds your application | |
| # followed by a step that tests the application that was built. | |
| jobs: | |
| # This is the 'checkout-and-test' job. | |
| # 1. checkout the repository code. | |
| # 2. run the software tests. | |
| build-and-test: | |
| # Use an Ubuntu virtual machine to run the job. | |
| runs-on: ubuntu-latest | |
| # The 'strategy' key allows you to define a matrix of values that will be used to | |
| # generate a build matrix. | |
| strategy: | |
| # The 'matrix' key is used to define the values that will be used to generate the build matrix. | |
| matrix: | |
| # The 'python-version' key is used to define the Python versions that will be used. | |
| python-version: [ | |
| "3.10.x", # Older but still supported | |
| "3.13.x", # Latest stable | |
| ] | |
| # The steps that the job will execute. | |
| steps: | |
| # Checkout the repository code. | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| # Set up Python. | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v1 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Install Poetry and dependencies | |
| - name: Install Poetry | |
| run: pip install poetry | |
| - name: Install dependencies | |
| run: poetry install | |
| # Install pytest (if not in poetry dependencies) | |
| - name: Install pytest | |
| run: poetry run pip install pytest || true | |
| # Run the tests. | |
| - name: Run pytest tests | |
| run: poetry run pytest tests/ -v | |
| # Run unittest tests. | |
| - name: Run unittest tests | |
| run: poetry run python -m unittest discover -s tests/ -p "*tests.py" |