Skip to content

ci: fix working directory of loaded cached venv #115

ci: fix working directory of loaded cached venv

ci: fix working directory of loaded cached venv #115

Workflow file for this run

name: CI
on: [push]
jobs:
build_and_publish_dotnet:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
dotnet-version: [ '7.0.x' ]
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
source-url: https://nuget.pkg.github.com/arjendev/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Install dependencies
run: dotnet restore
working-directory: ./src/dotnet
- name: Build
run: dotnet build --configuration Release --no-restore
working-directory: ./src/dotnet
- name: Test
run: dotnet test --no-restore --verbosity normal
working-directory: ./src/dotnet
- name: Upload dotnet test results
uses: actions/upload-artifact@v3
with:
name: dotnet-results-${{ matrix.dotnet-version }}
path: ./src/dotnet/TestResults-${{ matrix.dotnet-version }}
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Create the package
run: dotnet pack --configuration Release src/dotnet/AzureDataFactory.TestingFramework
- name: Publish the package to GPR
if: github.ref == 'refs/heads/main'
run: dotnet nuget push src/dotnet/AzureDataFactory.TestingFramework/bin/Release/*.nupkg --source "https://nuget.pkg.github.com/arjendev/index.json" --api-key ${{ secrets.PUBLISH_KEY }} --skip-duplicate
build_and_publish_python:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.9'
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
working-directory: ./src/python
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install project
working-directory: ./src/python
run: poetry install --no-interaction
#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Run tests
working-directory: ./src/python
run: |
source .venv/bin/activate
pytest tests/
coverage report