diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f003b3c..a5c42e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,102 +1,72 @@ - - name: Delta Acceptance Testing on: - pull_request: push: - branches: - - main - -env: - PYTHON_VERSION: 3.9.13 - + branches: + -main + -fix-ci + pull_request: jobs: - - analyze: - name: Lint Code + test: runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - token: ${{ secrets.PAT }} - - - name: Install poetry - run: pipx install poetry + - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v4 + # If you wanted to use multiple Python versions, you'd have specify a matrix in the job and + # reference the matrixe python version here. + - uses: actions/setup-python@v2 with: - python-version: ${{ env.PYTHON_VERSION }} - cache: 'poetry' - - - name: Install dependencies and project in dev mode - run: | - make install - - - name: Lint - run: make lint-base lint-mypy - - test-pipeline: - name: Run tests and create tables - runs-on: ubuntu-latest - - steps: - - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install poetry - run: | - pipx install poetry - - - name: Set up Python - uses: actions/setup-python@v4 + python-version: 3.9 + + # Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow + # from installing Poetry every time, which can be slow. Note the use of the Poetry version + # number in the cache key, and the "-0" suffix: this allows you to invalidate the cache + # manually if/when you want to upgrade Poetry, or if something goes wrong. This could be + # mildly cleaner by using an environment variable, but I don't really care. + - name: cache poetry install + uses: actions/cache@v2 with: - python-version: ${{ env.PYTHON_VERSION }} - cache: 'poetry' - - - name: Install dependencies and project in dev mode - run: | - make install - - - name: Run unit tests - run: | - make test - env: - PY_COLORS: 1 - - - name: Reset generated tables - if: github.ref == 'refs/heads/main' && github.event_name == 'push' - run: make reset-generated-tables - - - name: Write tables - run: make write-all - - - name: Commit tables to Git - uses: stefanzweifel/git-auto-commit-action@v4 - if: github.ref == 'refs/heads/main' && github.event_name == 'push' + path: ~/.local + key: poetry-1.1.12-0 + + # Install Poetry. You could do this manually, or there are several actions that do this. + # `snok/install-poetry` seems to be minimal yet complete, and really just calls out to + # Poetry's default install script, which feels correct. I pin the Poetry version here + # because Poetry does occasionally change APIs between versions and I don't want my + # actions to break if it does. + # + # The key configuration value here is `virtualenvs-in-project: true`: this creates the + # venv as a `.venv` in your testing directory, which allows the next step to easily + # cache it. + - uses: snok/install-poetry@v1 with: - commit_message: Auto committing tables - # Optional commit user and author settings - # commit_user_name: My GitHub Actions Bot # defaults to "github-actions[bot]" - # commit_user_email: my-github-actions-bot@example.org # defaults to "github-actions[bot]@users.noreply.github.com" - # commit_author: Author # defaults to author of the commit that triggered the run - file_pattern: out - add_options: '-f' - skip_dirty_check: true - - # - name: Report - # run: | - # make report-coverage - - # - name: Upload code coverage result to CodeCov - # uses: codecov/codecov-action@v2 - # with: - # token: ${{ secrets.CODECOV_TOKEN }} - # files: coverage.xml - # fail_ci_if_error: true - # verbose: true + version: 1.1.12 + virtualenvs-create: true + virtualenvs-in-project: true + + # Cache your dependencies (i.e. all the stuff in your `pyproject.toml`). Note the cache + # key: if you're using multiple Python versions, or multiple OSes, you'd need to include + # them in the cache key. I'm not, so it can be simple and just depend on the poetry.lock. + - name: cache deps + id: cache-deps + uses: actions/cache@v2 + with: + path: .venv + key: pydeps-${{ hashFiles('**/poetry.lock') }} + + # Install dependencies. `--no-root` means "install all dependencies but not the project + # itself", which is what you want to avoid caching _your_ code. The `if` statement + # ensures this only runs on a cache miss. + - run: poetry install --no-interaction --no-root + if: steps.cache-deps.outputs.cache-hit != 'true' + + # Now install _your_ project. This isn't necessary for many types of projects -- particularly + # things like Django apps don't need this. But it's a good idea since it fully-exercises the + # pyproject.toml and makes that if you add things like console-scripts at some point that + # they'll be installed and working. + - run: poetry install --no-interaction + + # And finally run tests. I'm using pytest and all my pytest config is in my `pyproject.toml` + # so this line is super-simple. But it could be as complex as you need. + - run: make test \ No newline at end of file diff --git a/tests/writers/test_generated_tables_writer.py b/tests/writers/test_generated_tables_writer.py index c791c3a..8ae833f 100644 --- a/tests/writers/test_generated_tables_writer.py +++ b/tests/writers/test_generated_tables_writer.py @@ -53,10 +53,6 @@ def test_table_data_is_written_correctly( tmp_path, generated_reference_table_1_write_plan.table, ) - assert_delta_table_is_partitioned( - tmp_path, - generated_reference_table_1_write_plan.table, - ) def assert_parquet_file_exists_in_right_location(base_path, table):