Skip to content

Commit b5becc1

Browse files
authored
ci: add release workflow (#1)
* build: add release workflow * build: add scripts * build: add scripts Signed-off-by: Amit <amitkulkarni2028@gmail.com> * fix urls * replace curl with checkout Signed-off-by: Amit <amitkulkarni2028@gmail.com> Signed-off-by: Amit <amitkulkarni2028@gmail.com>
1 parent 610b560 commit b5becc1

File tree

4 files changed

+228
-0
lines changed

4 files changed

+228
-0
lines changed

.github/release.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Release notes
2+
<!-- This is a file used to write release notes -->
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# A CI pipeline to release FLINT AppImages.
2+
#
3+
# Important: Some releases use custom, static tags like "dev" and "production".
4+
# If any branches with exact names are created, the CI fails due to ref
5+
# resolution.
6+
name: Build FLINT AppImage
7+
on:
8+
push:
9+
tags:
10+
- 'v*'
11+
12+
workflow_dispatch:
13+
inputs:
14+
devRelease:
15+
description: "Is this a dev release?"
16+
default: true
17+
required: true
18+
type: boolean
19+
20+
jobs:
21+
build:
22+
strategy:
23+
matrix:
24+
os: [ubuntu-20.04, ubuntu-22.04]
25+
26+
runs-on: ${{ matrix.os }}
27+
28+
steps:
29+
- name: Checkout the install repo
30+
uses: actions/checkout@v3
31+
32+
- name: Run the AppImage script
33+
run: |
34+
chmod +x $GITHUB_WORKSPACE/appimage-scripts/AppImage_FLINT_Build.sh
35+
$GITHUB_WORKSPACE/appimage-scripts/AppImage_FLINT_Build.sh
36+
mv /home/runner/tmp/FLINT/Source/build/FLINT-*.AppImage /home/runner/FLINT-${{ matrix.os }}.AppImage
37+
38+
- name: Cache artifacts
39+
uses: actions/cache@v3
40+
env:
41+
cache-name: cache-appimages
42+
with:
43+
path: /home/runner/FLINT-${{ matrix.os }}.AppImage
44+
key: ${{ matrix.os }}-appimage
45+
46+
test:
47+
needs: build
48+
strategy:
49+
matrix:
50+
os: [ubuntu-20.04, ubuntu-22.04]
51+
52+
runs-on: ${{ matrix.os }}
53+
54+
steps:
55+
- name: Checkout the install repo
56+
uses: actions/checkout@v3
57+
58+
- uses: actions/cache@v3
59+
with:
60+
path: /home/runner/FLINT-${{ matrix.os }}.AppImage
61+
key: ${{ matrix.os }}-appimage
62+
63+
- name: Test AppImages
64+
run: |
65+
test -f "/home/runner/FLINT-${{ matrix.os }}.AppImage";
66+
echo "All AppImages have been built successfully."
67+
/home/runner/FLINT-${{ matrix.os }}.AppImage --appimage-extract
68+
cd squashfs-root
69+
cp $GITHUB_WORKSPACE/appimage-scripts/test-appimage-artifacts.sh .
70+
chmod +x ./test-appimage-artifacts.sh
71+
./test-appimage-artifacts.sh
72+
73+
release:
74+
needs: [build, test]
75+
strategy:
76+
matrix:
77+
os: [ubuntu-20.04, ubuntu-22.04]
78+
79+
runs-on: ${{ matrix.os }}
80+
81+
steps:
82+
- uses: actions/checkout@master
83+
84+
- uses: actions/cache@v3
85+
with:
86+
path: /home/runner/FLINT-${{ matrix.os }}.AppImage
87+
key: ${{ matrix.os }}-appimage
88+
89+
- name: Create dev release
90+
if: ${{ inputs.devRelease }}
91+
uses: ncipollo/release-action@v1
92+
with:
93+
allowUpdates: true
94+
name: "Dev release"
95+
tag: "dev"
96+
prerelease: False
97+
artifacts: "/home/runner/FLINT-*.AppImage"
98+
token: ${{ secrets.GITHUB_TOKEN }}
99+
100+
# This is because releases _need_ a tag.
101+
# Please change the tag later by pushing one.
102+
- name: Create production release for manual run
103+
if: ${{ (!inputs.devRelease) && (startsWith(github.ref_type, 'branch')) }}
104+
uses: ncipollo/release-action@v1
105+
with:
106+
allowUpdates: true
107+
bodyfile: .github/release.md
108+
tag: "production"
109+
prerelease: False
110+
artifacts: "/home/runner/FLINT-*.AppImage"
111+
token: ${{ secrets.GITHUB_TOKEN }}
112+
113+
- name: Create production release with a tag
114+
if: ${{ (!inputs.devRelease) && (startsWith(github.ref_type, 'tag')) }}
115+
uses: ncipollo/release-action@v1
116+
with:
117+
allowUpdates: true
118+
bodyfile: .github/release.md
119+
prerelease: False
120+
artifacts: "/home/runner/FLINT-*.AppImage"
121+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/bin/bash
2+
# Author: Ankita Sharma (https://github.com/ankitaS11)
3+
# This script is to faciliate building an AppImage for the FLINT repository
4+
# The AppImage built using this script has been, so far, tested on Ubuntu 22.04 derivatives.
5+
6+
sudo apt -y update && sudo apt -y upgrade
7+
sudo apt -y install build-essential
8+
sudo apt -y install libfuse2
9+
10+
WORKDIR=/home/$USER/tmp
11+
mkdir -p $WORKDIR
12+
13+
# Remove existing versions of CMake (if any)
14+
sudo apt purge cmake
15+
16+
# CMake needs OpenSSL (1.1.1o is the preferred versionas of June 2022)
17+
wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz && \
18+
tar -xvf openssl-1.1.1o.tar.gz && \
19+
cd openssl-1.1.1o && \
20+
./config && \
21+
make && \
22+
sudo make install
23+
24+
# Install latest CMake version - sudo apt install cmake is outdated!!
25+
wget https://github.com/Kitware/CMake/releases/download/v3.24.0-rc1/cmake-3.24.0-rc1.tar.gz && \
26+
tar -xvf cmake-3.24.0-rc1.tar.gz && \
27+
cd cmake-3.24.0-rc1 && ./bootstrap && make && sudo make install
28+
29+
# Install SQLite3
30+
sudo apt-get -y install libsqlite3-dev libsqlite3-0 sqlite3
31+
32+
# Install Boost
33+
sudo apt-get -y install libboost-all-dev
34+
35+
# Build Turtle from source
36+
cd $WORKDIR && git clone https://www.github.com/mat007/turtle.git && cd turtle && mkdir -p build && cd build && cmake .. && make && sudo make install
37+
38+
# Install unixODBC
39+
cd $WORKDIR && wget http://www.unixodbc.org/unixODBC-2.3.11.tar.gz && gunzip unixODBC-2.3.11.tar.gz && tar xvf unixODBC*.tar
40+
cd $WORKDIR && cd unixODBC-2.3.11 && ./configure && make && sudo make install
41+
42+
# Install sqlite3
43+
sudo apt -y install libsqlite3-dev
44+
sudo apt -y install libpcre3-dev
45+
46+
# Install POCO
47+
cd $WORKDIR && wget https://github.com/pocoproject/poco/archive/refs/tags/poco-1.11.1-release.tar.gz --no-check-certificate && tar xvf poco-*.tar.gz
48+
49+
cd $WORKDIR && cd poco-poco-1.11.1-release && mkdir -p cmake-build && cd cmake-build && \
50+
cmake -DCMAKE_BUILD_TYPE=RELEASE -DPOCO_UNBUNDLED=ON \
51+
-DENABLE_JSON=ON \
52+
-DENABLE_DATA=ON \
53+
-DENABLE_DATA_ODBC=ON \
54+
-DENABLE_DATA_SQLITE=ON \
55+
-DENABLE_DATA_MYSQL=OFF \
56+
-DENABLE_ACTIVERECORD=OFF \
57+
-DENABLE_ACTIVERECORD_COMPILER=OFF \
58+
-DENABLE_ENCODINGS=OFF \
59+
-DENABLE_ENCODINGS_COMPILER=OFF \
60+
-DENABLE_XML=OFF \
61+
-DENABLE_MONGODB=OFF \
62+
-DENABLE_REDIS=OFF \
63+
-DENABLE_PDF=OFF \
64+
-DENABLE_UTIL=OFF \
65+
-DENABLE_NET=OFF \
66+
-DENABLE_NETSSL=OFF \
67+
-DENABLE_CRYPTO=OFF \
68+
-DENABLE_SEVENZIP=OFF \
69+
-DENABLE_ZIP=OFF \
70+
-DENABLE_PAGECOMPILER=OFF \
71+
-DENABLE_PAGECOMPILER_FILE2PAGE=OFF .. && make && sudo make install
72+
73+
# This should be changed to moja-global/FLINT.git once this PR (https://github.com/moja-global/FLINT/pull/119)
74+
# is merged.
75+
cd $WORKDIR && git clone https://www.github.com/ankitaS11/FLINT.git && cd FLINT && git checkout fix_poco_include && cd Source && mkdir -p build && cd build && \
76+
cmake .. && make && make install DESTDIR=AppDir
77+
78+
# Install linuxdeploy
79+
cd $WORKDIR/FLINT/Source/build/ && \
80+
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage --no-check-certificate && \
81+
chmod +x linuxdeploy-x86_64.AppImage
82+
83+
# Make sure you are in the build folder of the FLINT/Source/
84+
# This command will fail first (and it's expected)
85+
cd $WORKDIR/FLINT/Source/build/ && ./linuxdeploy-x86_64.AppImage --appdir AppDir || true
86+
87+
# Copy the files from the GitHub repository:
88+
cd $WORKDIR/FLINT/Source/build && git clone https://www.github.com/ankitaS11/AppImageDataForFlint.git && cd AppImageDataForFlint && \
89+
cp icon.png $WORKDIR/FLINT/Source/build/AppDir && \
90+
cp usr/share/applications/AppDir.desktop $WORKDIR/FLINT/Source/build/AppDir/usr/share/applications/ && \
91+
cd $WORKDIR/FLINT/Source/build && \
92+
cp bin/* AppDir/usr/bin/ && \
93+
./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage -i AppDir/icon.png
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Check if essential AppImages files have been bundled correctly
2+
function check_files() {
3+
[ -s AppDir.desktop ] && echo "[OK] Desktop file exists" || exit 1
4+
[ -s icon.png ] && echo "[OK] Icon file exists" || exit 1
5+
}
6+
7+
function run_flint_test_binaries() {
8+
./usr/bin/moja.cli &>/dev/null && echo "[OK] moja.cli" || echo "[ERR] moja.cli"
9+
}
10+
11+
check_files
12+
run_flint_test_binaries

0 commit comments

Comments
 (0)