diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index a0df3a9..6761dd7 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -17,25 +17,36 @@ jobs: - name: Check out repository code uses: actions/checkout@v4.2.2 + - name: Get Hatch Dependency Hash + run: echo "HATCH_DEP_HASH=$(hatch dep hash)" >> $GITHUB_ENV + + - name: Cache Hatch environment + uses: actions/cache@v4.1.2 + with: + path: ~/.cache/hatch + key: ${{ runner.os }}-hatch-${{ env.HATCH_DEP_HASH }} + - name: Install Hatch + if: steps.cache-hatch.outputs.cache-hit != 'true' run: python -m pip install --upgrade hatch - name: Generate Requirements run: python -m hatch dep show requirements > requirements.txt + # Upload requirements to have them - name: Upload Requirements uses: actions/upload-artifact@v4.4.3 with: name: requirements path: requirements.txt - setup-pipenv: - name: Setup Environment - needs: setup-requirements + build: + name: Build runs-on: ubuntu-latest + needs: setup-requirements timeout-minutes: 10 - steps: + seteps: - name: Check out repository code uses: actions/checkout@v4.2.2 @@ -44,33 +55,26 @@ jobs: 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 + - name: Cache Hatch environment uses: actions/cache@v4.1.2 with: - path: ~/.local/share/virtualenvs - key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} + path: ~/.cache/hatch + key: ${{ runner.os }}-hatch-${{ env.HATCH_DEP_HASH }} - - name: Install dependencies - if: steps.cache-pipenv.outputs.cache-hit != 'true' - run: | - pipenv install -r requirements.txt - pipenv lock + - name: Hatch build + run: hatch build + + - name: Upload build files + uses: actions/upload-artifact@v4.4.3 + with: + name: build + path: dist pylint: name: PyLint runs-on: ubuntu-latest - needs: setup-pipenv + needs: setup-requirements timeout-minutes: 10 steps: @@ -83,20 +87,18 @@ jobs: with: python-version: "3.12.0" - - name: Cache Pipenv - id: cache-pipenv + - name: Cache Hatch environment uses: actions/cache@v4.1.2 with: - path: ~/.local/share/virtualenvs - key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} + path: ~/.cache/hatch + key: ${{ runner.os }}-hatch-${{ env.HATCH_DEP_HASH }} - name: Pylint on esbmc_ai - run: | - pipenv run pylint esbmc_ai + run: hatch run pylint esbmc_ai test: name: PyTest - needs: setup-pipenv + needs: setup-requirements runs-on: ubuntu-latest timeout-minutes: 10 @@ -110,12 +112,12 @@ jobs: with: python-version: "3.12.0" - - name: Cache Pipenv - id: cache-pipenv + - name: Cache Hatch environment uses: actions/cache@v4.1.2 with: - path: ~/.local/share/virtualenvs - key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} + path: ~/.cache/hatch + key: ${{ runner.os }}-hatch-${{ env.HATCH_DEP_HASH }} - name: Run test suite - run: pipenv run pytest -v + run: hatch run pytest + \ No newline at end of file