mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Test pre-commit action
This commit is contained in:
		
							
								
								
									
										101
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										101
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							@@ -14,9 +14,24 @@ on:
 | 
			
		||||
      - 'translations**'
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  pre-commit:
 | 
			
		||||
    name: Linting Checks
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout repository
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
 | 
			
		||||
      - name: Install tools
 | 
			
		||||
        uses: actions/setup-python@v3
 | 
			
		||||
 | 
			
		||||
      - name: Check files
 | 
			
		||||
        uses: pre-commit/action@v3.0.0
 | 
			
		||||
 | 
			
		||||
  documentation:
 | 
			
		||||
    name: "Build Documentation"
 | 
			
		||||
    runs-on: ubuntu-20.04
 | 
			
		||||
    needs:
 | 
			
		||||
      - pre-commit
 | 
			
		||||
    steps:
 | 
			
		||||
      -
 | 
			
		||||
        name: Checkout
 | 
			
		||||
@@ -47,11 +62,85 @@ jobs:
 | 
			
		||||
          name: documentation
 | 
			
		||||
          path: docs/_build/html/
 | 
			
		||||
 | 
			
		||||
  ci-backend:
 | 
			
		||||
    uses: ./.github/workflows/reusable-ci-backend.yml
 | 
			
		||||
  tests-backend:
 | 
			
		||||
    name: "Tests (${{ matrix.python-version }})"
 | 
			
		||||
    runs-on: ubuntu-20.04
 | 
			
		||||
    needs:
 | 
			
		||||
      - pre-commit
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        python-version: ['3.8', '3.9', '3.10']
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
    steps:
 | 
			
		||||
      -
 | 
			
		||||
        name: Checkout
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
        with:
 | 
			
		||||
          fetch-depth: 2
 | 
			
		||||
      -
 | 
			
		||||
        name: Install pipenv
 | 
			
		||||
        run: pipx install pipenv
 | 
			
		||||
      -
 | 
			
		||||
        name: Set up Python
 | 
			
		||||
        uses: actions/setup-python@v4
 | 
			
		||||
        with:
 | 
			
		||||
          python-version: "${{ matrix.python-version }}"
 | 
			
		||||
          cache: "pipenv"
 | 
			
		||||
          cache-dependency-path: 'Pipfile.lock'
 | 
			
		||||
      -
 | 
			
		||||
        name: Install system dependencies
 | 
			
		||||
        run: |
 | 
			
		||||
          sudo apt-get update -qq
 | 
			
		||||
          sudo apt-get install -qq --no-install-recommends unpaper tesseract-ocr imagemagick ghostscript libzbar0 poppler-utils
 | 
			
		||||
      -
 | 
			
		||||
        name: Install Python dependencies
 | 
			
		||||
        run: |
 | 
			
		||||
          pipenv sync --dev
 | 
			
		||||
      -
 | 
			
		||||
        name: Tests
 | 
			
		||||
        run: |
 | 
			
		||||
          cd src/
 | 
			
		||||
          pipenv run pytest
 | 
			
		||||
      -
 | 
			
		||||
        name: Get changed files
 | 
			
		||||
        id: changed-files-specific
 | 
			
		||||
        uses: tj-actions/changed-files@v24
 | 
			
		||||
        with:
 | 
			
		||||
          files: |
 | 
			
		||||
            src/**
 | 
			
		||||
      -
 | 
			
		||||
        name: List all changed files
 | 
			
		||||
        run: |
 | 
			
		||||
          for file in ${{ steps.changed-files-specific.outputs.all_changed_files }}; do
 | 
			
		||||
            echo "${file} was changed"
 | 
			
		||||
          done
 | 
			
		||||
      -
 | 
			
		||||
        name: Publish coverage results
 | 
			
		||||
        if: matrix.python-version == '3.9' && steps.changed-files-specific.outputs.any_changed == 'true'
 | 
			
		||||
        env:
 | 
			
		||||
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
        # https://github.com/coveralls-clients/coveralls-python/issues/251
 | 
			
		||||
        run: |
 | 
			
		||||
          cd src/
 | 
			
		||||
          pipenv run coveralls --service=github
 | 
			
		||||
 | 
			
		||||
  ci-frontend:
 | 
			
		||||
    uses: ./.github/workflows/reusable-ci-frontend.yml
 | 
			
		||||
  tests-frontend:
 | 
			
		||||
    name: "Tests"
 | 
			
		||||
    runs-on: ubuntu-20.04
 | 
			
		||||
    needs:
 | 
			
		||||
      - pre-commit
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        node-version: [16.x]
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - name: Use Node.js ${{ matrix.node-version }}
 | 
			
		||||
        uses: actions/setup-node@v3
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: ${{ matrix.node-version }}
 | 
			
		||||
      - run: cd src-ui && npm ci
 | 
			
		||||
      - run: cd src-ui && npm run test
 | 
			
		||||
      - run: cd src-ui && npm run e2e:ci
 | 
			
		||||
 | 
			
		||||
  prepare-docker-build:
 | 
			
		||||
    name: Prepare Docker Pipeline Data
 | 
			
		||||
@@ -65,8 +154,8 @@ jobs:
 | 
			
		||||
      cancel-in-progress: false
 | 
			
		||||
    needs:
 | 
			
		||||
      - documentation
 | 
			
		||||
      - ci-backend
 | 
			
		||||
      - ci-frontend
 | 
			
		||||
      - tests-backend
 | 
			
		||||
      - tests-frontend
 | 
			
		||||
    steps:
 | 
			
		||||
      -
 | 
			
		||||
        name: Set ghcr repository name
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user