Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Add flatpak builds #30

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
520eed9
Rename App ID to fit within freedesktop guidelines
BrainBlasted Jul 29, 2019
2df7d61
flatpak: Create flatpak manifest
BrainBlasted Aug 1, 2019
aced5b5
gitignore: Add common build directories from flatpak
BrainBlasted Aug 1, 2019
de4ed79
build: Rework cli script setup for flatpak
BrainBlasted Aug 1, 2019
a70938b
build: Properly set executable name in all files
BrainBlasted Aug 1, 2019
ed85486
debian: Remove "build" run_target usage
BrainBlasted Aug 1, 2019
2a7cbea
flatpak: Add clipboard tooling
BrainBlasted Aug 2, 2019
98125f9
flatpak: Add sandbox hole for ~/.writeas
BrainBlasted Aug 2, 2019
1199c3a
window: Use FileChooserNative instead of FileChooserDialog
BrainBlasted Aug 2, 2019
3cee7bb
flatpak: Ensure read-write access to .writeas dir
BrainBlasted Aug 9, 2019
9f72716
CI: Add flatpak build stage
BrainBlasted Aug 9, 2019
dfb6a75
CI: Use C as programming language
BrainBlasted Aug 9, 2019
0fa62f1
CI: Add docker service
BrainBlasted Aug 9, 2019
9ccec0a
CI: Use build matrix for multiple jobs
BrainBlasted Aug 9, 2019
f87e302
CI: Set toplevel language to C
BrainBlasted Aug 9, 2019
73b8d67
CI: list directory contents before building
BrainBlasted Aug 9, 2019
313fa1f
CI: Bind repo directory
BrainBlasted Aug 9, 2019
f82fca5
CI: Disable email notifications for whole process
BrainBlasted Aug 9, 2019
4aea447
CI: Use absolute path to writeas dir
BrainBlasted Aug 9, 2019
e043493
CI: Make sure fusermount is executable
BrainBlasted Aug 9, 2019
479e687
CI: Run docker as priviledged
BrainBlasted Aug 9, 2019
40214b8
CI: fix docker typo
BrainBlasted Aug 9, 2019
3229853
CI: Manually build writeas-gtk flatpak module
BrainBlasted Aug 9, 2019
ce92eed
CI: Use MANIFEST_PATH env variable
BrainBlasted Aug 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
*~

build
_build/
.flatpak-builder/
.ninja_*
build.ninja
data/writeas

# Files generated by gb
pkg/
bin/
63 changes: 40 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,44 @@
---

language: node_js

