Skip to content

Merge pull request #1341 from techee/prjorg_goto_anywhere #479

Merge pull request #1341 from techee/prjorg_goto_anywhere

Merge pull request #1341 from techee/prjorg_goto_anywhere #479

Workflow file for this run

#
# Copyright: 2022, The Geany contributors
# License: GNU GPL v2 or later
name: CI Build
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
# 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
CONFIGURE_FLAGS: --disable-silent-rules
CPPCHECKFLAGS: --check-level=exhaustive
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 1G
PYTHON: python3
JOBS: 2
DEBUG: 0
jobs:
linux:
name: Linux Build
runs-on: ubuntu-22.04
env:
CC: ccache gcc
CXX: ccache g++
CPPCHECK_CACHE_PATH: ${{ github.workspace }}/.cppcheck_cache
GEANY_SOURCE_PATH: ${{ github.workspace }}/.geany_source
GEANY_CACHE_PATH: ${{ github.workspace }}/.geany_cache
GEANY_INSTALLATION_PATH: ${{ github.workspace }}/.geany_cache/_geany_install
PKG_CONFIG_PATH: ${{ github.workspace }}/.geany_cache/_geany_install/lib/pkgconfig:$PKG_CONFIG_PATH
LD_LIBRARY_PATH: ${{ github.workspace }}/.geany_cache/_geany_install/lib:$LD_LIBRARY_PATH
steps:
- name: Checkout Geany-Plugins
uses: actions/checkout@v4
- name: Checkout Geany
uses: actions/checkout@v4
with:
repository: geany/geany
path: ${{ env.GEANY_SOURCE_PATH }}
token: ${{ github.token }}
# 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 "timestamp=$(date +%Y-%m-%d-%H-%M)" >> $GITHUB_OUTPUT
- name: Prepare Cppcheck Cache Key
id: prepare_cppcheck_cache_key
run: echo "cppcheck_tag=$(curl -s https://api.github.com/repos/danmar/cppcheck/releases/latest | jq .tag_name)" >> $GITHUB_OUTPUT
- name: Prepare Geany Cache Key
id: prepare_geany_cache_key
working-directory: ${{ env.GEANY_SOURCE_PATH }}
run: echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Configure ccache
uses: actions/cache@v4
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: Configure Cppcheck Cache
id: cppcheck_cache
uses: actions/cache@v4
with:
path: ${{ env.CPPCHECK_CACHE_PATH }}
key: ${{ runner.os }}-${{ github.job }}-cppcheck-cache-${{ steps.prepare_cppcheck_cache_key.outputs.cppcheck_tag }}
- name: Configure Geany Cache
id: geany_cache
uses: actions/cache@v4
with:
path: ${{ env.GEANY_CACHE_PATH }}
key: ${{ runner.os }}-${{ github.job }}-geany-cache-${{ steps.prepare_geany_cache_key.outputs.commit_hash }}
- name: Show environment
if: ${{ env.DEBUG == '1' }}
run: |
env | sort
- name: Install Dependencies
run: |
sudo apt-get update --quiet --quiet
# write dependencies to a temporary file which is then fed to "apt-get install",
# so we can use comments in the dependency list
cat << EOF > $RUNNER_TEMP/dependencies
# general
ccache
libtool
libgtk-3-dev
# geany
autopoint
gettext
python3-docutils
# geany-plugins
intltool
check
# debugger
libvte-2.91-dev
# geanygendoc
libctpl-dev
# geanylua
liblua5.1-0-dev
# geanypg
libgpgme-dev
# geanyvc
libgtkspell-dev
libgtkspell3-3-dev
# geaniuspaste/updatechecker
libsoup2.4-dev
libsoup-3.0-dev
# git-changebar
libgit2-dev
# markdown
libmarkdown2-dev
# markdown/webhelper
libwebkit2gtk-4.0-dev
libwebkit2gtk-4.1-dev
# pretty-printer
libxml2-dev
# spellcheck
libenchant-2-dev
# cppcheck
cmake
libpcre3-dev
EOF
grep -v '^[ ]*#' $RUNNER_TEMP/dependencies | xargs sudo apt-get install --assume-yes --no-install-recommends
- name: Build cppcheck
if: steps.cppcheck_cache.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.CPPCHECK_CACHE_PATH }}
cd ${{ env.CPPCHECK_CACHE_PATH }}
curl -s https://api.github.com/repos/danmar/cppcheck/releases/latest | jq .tarball_url | xargs wget -O cppcheck.tar.gz
tar --strip-components=1 -xf cppcheck.tar.gz
mkdir build
cd build
cmake .. -DHAVE_RULES=On -DUSE_MATCHCOMPILER=On
cmake --build .
- name: Build Geany
if: steps.geany_cache.outputs.cache-hit != 'true'
run: |
cd "${{ env.GEANY_SOURCE_PATH }}"
NOCONFIGURE=1 ./autogen.sh
mkdir _build
cd _build
{ ../configure --prefix="${{ env.GEANY_INSTALLATION_PATH }}" || { cat config.log; exit 1; } ; }
make -j ${{ env.JOBS }}
make -j ${{ env.JOBS }} install
- name: Configure
run: |
# Add previously built cppcheck to $PATH, for this and for succeeding steps
export "PATH=$PATH:${{ env.CPPCHECK_CACHE_PATH }}/build/bin"
echo "PATH=$PATH" >> "$GITHUB_ENV"
NOCONFIGURE=1 ./autogen.sh
mkdir _build
cd _build
{ ../configure $CONFIGURE_FLAGS || { cat config.log; exit 1; } ; }
- name: Build
run: |
cd _build
make -j ${{ env.JOBS }}
- name: Run Tests
run: |
cd _build
make -j ${{ env.JOBS }} check
- name: Run distcheck
run: |
cd _build
make -j ${{ env.JOBS }} distcheck DISTCHECK_CONFIGURE_FLAGS="${{ env.CONFIGURE_FLAGS }} --disable-cppcheck";
- name: ccache statistics
if: ${{ env.DEBUG == '1' }}
run: ccache --show-stats
mingw64:
name: Mingw-w64 Build (Windows)
runs-on: ubuntu-20.04
env:
GEANY_SOURCE_PATH: ${{ github.workspace }}/.geany_source
GEANY_CACHE_PATH: ${{ github.workspace }}/.geany_cache
INFRASTRUCTURE_PATH: ${{ github.workspace }}/.infrastructure
BUILDER_PATH: ${{ github.workspace }}/.infrastructure/builders
DOCKER_REGISTRY: "ghcr.io"
DOCKER_IMAGE_NAME: "geany-mingw64-ci"
DOCKER_IMAGE_TAG: "ghcr.io/geany/geany-mingw64-ci:latest"
steps:
- name: Checkout Geany-Plugins
uses: actions/checkout@v4
- name: Checkout Geany
uses: actions/checkout@v4
with:
repository: geany/geany
path: ${{ env.GEANY_SOURCE_PATH }}
token: ${{ github.token }}
- name: Checkout Build Scripts
uses: actions/checkout@v4
with:
ref: master
repository: geany/infrastructure
path: ${{ env.INFRASTRUCTURE_PATH }}
token: ${{ github.token }}
- uses: jwalton/gh-find-current-pr@v1
id: find_pull_request
with:
state: open
- name: Define environment variables
run: |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "GITHUB_PULL_REQUEST=${GITHUB_PULL_REQUEST}" >> $GITHUB_ENV
echo "GITHUB_PULL_REQUEST_OR_REF=${GITHUB_PULL_REQUEST:-${{ github.ref_name }}}" | tr '/' '-' >> $GITHUB_ENV
env:
GITHUB_PULL_REQUEST: ${{ steps.find_pull_request.outputs.pr }}
- name: Prepare Geany Cache Key
id: prepare_geany_cache_key
working-directory: ${{ env.GEANY_SOURCE_PATH }}
run: echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Configure Geany Cache
id: geany_cache
uses: actions/cache@v4
with:
path: ${{ env.GEANY_CACHE_PATH }}
key: ${{ runner.os }}-${{ github.job }}-geany-mingw64-cache-${{ steps.prepare_geany_cache_key.outputs.commit_hash }}
- name: Show Environment
if: ${{ env.DEBUG == '1' }}
run: |
env | sort
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Or Build Docker Image
working-directory: ${{ env.BUILDER_PATH }}
run: |
docker_image_created=
docker pull ${{ env.DOCKER_IMAGE_TAG }} || true
if $(docker image inspect ${{ env.DOCKER_IMAGE_TAG }} --format="ignored" >/dev/null 2>&1); then
docker tag ${{ env.DOCKER_IMAGE_TAG }} ${{ env.DOCKER_IMAGE_NAME }}
docker_image_created=$(docker image inspect ${{ env.DOCKER_IMAGE_NAME }} --format='{{ index .Config.Labels "org.opencontainers.image.created" }}')
echo "Docker image built on: ${docker_image_created}"
fi
bash start_build.sh --log-to-stdout --mingw64 --rebuild-images
docker_image_created_new=$(docker image inspect ${{ env.DOCKER_IMAGE_NAME }} --format='{{ index .Config.Labels "org.opencontainers.image.created" }}')
# tag the image
if [ "${docker_image_created}" != "${docker_image_created_new}" ]; then
docker tag ${{ env.DOCKER_IMAGE_NAME }} ${{ env.DOCKER_IMAGE_TAG }}
fi
- name: Copy Geany Installer From Cache
if: steps.geany_cache.outputs.cache-hit == 'true'
run: |
cp ${{ env.GEANY_CACHE_PATH }}/geany-*.exe ${{ env.BUILDER_PATH }}/output/mingw64/
- name: Build Geany
if: steps.geany_cache.outputs.cache-hit != 'true'
working-directory: ${{ env.BUILDER_PATH }}
run: |
bash start_build.sh --log-to-stdout --mingw64 --geany --geany-source "${{ env.GEANY_SOURCE_PATH }}"
mkdir -p "${{ env.GEANY_CACHE_PATH }}"
cp ${{ env.BUILDER_PATH }}/output/mingw64/geany-*.exe ${{ env.GEANY_CACHE_PATH }}
- name: Build Geany-Plugins
working-directory: ${{ env.BUILDER_PATH }}
run: |
bash start_build.sh --log-to-stdout --mingw64 --geany-plugins --geany-plugins-source "${{ github.workspace }}"
- name: Archive Geany-Plugins Installer
uses: actions/upload-artifact@v4
with:
name: geany-plugins-installer-ci-${{ env.SHORT_SHA }}-pr${{ env.GITHUB_PULL_REQUEST_OR_REF }}
retention-days: 30
path: |
${{ env.BUILDER_PATH }}/output/mingw64/geany-*.exe
${{ env.BUILDER_PATH }}/output/mingw64/geany-*.zip