mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-09 09:58:20 -05:00
move everything into a single file so that the docker image build can depend on the tests being successful
This commit is contained in:
parent
2c4bbf8a00
commit
a4bff61e5b
140
.github/workflows/ci.yml
vendored
Normal file
140
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
name: docker
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
documentation:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install python version
|
||||||
|
uses: gabrielfalcao/pyenv-action@v7
|
||||||
|
with:
|
||||||
|
default: "3.6.8"
|
||||||
|
command: "pip install -U pip"
|
||||||
|
- name: Get pip cache dir
|
||||||
|
id: pip-cache
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=dir::$(pip cache dir)"
|
||||||
|
- name: Persistent Github pip cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-pip3.6.8}
|
||||||
|
- name: dependencies
|
||||||
|
# instead of directly installing the dependency in the workflow file, can this be done using the pipfile instead?
|
||||||
|
run: |
|
||||||
|
pip install 'sphinx~=3.3' sphinx_rtd_theme
|
||||||
|
- name: make
|
||||||
|
run: |
|
||||||
|
cd docs/
|
||||||
|
make html
|
||||||
|
|
||||||
|
tests:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-20.04 ]
|
||||||
|
python: # pyenv-action requires the exact version
|
||||||
|
- 3.6.8
|
||||||
|
- 3.7.9
|
||||||
|
- 3.8.6
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install python version
|
||||||
|
uses: gabrielfalcao/pyenv-action@v7
|
||||||
|
with:
|
||||||
|
default: "${{ matrix.python }}"
|
||||||
|
command: "pip install -U pip"
|
||||||
|
- name: Get pip cache dir
|
||||||
|
id: pip-cache
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=dir::$(pip cache dir)"
|
||||||
|
- name: Persistent Github pip cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-pip${{ matrix.python }}
|
||||||
|
- name: Tests
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
sudo apt-get update -qq
|
||||||
|
sudo apt-get install -qq libpoppler-cpp-dev unpaper tesseract-ocr imagemagick ghostscript optipng
|
||||||
|
pip install --upgrade pipenv
|
||||||
|
pipenv install --system --dev
|
||||||
|
cd src/
|
||||||
|
pipenv run pytest --cov
|
||||||
|
pipenv run pycodestyle
|
||||||
|
pipenv run coveralls
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '15'
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
cd src-ui/
|
||||||
|
npm install -g @angular/cli
|
||||||
|
npm install
|
||||||
|
ng build --prod
|
||||||
|
|
||||||
|
# build and push image to docker hub.
|
||||||
|
build-docker-image:
|
||||||
|
if: github.event_name == push && (github.ref == refs/heads/master || github.ref == refs/heads/dev || github.ref == refs/tags/ng-*)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: tests
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Prepare
|
||||||
|
id: prepare
|
||||||
|
run: |
|
||||||
|
VERSION=edge
|
||||||
|
if [[ $GITHUB_REF == refs/tags/ng-* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/ng-}
|
||||||
|
fi
|
||||||
|
if [[ $GITHUB_REF == refs/heads/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/heads/}
|
||||||
|
fi
|
||||||
|
echo ::set-output name=version::${VERSION}
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
-
|
||||||
|
name: Cache Docker layers
|
||||||
|
uses: pat-s/always-upload-cache@v2.1.3
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm/v7
|
||||||
|
push: true
|
||||||
|
tags: jonaswinkler/paperless-ng:${{ steps.prepare.outputs.version }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
-
|
||||||
|
name: Inspect image
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools inspect jonaswinkler/paperless-ng:${{ steps.prepare.outputs.version }}
|
70
.github/workflows/docker.yml
vendored
70
.github/workflows/docker.yml
vendored
@ -1,70 +0,0 @@
|
|||||||
name: docker
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- dev
|
|
||||||
- travis-multiarch-builds
|
|
||||||
tags:
|
|
||||||
- 'ng-*'
|
|
||||||
|
|
||||||
|
|
||||||
# --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
|
||||||
# --build-arg VCS_REF=${GITHUB_SHA::8} \
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# build and push image to docker hub.
|
|
||||||
buildx:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Prepare
|
|
||||||
id: prepare
|
|
||||||
run: |
|
|
||||||
VERSION=edge
|
|
||||||
if [[ $GITHUB_REF == refs/tags/ng-* ]]; then
|
|
||||||
VERSION=${GITHUB_REF#refs/tags/ng-}
|
|
||||||
fi
|
|
||||||
if [[ $GITHUB_REF == refs/heads/* ]]; then
|
|
||||||
VERSION=${GITHUB_REF#refs/heads/}
|
|
||||||
fi
|
|
||||||
echo ::set-output name=version::${VERSION}
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
-
|
|
||||||
name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
-
|
|
||||||
name: Cache Docker layers
|
|
||||||
uses: pat-s/always-upload-cache@v2.1.3
|
|
||||||
with:
|
|
||||||
path: /tmp/.buildx-cache
|
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-buildx-
|
|
||||||
-
|
|
||||||
name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
-
|
|
||||||
name: Build and push
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm/v7
|
|
||||||
push: true
|
|
||||||
tags: jonaswinkler/paperless-ng:${{ steps.prepare.outputs.version }}
|
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
||||||
-
|
|
||||||
name: Inspect image
|
|
||||||
run: |
|
|
||||||
docker buildx imagetools inspect jonaswinkler/paperless-ng:${{ steps.prepare.outputs.version }}
|
|
33
.github/workflows/documentation.yml
vendored
33
.github/workflows/documentation.yml
vendored
@ -1,33 +0,0 @@
|
|||||||
name: documentation
|
|
||||||
|
|
||||||
# always run documentation workflow to ensure the documentation can still be built
|
|
||||||
on: [push, pull_request]
|
|
||||||
|
|
||||||
# possibly add a publish job for automatic read-the-docs publishing
|
|
||||||
jobs:
|
|
||||||
documentation:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Install python version
|
|
||||||
uses: gabrielfalcao/pyenv-action@v7
|
|
||||||
with:
|
|
||||||
default: "3.6.8"
|
|
||||||
command: "pip install -U pip"
|
|
||||||
- name: Get pip cache dir
|
|
||||||
id: pip-cache
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=dir::$(pip cache dir)"
|
|
||||||
- name: Persistent Github pip cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-pip3.6.8}
|
|
||||||
- name: dependencies
|
|
||||||
# instead of directly installing the dependency in the workflow file, can this be done using the pipfile instead?
|
|
||||||
run: |
|
|
||||||
pip install 'sphinx~=3.3' sphinx_rtd_theme
|
|
||||||
- name: make
|
|
||||||
run: |
|
|
||||||
cd docs/
|
|
||||||
make html
|
|
19
.github/workflows/frontend.yml
vendored
19
.github/workflows/frontend.yml
vendored
@ -1,19 +0,0 @@
|
|||||||
name: frontend
|
|
||||||
|
|
||||||
# always run frontend workflow to see if it builds and tests run fine
|
|
||||||
on: [push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
frontend:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: '15'
|
|
||||||
- name: build
|
|
||||||
run: |
|
|
||||||
cd src-ui/
|
|
||||||
npm install -g @angular/cli
|
|
||||||
npm install
|
|
||||||
ng build --prod
|
|
43
.github/workflows/test.yml
vendored
43
.github/workflows/test.yml
vendored
@ -1,43 +0,0 @@
|
|||||||
name: backend-tests
|
|
||||||
|
|
||||||
# always run tests workflow
|
|
||||||
on: [push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
tests:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-20.04]
|
|
||||||
python: # pyenv-action requires the exact version
|
|
||||||
- 3.6.8
|
|
||||||
- 3.7.9
|
|
||||||
- 3.8.6
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Install python version
|
|
||||||
uses: gabrielfalcao/pyenv-action@v7
|
|
||||||
with:
|
|
||||||
default: "${{ matrix.python }}"
|
|
||||||
command: "pip install -U pip"
|
|
||||||
- name: Get pip cache dir
|
|
||||||
id: pip-cache
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=dir::$(pip cache dir)"
|
|
||||||
- name: Persistent Github pip cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-pip${{ matrix.python }}
|
|
||||||
- name: Tests
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
sudo apt-get update -qq
|
|
||||||
sudo apt-get install -qq libpoppler-cpp-dev unpaper tesseract-ocr imagemagick ghostscript optipng
|
|
||||||
pip install --upgrade pipenv
|
|
||||||
pipenv install --system --dev
|
|
||||||
cd src/
|
|
||||||
pipenv run pytest --cov
|
|
||||||
pipenv run pycodestyle
|
|
||||||
pipenv run coveralls
|
|
Loading…
x
Reference in New Issue
Block a user