node_js:
- lts/*

sudo: required

services:
- docker

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libstdc++-5-dev

install:
- npm i -g @elementaryos/houston

script:
- houston ci
language: c

notifications:
email: false

matrix:
include:
- language: node_js
node_js:
- lts/*
sudo: required
env: []
before_install: []
services:
- docker
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libstdc++-5-dev
install:
- npm i -g @elementaryos/houston
script:
- houston ci
language: c
services:
- docker
sudo: required
env:
- MANIFEST_PATH=/build/writeas/writeas-gtk/flatpak/com.abunchtell.WriteAsDesktop.json
before_install:
- ls
- docker pull christopherdavis/elementary-flatpak-writeas:latest
- docker run --privileged -v "$(pwd)":/build/writeas/writeas-gtk -it -d --name flatpak christopherdavis/elementary-flatpak-writeas bash
- docker exec flatpak chmod +x /usr/bin/fusermount
addons: []
install: []
script:
- docker exec flatpak flatpak-builder --stop-at=writeas-gtk app ${MANIFEST_PATH}
- docker exec flatpak flatpak-builder --run app ${MANIFEST_PATH} meson _build /build/writeas/writeas-gtk --prefix=/app -Dauto_build_cli=true
- docker exec flatpak flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build install
- docker exec flatpak flatpak-builder --finish-only app ${MANIFEST_PATH}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<update_contact>[email protected]</update_contact>

<provides>
<binary>@app_id@</binary>
<binary>@exec@</binary>
</provides>

<screenshots>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Type=Application
Name=Write.as
Comment=Publish a thought in seconds.
Exec=@app_id@
Exec=@exec@
Icon=@app_id@
Terminal=false
MimeType=
Expand Down
7 changes: 4 additions & 3 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ icon_sizes = ['16', '24', '32', '48', '64', '128']

foreach i : icon_sizes
install_data(
join_paths('icons', i, meson.project_name() + '.png'),
join_paths('icons', i, 'com.abunchtell.WriteAsDesktop.png'),
install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps'),
rename: '@[email protected]'.format(app_id)
)
endforeach

data_conf = configuration_data()
data_conf.set('app_id', app_id)
data_conf.set('exec', executable)
configure_file(
input: 'writeas-gtk.desktop.in',
input: 'com.abunchtell.WriteAsDesktop.desktop.in',
output: '@[email protected]'.format(app_id),
configuration: data_conf,
install_dir: join_paths(get_option('datadir'), 'applications')
)
configure_file(
input: 'writeas-gtk.appdata.xml.in',
input: 'com.abunchtell.WriteAsDesktop.appdata.xml.in',
output: '@[email protected]'.format(app_id),
configuration: data_conf,
install_dir: join_paths(get_option('datadir'), 'metainfo')
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: com.github.writeas.writeas-gtk
Section: x11
Priority: extra
Maintainer: Write.as <[email protected]>
Build-Depends: meson,
Build-Depends: meson (>= 0.48),
debhelper (>= 9),
libgtk-3-dev,
libgtksourceview-3.0-dev,
Expand Down
6 changes: 2 additions & 4 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ override_dh_auto_clean:

override_dh_auto_configure:
mkdir -p debian/build
cd debian/build && meson --prefix=/usr ../.. -Dplatform=elementary
cd debian/build && meson --prefix=/usr ../.. -Dplatform=elementary -Dauto_build_cli=true

override_dh_auto_build:
cd debian/build && ninja -v && ninja build
cd debian/build && ninja -v

override_dh_auto_test:
cd debian/build && ninja test

override_dh_auto_install:
cd debian/build && DESTDIR=${CURDIR}/debian/com.github.writeas.writeas-gtk ninja install
mkdir -p debian/com.github.writeas.writeas-gtk/usr/bin
cp bin/writeas debian/com.github.writeas.writeas-gtk/usr/bin/
110 changes: 110 additions & 0 deletions flatpak/com.abunchtell.WriteAsDesktop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"app-id": "com.abunchtell.WriteAsDesktop",
"base": "io.elementary.BaseApp",
"base-version": "juno",
"runtime": "org.gnome.Platform",
"runtime-version": "3.32",
"sdk": "org.gnome.Sdk",
"sdk-extensions": [
"org.freedesktop.Sdk.Extension.golang"
],
"command": "writeas-gtk",
"finish-args": [
"--socket=wayland",
"--share=ipc",
"--socket=x11",
"--device=dri",
"--share=network",
"--filesystem=~/.writeas:rw"
],
"build-options": {
"append-path": "/usr/lib/sdk/golang/bin/",
"build-args" : [
"--share=network"
],
"env": {
"GOROOT": "/usr/lib/sdk/golang/"
}
},
"modules": [
{
"name": "gb",
"buildsystem": "simple",
"build-commands": [
"/usr/lib/sdk/golang/enable.sh; env GOPATH=\"$(pwd)\" go build github.com/constabulary/gb/cmd/gb",
"install -Dm0755 -t /app/bin gb"
],
"sources": [
{
"type": "git",
"url": "https://github.com/pkg/errors.git",
"dest": "src/github.com/pkg/errors"
},
{
"type": "git",
"url": "https://github.com/constabulary/gb.git",
"dest": "src/github.com/constabulary/gb"
}
]
},
{
"name": "gtksourceview3",
"config-opts" : [
"--disable-Werror"
],
"sources": [
{
"type": "git",
"url": "https://gitlab.gnome.org/GNOME/gtksourceview.git",
"branch": "gnome-3-24"
}
]
},
{
"name": "wl-clipboard",
"buildsystem": "meson",
"sources": [
{
"type": "git",
"url": "https://github.com/bugaevc/wl-clipboard.git"
}
]
},
{
"name": "libXmu",
"config-opts": [
"--disable-static",
"--disable-docs"
],
"sources": [
{
"type": "archive",
"url": "https://www.x.org/releases/individual/lib/libXmu-1.1.2.tar.bz2",
"sha256": "756edc7c383254eef8b4e1b733c3bf1dc061b523c9f9833ac7058378b8349d0b"
}
]
},
{
"name": "xclip",
"sources": [
{
"type": "git",
"url": "https://github.com/astrand/xclip.git"
}
]
},
{
"name": "writeas-gtk",
"buildsystem": "meson",
"config-opts": [
"-Dauto_build_cli=true"
],
"sources": [
{
"type": "git",
"url": "https://github.com/writeas/writeas-gtk.git"
}
]
}
]
}
9 changes: 6 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
project('writeas-gtk', ['vala', 'c'],
version: '1.0.2',
license: 'GPL',
meson_version: '>=0.46.0')
meson_version: '>=0.48.0')

i18n = import('i18n')

build_platform = get_option('platform')
if build_platform == 'elementary'
app_id = 'com.github.writeas.writeas-gtk'
executable = 'com.github.writeas.writeas-gtk'
else
app_id = 'writeas-gtk'
app_id = 'com.abunchtell.WriteAsDesktop'
executable = 'writeas-gtk'
endif


conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', app_id)
conf.set_quoted('APP_ID', app_id)
conf.set_quoted('BUILD_PLATFORM', build_platform)
config_h = configure_file(output: 'config.h', configuration: conf)
config_h_dir = include_directories('.')

run_target('build', command: 'meson/build-cli.sh')
cli_build_script = find_program('meson/build-cli.sh')

subdir('data')
subdir('src')
Expand Down
5 changes: 5 additions & 0 deletions meson/build-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
exec_name=writeas

echo "Building $exec_name CLI..."
cd $1 &&
gb build github.com/writeas/writeas-cli/cmd/writeas &&
mv bin/writeas $3/$2 &&
# Cleanup
rm -rf bin/ &&
rm -rf pkg/ &&
echo "Success."
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
option('platform', type: 'combo', choices: ['default', 'elementary'], value: 'default')
option('auto_build_cli', type: 'boolean', value: 'false')
2 changes: 1 addition & 1 deletion src/application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class WriteAs.Application : Gtk.Application {
Intl.setlocale(LocaleCategory.ALL, "");
Intl.textdomain("write.as");

application_id = APP_ID + ".desktop";
application_id = APP_ID;
}

public override void activate() {
Expand Down
20 changes: 19 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
executable(app_id,
if get_option('auto_build_cli')
gb = find_program('gb')

cli_target = custom_target('build-cli',
build_by_default: true,
output: 'writeas',
install: true,
install_dir: get_option('bindir'),
console: true,
command: [
cli_build_script,
'@SOURCE_ROOT@',
'@OUTPUT@',
meson.build_root()
]
)
endif

executable(executable,
'application.vala',
'window.vala',
'Granite/Accels.vala',
Expand Down
9 changes: 3 additions & 6 deletions src/window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -386,21 +386,18 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {

private File prompt_file(Gtk.FileChooserAction mode, string action)
throws UserCancellable {
var file_chooser = new Gtk.FileChooserDialog(action, this, mode,
_("Cancel"), Gtk.ResponseType.CANCEL,
action, Gtk.ResponseType.ACCEPT);

var file_chooser = new Gtk.FileChooserNative(action, this, mode,
_("Save"), _("Cancel"));
file_chooser.select_multiple = false;
var filter = new Gtk.FileFilter();
filter.add_mime_type("text/plain");
file_chooser.set_filter(filter);

var resp = file_chooser.run();
file_chooser.close();
if (resp == Gtk.ResponseType.ACCEPT) {
return file_chooser.get_file();
} else {
throw new UserCancellable.USER_CANCELLED("FileChooserDialog");
throw new UserCancellable.USER_CANCELLED("FileChooserNative");
}
}

Expand Down