You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.3 KiB

name: "DINAR"
on:
pull_request:
jobs:
pre-commit:
name: "pre-commit"
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: "3.7.x"
- name: Check Python Version
run:
echo "::set-env name=PY::$(python --version --version | sha256sum | cut -d' '
-f1)"
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/action@v1.0.1
review:
name: "Quick Review"
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
path: REPO
- name: Checkout DINAR
uses: actions/checkout@v2
with:
path: DINAR
repository: itpp-labs/DINAR
ref: master # TODO: use fixed version
- uses: actions/setup-python@v1
with:
python-version: "3.7.x"
- name: Install python tools
run: |
pip install plumbum PyGithub
- name: Analyze PR
run: |
# sets environment variables that available in next steps via $ {{ env.PR_... }} notation
cd REPO
python ../DINAR/workflow-files/analyze-pr.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.event.number }}
- name: HOW TO RUN LOCALLY
#if: "env.PR_UPDATED_MODULES_INSTALLABLE != ''"
run: |
cat << 'EOF'
To test updates run:
WORKDIR=/tmp/DINAR/${{ github.repository }}-${{ github.event.number }}/
mkdir -p $WORKDIR
cd $WORKDIR
# TODO use fixed version instead of master
curl https://raw.githubusercontent.com/itpp-labs/DINAR/master/local-files/docker-compose.yml > docker-compose.yml
export REGISTRY=docker.pkg.github.com REPOSITORY=${{ github.repository }} REPO_NAME=$(echo ${{ github.repository }} | sed "s;.*/;;") VERSION=${{ github.event.pull_request.base.ref }}
git clone --depth=1 --branch $VERSION git@github.com:${{ github.repository }} pr-files
# Version in PR
REVISION=${{ github.event.pull_request.head.sha}}
# Version after merging
REVISION=pull/${{ github.event.number}}/merge
git -C pr-files fetch origin $REVISION
git -C pr-files checkout FETCH_HEAD
docker-compose pull
export MODULES=${{ env.PR_UPDATED_MODULES_INSTALLABLE }}
EOF
if [ "${{ github.event.pull_request.base.ref }}" == "10.0" ]; then
cat << 'EOF'
# workaround for odoo 10.0
docker-compose up -d odoo
docker-compose exec odoo click-odoo -i
# EXEC:
# env['ir.module.module'].update_list()
# env.cr.commit()
# exit()
docker-compose stop odoo
EOF
fi
cat << 'EOF'
docker-compose up
EOF
# TODO: post this message when Github guys make access to post message in PR
#> Sent by [DINAR :construction_worker_man:](https://github.com/itpp-labs/DINAR) via `.github/workflows/DINAR-pr.yml`