Adapt github action to build PR version

This commit is contained in:
Fabian Koller 2021-01-22 11:10:56 +01:00
parent eca1289ce2
commit 8d62493774
No known key found for this signature in database
GPG Key ID: 4EFE4C946404B82A
5 changed files with 32 additions and 8 deletions

View File

@ -5,7 +5,7 @@ on: [push, pull_request]
jobs:
# https://molecule.readthedocs.io/en/latest/ci.html#github-actions
test:
test-fresh:
runs-on: ubuntu-latest
# https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context
if: github.event_name == 'pull_request' || (github.event_name == 'push' && contains(github.ref, 'refs/heads/'))
@ -31,6 +31,27 @@ jobs:
cd ansible
molecule test -s fresh
working-directory: "${{ github.repository }}"
test-update:
runs-on: ubuntu-latest
# https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context
if: github.event_name == 'pull_request' || (github.event_name == 'push' && contains(github.ref, 'refs/heads/'))
steps:
- name: Check out the codebase
uses: actions/checkout@v2
with:
path: "${{ github.repository }}"
- name: Set up Python
uses: actions/setup-python@v2
- name: Set up Docker
uses: docker-practice/actions-setup-docker@master
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install molecule[ansible,docker]
ansible --version
docker --version
molecule --version
python --version
- name: Test release update with molecule
run: |
cd ansible

View File

@ -2,6 +2,12 @@
- name: fresh installation
hosts: all
tasks:
- name: set github ref as version when available
set_fact:
paperlessng_version: "{{ lookup('env', 'GITHUB_REF') | default('latest', True) }}"
- name: debug
debug:
var: paperlessng_version
- name: install paperless-ng with default parameters
include_role:
name: ansible

View File

@ -2,10 +2,9 @@
- name: update previous release to newest release
hosts: all
tasks:
- name: set current version as installation target
- name: set github ref as version when available
set_fact:
paperlessng_version: 0.9.14
paperlessng_version: "{{ lookup('env', 'GITHUB_REF') | default('latest', True) }}"
- name: update to newest paperless-ng release
include_role:
name: ansible

View File

@ -3,7 +3,7 @@
tasks:
- name: set previous version as installation target
set_fact:
paperlessng_version: 0.9.13
paperlessng_version: 1.0.0
- name: install previous paperless-ng release
include_role:

View File

@ -18,7 +18,6 @@
dest: "{{ gitdir.path }}"
version: "{{ paperlessng_version }}"
refspec: "+refs/pull/*:refs/pull/*"
when: '"No such file or directory" in paperlessng_current_version.stderr or paperlessng_current_version.stdout != paperlessng_version | string'
- name: compile frontend
command:
@ -31,6 +30,7 @@
- npm install
- ./node_modules/.bin/ng build --prod
# TODO run dev in separate virtualenv
- name: install pipenv
pip:
name:
@ -44,7 +44,6 @@
regexp: '^python_version = ".+"$'
line: python_version = "3"
# TODO run dev in separate virtualenv
- name: install Pipfile dependencies
command:
cmd: pipenv install --dev
@ -125,7 +124,6 @@
src: "{{ gitdir.path }}/paperless-ng-{{ paperlessng_version }}.tar.xz"
remote_src: yes
dest: "{{ tempdir.path }}"
when: '"No such file or directory" in paperlessng_current_version.stderr or paperlessng_current_version.stdout != paperlessng_version | string'
- name: remove temporary git directory
file: