Commit b979aa84 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Split CI tasks

parent c050546b
Pipeline #69577 passed with stages
in 3 minutes and 15 seconds
image: tarotbis/build:latest
image: debian:latest
before_script:
- apt-get update
- apt-get upgrade -y
- apt-get install -y --no-install-recommends texlive-base texlive-latex-base git ca-certificates texlive-fonts-recommended texlive-generic-recommended autoconf automake gettext autopoint libtool texinfo gnulib autoconf-archive gobject-introspection make gcc valac valac-vapi gtk-doc-tools flex bison gperf nettle-dev libgtk-3-dev libgirepository1.0-dev emacs org-mode indent doxygen graphviz lcov dejagnu check libxml2-utils xsltproc wget gengetopt help2man libreadline-dev libunistring-dev valgrind
stages:
- dist
- check
- manual
stages:
- deploy
distribute:
stage: dist
image: tarotbis/build:latest
script: "./ci-dist.sh"
artifacts:
paths:
- public
expire_in: 1 week
build:
stage: check
script: "./ci-build.sh"
artifacts:
paths:
- public
expire_in: 1 week
mingw32-build:
stage: check
image: fedora:latest
script: "./ci-mingw32.sh"
artifacts:
paths:
- public
expire_in: 1 week
mingw64-build:
stage: check
image: fedora:latest
script: "./ci-mingw64.sh"
artifacts:
paths:
- public
expire_in: 1 week
pages:
stage: deploy
script: "./deploy.sh"
stage: manual
script: "./ci-pages.sh"
artifacts:
paths:
- public
......
Vivien Kraus <vivien@planete-kraus.eu>
......@@ -46,11 +46,14 @@ ACLOCAL_AMFLAGS = -I m4 -I custom-m4
EXTRA_DIST = \
.gitignore \
hooks/ChangeLog \
deploy.sh \
README.org \
README.md \
ci-dist.sh \
ci-build.sh \
ci-mingw32.sh \
ci-mingw64.sh \
ci-pages.sh \
tarot.org \
setup.el \
AUTHORS.org \
AUTHORS.md \
.dir-locals.el.in \
.gitlab-ci.yml \
Dockerfile \
......@@ -97,27 +100,20 @@ indent: $(INDENTED)
org_verbose = $(org_verbose_@AM_V@)
org_verbose_ = $(org_verbose_@AM_DEFAULT_V@)
org_verbose_0 = @echo "ORG-EXPORT $@";
SUFFIXES += .org .md
.org.md:
$(org_verbose) echo "$(srcdir)/$@" \
| $(EMACS) "$(srcdir)/$<" \
--batch \
--eval "(require 'ox-md)" \
-f org-md-export-to-markdown
README: %reldir%/README.org
$(org_verbose) (echo "$(srcdir)/README.txt" \
| $(EMACS) "$(srcdir)/README.org" \
--batch \
--eval "(require 'ox-ascii)" \
README: %reldir%/tarot.org
$(org_verbose) ($(EMACS) \
--batch -q \
-l "$(srcdir)/setup.el" \
--file "$(srcdir)/tarot.org" \
-f org-ascii-export-to-ascii \
&& mv "$(srcdir)/README.txt" "$(srcdir)/README")
&& mv "$(srcdir)/tarot.txt" "$(srcdir)/README")
AUTHORS: %reldir%/AUTHORS.org
$(org_verbose) (echo "$(srcdir)/AUTHORS.txt" \
| $(EMACS) "$(srcdir)/AUTHORS.org" \
--batch \
--eval "(require 'ox-ascii)" \
$(org_verbose) ($(EMACS) \
--batch -q \
-l "$(srcdir)/setup.el" \
--file "$(srcdir)/tarot.org" \
-f org-ascii-export-to-ascii \
&& mv "$(srcdir)/AUTHORS.txt" "$(srcdir)/AUTHORS")
&& mv "$(srcdir)/tarot.txt" "$(srcdir)/AUTHORS")
githook_setup_verbose = $(githook_setup_verbose_@AM_V@)
githook_setup_verbose_ = $(githook_setup_verbose_@AM_DEFAULT_V@)
githook_setup_verbose_0 = @echo "ORG-EXPORT $@";
......
......@@ -12,13 +12,15 @@ _________________
1 READ ME
2 About tarot
3 Project site
4 Compile this project
.. 4.1 Gitlab users: make a source distribution
..... 4.1.1 The git pre-commit hook
..... 4.1.2 The CI/CD pipeline
.. 4.2 Everyone: configure, make and install
5 Introspection and cross-compilation
6 Let me know
4 Download tarot
5 Compile this project
.. 5.1 Gitlab users: make a source distribution
..... 5.1.1 The git pre-commit hook
..... 5.1.2 The CI/CD pipeline
.. 5.2 Everyone: configure, make and install
6 Recursive and parallel make
7 Introspection and cross-compilation
8 Let me know
......@@ -28,7 +30,7 @@ _________________
=========
RUN THE CONFIGURE SCRIPT NOT `autogen.sh'. If you don't have a
configure script, see section 4.1.
configure script, see section 5.1.
2 About tarot
......@@ -49,20 +51,34 @@ _________________
http://gugurumbe.frama.io/tarot/share/doc/tarot/tarot.html/index.html
4 Compile this project
4 Download tarot
================
Tarot is hosted [on gitlab]. You can download the source distribution
from the latest commit [here], and the mingw builds [for `i686'] and
[for `x86_64']. However, you should still be able to build from the
git repo, provided you have the required programs like emacs...
[on gitlab] https://framagit.org/gugurumbe/tarot
[here] http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz
[for `i686'] http://gugurumbe.frama.io/tarot/tarot-devel-mingw32.zip
[for `x86_64'] http://gugurumbe.frama.io/tarot/tarot-devel-mingw64.zip
5 Compile this project
======================
To compile this project, you will need a /source distribution/. If
you have received an archive of source code, then you it is what you
have. If you cloned this project from gitlab, then you have to do
some more work. Note that a source distribution is already available
[online], so you should not have to do this (except if you don't trust
my autotools!).
some more work.
[online] http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz
4.1 Gitlab users: make a source distribution
5.1 Gitlab users: make a source distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You need more tools in order to bootstrap the source distribution.
......@@ -73,13 +89,13 @@ http://gugurumbe.frama.io/tarot/share/doc/tarot/tarot.html/index.html
is /not/ available, or difficult to install, then I advise you to make
a /source/ distribution from an easier system or download [the build
from the latest passing commit], and then use this distribution as
discussed in section 4.2.
discussed in section 5.2.
[the build from the latest passing commit]
http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz
4.1.1 The git pre-commit hook
5.1.1 The git pre-commit hook
-----------------------------
The pre-commit hook checks quite thoroughly that the changes you made
......@@ -92,7 +108,7 @@ http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz
- are correctly indented with GNU indent;
- are not altered by any build step (except for the `po' files which
unfortunately are stamped with the date of the `dist' operation);
- keep the README (and README.md) up to date.
- keep the README up to date.
This operation is time-consuming, but you can bypass it by disabling
the hook during the git commit. However you should pass this hook for
......@@ -101,22 +117,21 @@ http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz
very likely to fail anyways.
4.1.2 The CI/CD pipeline
5.1.2 The CI/CD pipeline
------------------------
Once you push your commit, the CI/CD settings in `gitlab-ci.yml' will
rebuild a distribution from scratch, and upload some interesting files
like the HTML / PDF versions of the manual, the coverage report, and
the distribution. If you need fancier tools to build (e.g. you want
to automatically screencast the program under the control of a script
and distribute the video, or whatever), then make sure that the tools
to do that are available on debian and are installed both by the
Dockerfile and `.gitlab-ci.yml'.
Once you push your commit, the CI/CD settings in `gitlab-ci.yml' will:
1. Make a source distribution, using various programs in the debian
stable distro (gperf, gengetopt, flex, bison, emacs, indent,
help2man, ...);
2. Build for various architectures:
- on a bare debian distro with valgrind to run the tests,
- on a fedora distro to build for mingw32,
- on a fedora distro to build for mingw64;
3. Build the manual as a set of HTML files.
I already have bison, flex and gperf, and emacs, in that category.
4.2 Everyone: configure, make and install
5.2 Everyone: configure, make and install
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can run:
......@@ -132,7 +147,55 @@ http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz
linker flags as instructed at the end of `./configure --help'.
5 Introspection and cross-compilation
6 Recursive and parallel make
=============================
Unfortunately, it is very hard to avoid calling make recursively. And
if you call a recursive target with multiple parallel jobs, chances
are that there will be some race conditions.
If you want to avoid any problems, then you should make `dist' (that
has recursive calls) with only one job allowed, then make `all' with
multiple jobs at once.
,----
| make dist
| make -j 16 all check distcheck
`----
You can even be more parallel than that, by running the recursive
targets depth-first in parallel, but this assumes that you know what
targets are recursive. Fortunately, /I/ have to knowfor the CI
pipeline, so have a look at `ci-dist.sh'.
,----
| #!/bin/sh
|
| apt-get update
| apt-get upgrade -y
| apt-get install -y --no-install-recommends texlive-base texlive-latex-base git ca-certificates texlive-fonts-recommended texlive-generic-recommended autoconf automake gettext autopoint libtool texinfo gnulib autoconf-archive make gcc flex bison gperf emacs org-mode indent check gengetopt help2man libreadline-dev libunistring-dev valgrind
| ./autogen.sh
| ./configure CFLAGS="-Wall -Wextra -g -O0" \
| YFLAGS="--report=all" \
| --prefix="$PWD/public" \
| --enable-silent-rules=yes \
| || (cat config.log; exit 1)
| make indent || exit 1
| (cd lib && make -j 16 || exit 1)
|
| # Build the recursive targets in parallel depth-first:
|
| # src/program/tarot is called when making the manual page.
| make -j 16 src/program/tarot || exit 1
|
| # Now build the distribution.
| make -j 16 distcheck || exit 1
| mkdir public || exit 1
| cp tarot-devel.tar.gz public/ || exit 1
`----
7 Introspection and cross-compilation
=====================================
This package uses some introspection techniques: /help2man/, and maybe
......@@ -158,7 +221,7 @@ http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz
bug!
6 Let me know
8 Let me know
=============
I develop Tarot as a personal hobby. If you find it interesting, or
......
# Table of Contents
1. [READ ME](#org3d8ab5e)
2. [About tarot](#org95688f7)
3. [Project site](#orged3a9cd)
4. [Compile this project](#org2553515)
1. [Gitlab users: make a source distribution](#org0306b07)
1. [The git pre-commit hook](#orgebfe842)
2. [The CI/CD pipeline](#org063ee8e)
2. [Everyone: configure, make and install](#org9ab9550)
5. [Introspection and cross-compilation](#orgbcaa67a)
6. [Let me know](#orgd6c40b7)
<a id="org3d8ab5e"></a>
# READ ME
RUN THE CONFIGURE SCRIPT NOT `autogen.sh`. If you don't have a
configure script, see section [4.1](#org0306b07).
<a id="org95688f7"></a>
# About tarot
This repository hosts the project named Tarot, for *The Amazing Rules
Of Tarot*. It aims at providing a game and an artificial
intelligence.
<a id="orged3a9cd"></a>
# Project site
Go check out the [project manual](http://gugurumbe.frama.io/tarot/share/doc/tarot/tarot.html/index.html) and the [project code coverage report](http://gugurumbe.frama.io/tarot/coverage/index.html).
<a id="org2553515"></a>
# Compile this project
To compile this project, you will need a *source distribution*. If
you have received an archive of source code, then you it is what you
have. If you cloned this project from gitlab, then you have to do
some more work. Note that a source distribution is already available
[online](http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz), so you should not have to do this (except if you don't trust
my autotools!).
<a id="org0306b07"></a>
## Gitlab users: make a source distribution
You need more tools in order to bootstrap the source distribution.
I am assuming you run on debian stable, if you don't then please tell
me. If you work on a platform where the a tool required to make a
distribution, such as emacs with a recent enough version of org-mode
is *not* available, or difficult to install, then I advise you to make
a *source* distribution from an easier system or download [the build
from the latest passing commit](http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz), and then use this distribution as
discussed in section [4.2](#org9ab9550).
<a id="orgebfe842"></a>
### The git pre-commit hook
The pre-commit hook checks quite thoroughly that the changes you made
and commited:
- build from scratch (like what you are doing right now);
- pass the unit and program tests;
- pass the distcheck test without touching the distributed files (like
what you would be doing if you did not choose to rebuild the source
distribution);
- are correctly indented with GNU indent;
- are not altered by any build step (except for the `po` files which
unfortunately are stamped with the date of the `dist` operation);
- keep the README (and README.md) up to date.
This operation is time-consuming, but you can bypass it by disabling
the hook during the git commit. However you should pass this hook for
every commit on the `develop` and `master` branches to help maintain
the project. And if you disable the hook, then the CI pipeline is
very likely to fail anyways.
<a id="org063ee8e"></a>
### The CI/CD pipeline
Once you push your commit, the CI/CD settings in `gitlab-ci.yml` will
rebuild a distribution from scratch, and upload some interesting files
like the HTML / PDF versions of the manual, the coverage report, and
the distribution. If you need fancier tools to build (e.g. you want
to automatically screencast the program under the control of a script
and distribute the video, or whatever), then make sure that the tools
to do that are available on debian and are installed both by the
Dockerfile and `.gitlab-ci.yml`.
I already have bison, flex and gperf, and emacs, in that category.
<a id="org9ab9550"></a>
## Everyone: configure, make and install
You can run:
./configure --help
to know what options are available. If you want more details, see
`INSTALL`.
There are some dependencies, some optional, some are known not to have
a pkg-config configuration. In this case, pass the compiler flags and
linker flags as instructed at the end of `./configure --help`.
<a id="orgbcaa67a"></a>
# Introspection and cross-compilation
This package uses some introspection techniques: *help2man*, and maybe
in the future (distributed) code coverage and GObject introspection.
It means that you will need to run some just-built code in order to
update some distributed files. In case you are cross-compiling the
package, you may not be able to run the built code, so the
introspection will not work. Most of the time, you will not have to
do anything, since the results of the introspection will be up to
date. However, if you patch some specific source files, then the
results of the introspection will need to be re-built.
Here is a way out: if you intend to change the source code,
- configure the program out-of-source for the BUILD system <sup><a id="fnr.1" class="footref" href="#fn.1">1</a></sup>;
- configure the program out-of-source for the HOST system;
- patch the source;
- in the BUILD directory, run "make dist", or even "make distcheck";
- in the HOST directory, you can safely compile and DESTDIR install,
since the results of the introspection are now up to date. I'm
generally not using cross-compilation myself so the theory may not
hold in practice. If you still get an error, then please, report a
bug!
<a id="orgd6c40b7"></a>
# Let me know
I develop Tarot as a personal hobby. If you find it interesting, or
have bugs to submit, please let me know: `vivien@planete-kraus.eu`
# Footnotes
<sup><a id="fn.1" href="#fnr.1">1</a></sup> See
INSTALL for out-of-source configuration
......@@ -22,8 +22,3 @@
gnulib-tool --import malloc getopt-gnu assert
autoreconf -vif || exit 1
rm doc/tarot.texi || exit 1
./configure || exit 1
make -j src/program/tarot || exit 1
make -j distcheck || exit 1
make -j distclean || exit 1
#!/bin/sh
apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends build-essential libreadline-dev libunistring-dev check valgrind
cp public/tarot-devel.tar.gz . || exit 1
tar xf tarot-devel.tar.gz || exit 1
mkdir prefix || exit 1
mkdir build || exit 1
cd build/
../tarot-devel/configure CFLAGS="-Wall -Wextra -g -O0" \
YFLAGS="--report=all" \
--prefix="$PWD/../prefix" \
--enable-silent-rules=yes \
|| (cat config.log; exit 1)
make -j 16 TESTS_ENVIRONMENT="valgrind --tool=memcheck" check || exit 1
echo "$(date): tests passed" > ../public/tests-passed.txt
#!/bin/sh
apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends texlive-base texlive-latex-base git ca-certificates texlive-fonts-recommended texlive-generic-recommended autoconf automake gettext autopoint libtool texinfo gnulib autoconf-archive make gcc flex bison gperf emacs org-mode indent check gengetopt help2man libreadline-dev libunistring-dev valgrind
./autogen.sh
./configure CFLAGS="-Wall -Wextra -g -O0" \
YFLAGS="--report=all" \
--prefix="$PWD/public" \
--enable-silent-rules=yes \
|| (cat config.log; exit 1)
make indent || exit 1
(cd lib && make -j 16 || exit 1)
# Build the recursive targets in parallel depth-first:
# src/program/tarot is called when making the manual page.
make -j 16 src/program/tarot || exit 1
# Now build the distribution.
make -j 16 distcheck || exit 1
mkdir public || exit 1
cp tarot-devel.tar.gz public/ || exit 1
#!/bin/sh
yum install -y mingw32-gcc mingw32-readline make zip
cp public/tarot-devel.tar.gz . || exit 1
tar xf tarot-devel.tar.gz || exit 1
mkdir tarot-devel-mingw32 || exit 1
mkdir build || exit 1
cd build/
../tarot-devel/configure CFLAGS="-Wall -Wextra -g" \
CPPFLAGS="-I/usr/i686-w64-mingw32/sys-root/mingw/include" \
LDFLAGS="-L/usr/i686-w64-mingw32/sys-root/mingw/lib" \
YFLAGS="--report=all" \
--host=i686-w64-mingw32 \
--prefix="/usr" \
--enable-silent-rules=yes \
|| (cat config.log; exit 1)
make -j 16 DESTDIR="$PWD/../tarot-devel-mingw32" install || exit 1
cd ..
mkdir -p tarot-devel-mingw32/usr/bin || exit 1
cp /usr/i686-w64-mingw32/sys-root/mingw/bin/*.dll tarot-devel-mingw32/usr/bin || exit 1
zip -r tarot-devel-mingw32.zip tarot-devel-mingw32 || exit 1
mv tarot-devel-mingw32.zip public/ || exit 1
#!/bin/sh
yum install -y mingw64-gcc mingw64-readline make zip
cp public/tarot-devel.tar.gz . || exit 1
tar xf tarot-devel.tar.gz || exit 1
mkdir tarot-devel-mingw64 || exit 1
mkdir build || exit 1
cd build/
../tarot-devel/configure CFLAGS="-Wall -Wextra -g" \
CPPFLAGS="-I/usr/x86_64-w64-mingw32/sys-root/mingw/include" \
LDFLAGS="-L/usr/x86_64-w64-mingw32/sys-root/mingw/lib" \
YFLAGS="--report=all" \
--host=x86_64-w64-mingw32 \
--prefix="/usr" \
--enable-silent-rules=yes \
|| (cat config.log; exit 1)
make -j 16 DESTDIR="$PWD/../tarot-devel-mingw64" install || exit 1
cd ..
mkdir -p tarot-devel-mingw64/usr/bin || exit 1
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/*.dll tarot-devel-mingw64/usr/bin || exit 1
zip -r tarot-devel-mingw64.zip tarot-devel-mingw64 || exit 1
mv tarot-devel-mingw64.zip public/ || exit 1
#!/bin/sh
apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends build-essential libreadline-dev libunistring-dev texinfo
cp public/tarot-devel.tar.gz . || exit 1
tar xf tarot-devel.tar.gz || exit 1
mkdir build || exit 1
cd build/
../tarot-devel/configure \
--prefix="$PWD/../public" \
--enable-silent-rules=yes \
|| (cat config.log; exit 1)
make -j 16 install-html || exit 1
......@@ -26,7 +26,6 @@ gl_EARLY
AM_INIT_AUTOMAKE
AM_PROG_AR
LT_INIT
AX_CODE_COVERAGE
AM_MISSING_PROG([GPERF], [gperf])
AM_MISSING_PROG([FLEX], [flex])
AM_MISSING_PROG([BISON], [bison])
......@@ -74,9 +73,9 @@ AS_IF([test "x$with_libunistring" != "xno"], [
])
])
AX_TAROT_PACKAGE([readline], [readline], [], [-lreadline], [readline/readline.h readline/history.h], [readline add_history], [], [
AC_MSG_ERROR([readline is not working.])
])
AC_CHECK_HEADERS([readline/readline.h readline/history.h], [], [AC_MSG_ERROR([readline is not working.])])
AC_SEARCH_LIBS([readline], [readline], [], [AC_MSG_ERROR([readline is not working.])])
AC_SEARCH_LIBS([add_history], [readline], [], [AC_MSG_ERROR([readline is not working.])])
AC_MSG_CHECKING([for a way to recover from an unused but set variable])
AC_COMPILE_IFELSE([
......
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CODE_COVERAGE()
#
# DESCRIPTION
#
# Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
# CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included
# in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every
# build target (program or library) which should be built with code
# coverage support. Also defines CODE_COVERAGE_RULES which should be
# substituted in your Makefile; and $enable_code_coverage which can be
# used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
# and substituted, and corresponds to the value of the
# --enable-code-coverage option, which defaults to being disabled.
#
# Test also for gcov program and create GCOV variable that could be
# substituted.
#
# Note that all optimization flags in CFLAGS must be disabled when code
# coverage is enabled.
#
# Usage example:
#
# configure.ac:
#
# AX_CODE_COVERAGE
#
# Makefile.am:
#