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

  1. name: "DINAR"
  2. on:
  3. pull_request:
  4. jobs:
  5. pre-commit:
  6. name: "pre-commit"
  7. runs-on: ubuntu-latest
  8. steps:
  9. - name: Checkout Repo
  10. uses: actions/checkout@v2
  11. - uses: actions/setup-python@v1
  12. with:
  13. python-version: "3.7.x"
  14. - name: Check Python Version
  15. run:
  16. echo "::set-env name=PY::$(python --version --version | sha256sum | cut -d' '
  17. -f1)"
  18. - uses: actions/cache@v1
  19. with:
  20. path: ~/.cache/pre-commit
  21. key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
  22. - uses: pre-commit/action@v1.0.1
  23. review:
  24. name: "Quick Review"
  25. runs-on: ubuntu-latest
  26. steps:
  27. - name: Checkout Repo
  28. uses: actions/checkout@v2
  29. with:
  30. path: REPO
  31. - name: Checkout DINAR
  32. uses: actions/checkout@v2
  33. with:
  34. path: DINAR
  35. repository: itpp-labs/DINAR
  36. ref: master # TODO: use fixed version
  37. - uses: actions/setup-python@v1
  38. with:
  39. python-version: "3.7.x"
  40. - name: Install python tools
  41. run: |
  42. pip install plumbum PyGithub
  43. - name: Analyze PR
  44. run: |
  45. # sets environment variables that available in next steps via $ {{ env.PR_... }} notation
  46. cd REPO
  47. python ../DINAR/workflow-files/analyze-pr.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.event.number }}
  48. - name: HOW TO RUN LOCALLY
  49. #if: "env.PR_UPDATED_MODULES_INSTALLABLE != ''"
  50. run: |
  51. cat << 'EOF'
  52. To test updates run:
  53. WORKDIR=/tmp/DINAR/${{ github.repository }}-${{ github.event.number }}/
  54. mkdir -p $WORKDIR
  55. cd $WORKDIR
  56. # TODO use fixed version instead of master
  57. curl https://raw.githubusercontent.com/itpp-labs/DINAR/master/local-files/docker-compose.yml > docker-compose.yml
  58. export REGISTRY=docker.pkg.github.com REPOSITORY=${{ github.repository }} REPO_NAME=$(echo ${{ github.repository }} | sed "s;.*/;;") VERSION=${{ github.event.pull_request.base.ref }}
  59. git clone --depth=1 --branch $VERSION git@github.com:${{ github.repository }} pr-files
  60. # Version in PR
  61. REVISION=${{ github.event.pull_request.head.sha}}
  62. # Version after merging
  63. REVISION=pull/${{ github.event.number}}/merge
  64. git -C pr-files fetch origin $REVISION
  65. git -C pr-files checkout FETCH_HEAD
  66. docker-compose pull
  67. export MODULES=${{ env.PR_UPDATED_MODULES_INSTALLABLE }}
  68. EOF
  69. if [ "${{ github.event.pull_request.base.ref }}" == "10.0" ]; then
  70. cat << 'EOF'
  71. # workaround for odoo 10.0
  72. docker-compose up -d odoo
  73. docker-compose exec odoo click-odoo -i
  74. # EXEC:
  75. # env['ir.module.module'].update_list()
  76. # env.cr.commit()
  77. # exit()
  78. docker-compose stop odoo
  79. EOF
  80. fi
  81. cat << 'EOF'
  82. docker-compose up
  83. EOF
  84. # TODO: post this message when Github guys make access to post message in PR
  85. #> Sent by [DINAR :construction_worker_man:](https://github.com/itpp-labs/DINAR) via `.github/workflows/DINAR-pr.yml`