-
Notifications
You must be signed in to change notification settings - Fork 255
143 lines (126 loc) · 5.57 KB
/
ubuntu20.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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 }}