diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 59f2a5d..a0df3a9 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -29,10 +29,48 @@ jobs: name: requirements path: requirements.txt + setup-pipenv: + name: Setup Environment + needs: setup-requirements + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Check out repository code + uses: actions/checkout@v4.2.2 + + # Setup Python (faster than using Python container) + - name: Setup Python + uses: actions/setup-python@v5.3.0 + with: + python-version: "3.12.0" + + - name: Download Requirements + uses: actions/download-artifact@v4.1.8 + with: + name: requirements + path: . + + - name: Install Pipenv + run: python -m pip install --upgrade pipenv wheel + + - name: Cache Pipenv + id: cache-pipenv + uses: actions/cache@v4.1.2 + with: + path: ~/.local/share/virtualenvs + key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} + + - name: Install dependencies + if: steps.cache-pipenv.outputs.cache-hit != 'true' + run: | + pipenv install -r requirements.txt + pipenv lock pylint: name: PyLint runs-on: ubuntu-latest + needs: setup-pipenv timeout-minutes: 10 steps: @@ -45,9 +83,12 @@ jobs: with: python-version: "3.12.0" - - name: Install pipenv - run: | - python -m pip install --upgrade pipenv wheel + - name: Cache Pipenv + id: cache-pipenv + uses: actions/cache@v4.1.2 + with: + path: ~/.local/share/virtualenvs + key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} - name: Pylint on esbmc_ai run: | @@ -55,7 +96,7 @@ jobs: test: name: PyTest - needs: setup-requirements + needs: setup-pipenv runs-on: ubuntu-latest timeout-minutes: 10 @@ -69,15 +110,6 @@ jobs: with: python-version: "3.12.0" - - name: Download Requirements - uses: actions/download-artifact@v4.1.8 - with: - name: requirements - path: . - - - name: Install Environment - run: python -m pip install --upgrade pipenv wheel - - name: Cache Pipenv id: cache-pipenv uses: actions/cache@v4.1.2 @@ -85,11 +117,5 @@ jobs: path: ~/.local/share/virtualenvs key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} - - name: Install dependencies - if: steps.cache-pipenv.outputs.cache-hit != 'true' - run: | - pipenv install -r requirements.txt - pipenv lock - - name: Run test suite run: pipenv run pytest -v