Hi there!
I’m trying to restructure a basic config.YAML
file that I made based on a Real Python course into two jobs: build and unittest, and then add those two jobs to a workflow. I’m doing this based on a read-through of the documentation, where I learned about the building blocks of workflows > jobs > steps.
The structure I want to follow is modeled here in the docs.
Here’s the Real Python version, which works well and I’ve integrated into my GitHub checks.
# Python CircleCI 2.0 configuration file
version: 2
jobs:
build:
docker:
- image: circleci/python:3.8
working_directory: ~/repo
steps:
# Step 1: obtain repo from GitHub
- checkout
# Step 2: create virtual env and install dependencies
- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
# Step 3: run linter and tests
- run:
name: run tests
command: |
. venv/bin/activate
pytest -v --cov
And here is my restructured version based on the “Sequential Workflow” template in the docs:
# Python CircleCI 2.0 configuration file
version: 2
jobs:
build:
docker:
- image: circleci/python:3.8
working_directory: ~/repo
steps:
# Step 1: obtain repo from GitHub
- checkout
# Step 2: create virtual env and install dependencies
- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
unittest:
docker:
- image: circleci/python:3.8
# Step 3: run linter and tests
steps :
- checkout
- run:
name: run tests
command: |
. venv/bin/activate
pytest -v --cov
workflows:
build_and_test:
jobs:
- build
- unittest:
requires:
-build
So now I have this restructured version in my project repo’s master branch. When I try to push a test commit, I get this error message in CircleCI:
#!/bin/sh -eo pipefail
# Unsupported or missing workflows config version
#
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false
Exited with code exit status 1
I’m one day old at this stuff, and quite confused. What have I done wrong?