Skip to content

Commit

Permalink
Changes in cookiecutter-e2e.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mkranna committed Mar 20, 2023
1 parent d644cd6 commit 2023ade
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 28 deletions.
57 changes: 32 additions & 25 deletions .github/workflows/cookiecutter-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,41 @@ jobs:
lint:
name: Lint ${{ matrix.cookiecutter }}, Replay ${{ matrix.replay }} on ${{ matrix.python-version }} ${{ matrix.python-version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
NOXSESSION: ${{ matrix.session }}
strategy:
fail-fast: true
matrix:
include:
- { cookiecutter: "tap-template", replay: "tap-graphql-jwt.json", python-version: "3.9", os: "ubuntu-latest" }
- { cookiecutter: "tap-template", replay: "tap-rest-api_key-github.json", python-version: "3.9", os: "ubuntu-latest" }
- { cookiecutter: "tap-template", replay: "tap-rest-basic_auth.json", python-version: "3.9", os: "ubuntu-latest" }
- { cookiecutter: "tap-template", replay: "tap-rest-bearer_token.json", python-version: "3.9", os: "ubuntu-latest" }
- { cookiecutter: "tap-template", replay: "tap-rest-custom.json", python-version: "3.9", os: "ubuntu-latest" }
- { cookiecutter: "tap-template", replay: "tap-rest-jwt.json", python-version: "3.9", os: "ubuntu-latest" }
- { cookiecutter: "tap-template", replay: "tap-rest-oauth2.json", python-version: "3.9", os: "ubuntu-latest" }
- { cookiecutter: "tap-template", replay: "tap-other-custom.json", python-version: "3.9", os: "ubuntu-latest" }
- { cookiecutter: "tap-template", replay: "tap-sql-custom.json", python-version: "3.9", os: "ubuntu-latest" }
- { cookiecutter: "target-template", replay: "target-per_record.json", python-version: "3.9", os: "ubuntu-latest" }
- { session: test_cookiecutter(replay_file_path="tap-graphql-jwt.json"), cookiecutter: "tap-template", replay: "tap-graphql-jwt.json", python-version: "3.9", os: "ubuntu-latest" }
- { session: test_cookiecutter(replay_file_path="tap-rest-api_key-github.json"), cookiecutter: "tap-template", replay: "tap-rest-api_key-github.json", python-version: "3.9", os: "ubuntu-latest" }
- { session: test_cookiecutter(replay_file_path="tap-rest-basic_auth.json"), cookiecutter: "tap-template", replay: "tap-rest-basic_auth.json", python-version: "3.9", os: "ubuntu-latest" }
- { session: test_cookiecutter(replay_file_path= "tap-rest-bearer_token.json"), cookiecutter: "tap-template", replay: "tap-rest-bearer_token.json", python-version: "3.9", os: "ubuntu-latest" }
- { session: test_cookiecutter(replay_file_path="tap-rest-custom.json"), cookiecutter: "tap-template", replay: "tap-rest-custom.json", python-version: "3.9", os: "ubuntu-latest" }
- { session: test_cookiecutter(replay_file_path="tap-rest-jwt.json"), cookiecutter: "tap-template", replay: "tap-rest-jwt.json", python-version: "3.9", os: "ubuntu-latest" }
- { session: test_cookiecutter(replay_file_path="tap-rest-oauth2.json"), cookiecutter: "tap-template", replay: "tap-rest-oauth2.json", python-version: "3.9", os: "ubuntu-latest" }
- { session: test_cookiecutter(replay_file_path="tap-other-custom.json"), cookiecutter: "tap-template", replay: "tap-other-custom.json", python-version: "3.9", os: "ubuntu-latest" }
- { session: test_cookiecutter(replay_file_path="tap-sql-custom.json"), cookiecutter: "tap-template", replay: "tap-sql-custom.json", python-version: "3.9", os: "ubuntu-latest" }
- { session: test_cookiecutter(replay_file_path="target-per_record.json"), cookiecutter: "target-template", replay: "target-per_record.json", python-version: "3.9", os: "ubuntu-latest" }

steps:
- name: Check out the repository
uses: actions/[email protected]

- name: Install Poetry
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pipx install poetry
poetry --version
- name: Setup Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
cache-dependency-path: 'poetry.lock'

- name: Upgrade pip
env:
Expand All @@ -52,32 +63,28 @@ jobs:
pip install pip
pip --version
- name: Install Poetry, Tox & Cookiecutter
- name: Install Nox
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pipx install poetry
pipx install cookiecutter
pipx install tox
- name: Build cookiecutter project
env:
CC_TEMPLATE: cookiecutter/${{ matrix.cookiecutter }}
REPLAY_FILE: e2e-tests/cookiecutters/${{ matrix.replay }}
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
nox --version
- name: Run Nox
run: |
chmod +x ./e2e-tests/cookiecutters/test_cookiecutter.sh
./e2e-tests/cookiecutters/test_cookiecutter.sh $CC_TEMPLATE $REPLAY_FILE 0
nox --python=${{ matrix.python-version }}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.replay }}
path: |
${{ env.CC_TEST_OUTPUT }}/
!${{ env.CC_TEST_OUTPUT }}/.mypy_cache/
${{ env.cc_test_output }}/
!${{ env.cc_test_output }}/.mypy_cache/
- name: Run lint
env:
REPLAY_FILE: e2e-tests/cookiecutters/${{ matrix.replay }}
run: |
cd $CC_TEST_OUTPUT
cd $cc_test_output
poetry run tox -e lint
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Run a test against tap-template cookiecutter against the `tap-rest-api_key-githu
bash test_cookiecutter.sh ../../cookiecutter/tap-template ./tap-rest-api_key-github.json
bash test_cookiecutter.sh ../../cookiecutter/target-template ./target-per_record.json
```

6 changes: 3 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ def docs_serve(session: Session) -> None:


@nox.parametrize('replay_file_path', glob.glob('./e2e-tests/cookiecutters/*.json'))
@session(python="3.10")
@session(python=python_versions)
def test_cookiecutter(session: Session, replay_file_path) -> None:
"""Uses the tap template to build an empty cookiecutter, and runs the lint task on the created test project."""
args = session.posargs or [1]
args = session.posargs or ["run_tox"]

cc_build_path = "/tmp"
folder_base_path = "./cookiecutter"
Expand Down Expand Up @@ -223,5 +223,5 @@ def test_cookiecutter(session: Session, replay_file_path) -> None:
for argument in ["black", "isort", "flake8", "mypy"]:
session.run("poetry", "run", argument, library_name, external=True)

if int(args[0]) == 1:
if int(args[0]) == "run_tox":
session.run("poetry", "run", "tox", "-e", "lint", external=True)

0 comments on commit 2023ade

Please sign in to comment.