odoo_connector #995
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Community with ubuntu-20 | |
on: | |
push: | |
paths-ignore: | |
- "doc/**" | |
- "*.md" | |
pull_request: | |
repository_dispatch: | |
types: [odoo_connector] | |
workflow_dispatch: | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
services: | |
postgres: | |
image: postgres:13 | |
env: | |
POSTGRES_USER: frepple | |
POSTGRES_PASSWORD: frepple | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checking out source code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Nodes | |
uses: actions/setup-node@v3 | |
- name: Install packages | |
run: | | |
sudo apt update | |
sudo apt install libxerces-c-dev openssl libssl-dev libpq5 libpq-dev postgresql-client python3 python3-dev python3-setuptools | |
npm ci | |
sudo -H python3 -m pip install --upgrade pip | |
sudo -H pip3 install -r "${{github.workspace}}/requirements.dev.txt" | |
- name: Build | |
run: | | |
git submodule update --remote --checkout --force | |
grunt | |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target package | |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target doc | |
cp djangosettings.py djangosettings.original.py | |
- name: Test | |
working-directory: ${{github.workspace}} | |
run: | | |
./test/runtest.py --regression | |
sed -i "s/\"HOST\":.\"\"/\"HOST\":\"localhost\"/g" djangosettings.py | |
sed -i "s/\"PORT\":.\"\"/\"PORT\":\"5432\"/g" djangosettings.py | |
sed -i "s/DATE_STYLE = \"year-month-date\"/DATE_STYLE = \"day-month-year\"/g" djangosettings.py | |
./frepplectl.py test freppledb --verbosity=2 | |
- name: Odoo integration test | |
if: github.event.client_payload.message.branch | |
run: | | |
# First make the checkout unshallow | |
git -C freppledb/odoo/odoo_addon remote set-branches origin '*' | |
git -C freppledb/odoo/odoo_addon fetch --all | |
git -C freppledb/odoo/odoo_addon checkout "remotes/origin/${{ github.event.client_payload.message.branch }}" | |
sed -i 's/# "freppledb.odoo"/"freppledb.odoo"/g' djangosettings.py | |
./frepplectl.py test freppledb.odoo | |
- name: "Keep logs" | |
uses: actions/upload-artifact@v3 | |
if: ${{ failure() }} | |
with: | |
name: test_logs | |
path: logs | |
retention-days: 1 | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Grunt to compile and minify css and javascript files | |
file_pattern: "*.min.*" | |
- name: Get the version | |
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'frePPLe/frepple' | |
working-directory: ${{github.workspace}}/build | |
run: | | |
echo "frepple_version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
echo `cmake --system-information | grep 'CMAKE_PROJECT_VERSION:STATIC' | sed 's/CMAKE_PROJECT_VERSION:STATIC/project_version/g'` >> $GITHUB_ENV | |
- name: Check the version | |
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'frePPLe/frepple-enterprise-dev' | |
run: | | |
if [ "${{ env.frepple_version }}" != "${{ env.project_version }}" ]; then | |
exit 1 | |
fi | |
- name: Login to GitHub Container Registry | |
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'frePPLe/frepple' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push docker image | |
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'frePPLe/frepple' | |
run: | | |
mv djangosettings.original.py djangosettings.py | |
# First activate experimental features on docker to get "--squash" option | |
sudo rm -rf /etc/docker/daemon.json | |
echo '{"cgroup-parent": "/actions_job", "experimental": true}' | sudo tee -a /etc/docker/daemon.json | |
sudo systemctl restart docker | |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target docker | |
docker tag ghcr.io/frepple/frepple-community:${{ env.frepple_version }} ghcr.io/frepple/frepple-community:latest | |
docker push ghcr.io/frepple/frepple-community:${{ env.frepple_version }} | |
docker push ghcr.io/frepple/frepple-community:latest | |
- name: Publish release | |
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'frePPLe/frepple' | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: "${{ env.frepple_version }} Community Edition" | |
body: | | |
Release notes are available on https://frepple.com/docs/current/release-notes.html | |
**frepple-${{ env.frepple_version }}-doc.tgz**\: Documentation | |
**ubuntu20-frepple-${{ env.frepple_version }}.deb**\: Installer for Ubuntu 20.04 LTS | |
**docker container**\: Docker pull ghcr.io/frepple/frepple:${{ env.frepple_version }} | |
**Source code**\: Source code in code zip or gzip format | |
files: | | |
${{github.workspace}}/build/contrib/docker/*.deb | |
${{github.workspace}}/build/frepple-doc-*.tgz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |