adding poetry and caching to actions build
This commit is contained in:
		
							
								
								
									
										49
									
								
								.github/workflows/github-actions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										49
									
								
								.github/workflows/github-actions.yml
									
									
									
									
										vendored
									
									
								
							@@ -4,22 +4,55 @@ on: [push, pull_request]
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
      - name: Set up Python 3.9
 | 
			
		||||
        uses: actions/setup-python@v2
 | 
			
		||||
        with:
 | 
			
		||||
          python-version: 3.9
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
 | 
			
		||||
      - name: Get full Python version
 | 
			
		||||
        id: full-python-version
 | 
			
		||||
        shell: bash
 | 
			
		||||
        run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
 | 
			
		||||
 | 
			
		||||
      - name: Bootstrap poetry
 | 
			
		||||
        shell: bash
 | 
			
		||||
        run: |
 | 
			
		||||
          python -m pip install --upgrade pip
 | 
			
		||||
          pip install -r requirements.txt
 | 
			
		||||
          pip install -r requirements_dev.txt
 | 
			
		||||
          curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \
 | 
			
		||||
            | python - -y 
 | 
			
		||||
 | 
			
		||||
      - name: Update PATH
 | 
			
		||||
        if: ${{ matrix.os != 'Windows' }}
 | 
			
		||||
        shell: bash
 | 
			
		||||
        run: echo "$HOME/.local/bin" >> $GITHUB_PATH
 | 
			
		||||
 | 
			
		||||
      - name: Configure poetry
 | 
			
		||||
        shell: bash
 | 
			
		||||
        run: poetry config virtualenvs.in-project true
 | 
			
		||||
 | 
			
		||||
      - name: Set up cache
 | 
			
		||||
        uses: actions/cache@v2
 | 
			
		||||
        id: cache
 | 
			
		||||
        with:
 | 
			
		||||
          path: .venv
 | 
			
		||||
          key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
 | 
			
		||||
 | 
			
		||||
      - name: Ensure cache is healthy
 | 
			
		||||
        if: steps.cache.outputs.cache-hit == 'true'
 | 
			
		||||
        shell: bash
 | 
			
		||||
        run: timeout 10s poetry run pip --version || rm -rf .venv
 | 
			
		||||
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        shell: bash
 | 
			
		||||
        run: poetry install
 | 
			
		||||
 | 
			
		||||
      - name: Run precommit
 | 
			
		||||
        run: |
 | 
			
		||||
          pre-commit run --all-files
 | 
			
		||||
      - name: Test with unittest
 | 
			
		||||
        run: |
 | 
			
		||||
          python -m unittest tests/*.py
 | 
			
		||||
 | 
			
		||||
      - name: Test with pytest
 | 
			
		||||
        shell: bash
 | 
			
		||||
        run: poetry run test
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user