diff --git a/.github/workflows/build_lint.yml b/.github/workflows/build_lint.yml index 3ba7340b2d3..9101ba05b00 100644 --- a/.github/workflows/build_lint.yml +++ b/.github/workflows/build_lint.yml @@ -50,12 +50,30 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - if: ${{ runner.os == 'Windows' }} + # This is needed so that restoring cache on Windows is fast. + # See until https://github.com/actions/cache/issues/752 is resolved. + name: Use GNU tar + shell: cmd + run: | + echo "Adding GNU tar to PATH" + echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" - uses: actions/cache@v3 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('Pipfile.lock') }} + path: ${{ env.pythonLocation }} + key: ${{ runner.os }}-pip-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }} - name: Install dependencies - run: pip install wheel && pip install .[dev] + # Only if the cache misses + # Based on https://github.com/pypa/pip/issues/8049#issuecomment-633845028 + # read_requirements.py should be removed once + # https://github.com/pypa/pip/issues/11440 is resolved. + if: steps.cache.outputs.cache-hit != 'true' + run: | + pip install toml + python tests/read_requirements.py > requirements.txt + pip install -r requirements.txt + - name: Install Mesa + run: pip install --no-deps . - name: Test with pytest run: pytest --cov=mesa tests/ --cov-report=xml - if: matrix.os == 'ubuntu' diff --git a/tests/read_requirements.py b/tests/read_requirements.py new file mode 100644 index 00000000000..83ccfd95219 --- /dev/null +++ b/tests/read_requirements.py @@ -0,0 +1,8 @@ +import toml + +# This file reads the pyproject.toml and prints out the +# dependencies and dev dependencies. +# It is located in tests/ folder so as not to pollute the root repo. +c = toml.load("pyproject.toml") +print("\n".join(c["project"]["dependencies"])) +print("\n".join(c["project"]["optional-dependencies"]["dev"]))