Add entry point to run main function #5
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
| # Name for your GitHub Actions workflow | |
| name: GraphQLNomad CI/CD | |
| # Controls when the action will run. | |
| on: | |
| # Triggers the workflow on push or pull request events for the main branch | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| # Allows you to run this workflow manually from the Actions tab on GitHub | |
| workflow_dispatch: | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # This workflow contains a single job called "build" | |
| build: | |
| # The type of runner that the job will run on | |
| runs-on: ubuntu-latest | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| # Step 1: Checks out your repository's code | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # Step 2: Sets up a specific version of Python | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| # Step 3: Installs dependencies from requirements.txt | |
| # This is now the standard way to handle Python dependencies. | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install flake8 # We still install flake8 for linting | |
| # Step 4: Lints the code with flake8 to check for style issues | |
| - name: Lint with flake8 | |
| run: | | |
| # Stop the build if there are Python syntax errors or undefined names | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # Exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| # Step 5: Runs a basic test by executing the script with the --help argument | |
| - name: Run basic test | |
| run: python graphqlnomad.py --help |