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

Migrate from Travis CI to Github Actions #2948

Merged
merged 1 commit into from Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
166 changes: 166 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,166 @@
#
# Copyright: 2021, The Geany contributors
# License: GNU GPL v2 or later

name: CI Build

on: push
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only for testing and I'll remove it before merge.

#on:
# push:
# branches:
# - master
# pull_request:
# branches:
# - master

# cancel already running builds of the same branch or pull request
concurrency:
group: ci-${{ github.head_ref }} || concat(${{ github.ref }}
cancel-in-progress: true

env:
CFLAGS: -g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 1G
PYTHON: python3
DEBUG: 0

jobs:
linux:
name: Linux Build (BINRELOC=${{ matrix.binreloc }})
runs-on: ubuntu-18.04

strategy:
fail-fast: false
matrix:
include:
- binreloc: no
- binreloc: yes

env:
CONFIGURE_FLAGS: --enable-binreloc=${{ matrix.binreloc }}
CC: ccache gcc
CXX: ccache g++

steps:
- uses: actions/checkout@v2

# create and use a timestamp for the cache key: GH Actions will never update a cache
# only use an existing cache item or create a new one. To use an existing cache *and*
# push back the the updated cache after build, we use a always new cache key (to force
# the creation of the cache item at the end) in combination with "restore-keys" as fallback
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M)"

- name: Configure ccache
uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-${{ github.job }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ runner.os }}-${{ github.job }}-ccache-

- name: Show environment
run: env | sort
if: ${{ env.DEBUG == '1' }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not yet decided whether we should keep the "show environment" and "ccache statistics" steps. They helped while writing the workflow definition but might be just noisy in every day use.
For now, I made them disabled by default but activatable via the DEBUG variable.


- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install --assume-yes --no-install-recommends \
ccache \
intltool \
libtool \
libgtk-3-dev \
doxygen \
python3-docutils \
python3-lxml \
rst2pdf

- name: Configure
run: |
NOCONFIGURE=1 ./autogen.sh
mkdir _build
cd _build
{ ../configure $CONFIGURE_FLAGS || { cat config.log; exit 1; } ; }

- name: Build
run: |
cd _build
make

- name: Run Tests
run: |
cd _build
make -j2 check

- name: Run distcheck
run: |
cd _build
make -j2 distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS";

- name: ccache statistics
run: ccache --show-stats
if: ${{ env.DEBUG == '1' }}


mingw:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole Windows part is subject to change later with a new, more real life build setup. This is why it is currently more or less copied from the Linux job and I find it this way more readable than many if's.

name: Mingw Build
# i686-w64-mingw32-pkg-config fails with weird error message on 20.04
runs-on: ubuntu-18.04
env:
CC: ccache i686-w64-mingw32-gcc
CXX: ccache i686-w64-mingw32-g++

steps:
- uses: actions/checkout@v2

# create and use a timestamp for the cache key: GH Actions will never update a cache
# only use an existing cache item or create a new one. To use an existing cache *and*
# push back the the updated cache after build, we use a always new cache key (to force
# the creation of the cache item at the end) in combination with "restore-keys" as fallback
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M)"

- name: Configure ccache
uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-${{ github.job }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ runner.os }}-${{ github.job }}-ccache-

- name: Show environment
run: env | sort
if: ${{ env.DEBUG == '1' }}

- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install --assume-yes --no-install-recommends \
ccache \
intltool \
libtool \
mingw-w64-tools \
g++-mingw-w64-i686 \
gcc-mingw-w64-i686 \
binutils-mingw-w64-i686 \
doxygen \
python3-docutils \
python3-lxml \
rst2pdf
# fix broken pkg-config-crosswrapper, see https://bugs.launchpad.net/ubuntu/+source/mingw-w64/+bug/1327242
sudo sed -e 's/PKG_CONFIG_PATH=/&$PKG_CONFIG_PATH:/' -i /usr/bin/i686-w64-mingw32-pkg-config

- name: Run autogen.sh
run: |
NOCONFIGURE=1 ./autogen.sh

- name: Build
run: |
sh ./scripts/cross-build-mingw.sh;

- name: ccache statistics
run: ccache --show-stats
if: ${{ env.DEBUG == '1' }}
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.