Skip to content

Commit

Permalink
Merge branch 'autoformat' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
sgallagher committed Jan 14, 2021
2 parents 258019d + 1096cda commit 8bb227d
Show file tree
Hide file tree
Showing 21 changed files with 56 additions and 310 deletions.
2 changes: 0 additions & 2 deletions .ci/archlinux/ci-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ pushd /builddir/

# Build the code under GCC and run standard tests
meson --buildtype=debugoptimized \
-Dtest_dirty_git=false \
-Ddeveloper_build=false \
-Dpython_name=python3 \
-Drpmio=disabled \
ci
Expand Down
12 changes: 0 additions & 12 deletions .ci/autoformat/Dockerfile.tmpl

This file was deleted.

33 changes: 0 additions & 33 deletions .ci/autoformat/ci-tasks.sh

This file was deleted.

8 changes: 1 addition & 7 deletions .ci/centos/ci-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@
set -e
set -x


# CentOS 7 doesn't have autopep8, so we'll drop the requirement for it
# This implementation will still allow it to occur if autopep8 still shows
# up later.
COMMON_MESON_ARGS="-Dtest_dirty_git=false -Ddeveloper_build=false -Dpython_name=python3.6"

pushd /builddir/

# Build the code under GCC and run standard tests
meson --buildtype=debugoptimized \
$COMMON_MESON_ARGS \
-Dpython_name=python3.6 \
ci

ninja-build -C ci test
Expand Down
4 changes: 2 additions & 2 deletions .ci/coverity/ci-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ if [ -e /usr/lib/os-release ]; then
source /usr/lib/os-release
case "${ID-unknown} ${VERSION_ID-unknown}" in
"centos 7")
COMMON_MESON_ARGS="-Dtest_dirty_git=false -Ddeveloper_build=false -Dpython_name=python3.6"
COMMON_MESON_ARGS="-Dpython_name=python3.6"
;;
"centos "*)
COMMON_MESON_ARGS="-Dtest_dirty_git=false -Ddeveloper_build=false"
COMMON_MESON_ARGS=""
;;
esac
fi
Expand Down
1 change: 0 additions & 1 deletion .ci/docs/ci-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pushd /builddir/

# Build the code under GCC and run documentation generation
meson --buildtype=debug \
$COMMON_MESON_ARGS \
doc-generation

set +e
Expand Down
11 changes: 6 additions & 5 deletions .ci/fedora/ci-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set -e
set -x

PROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
MESON_DIRTY_REPO_ARGS="-Dtest_dirty_git=${DIRTY_REPO_CHECK:-false}"
RETRY_CMD=/builddir/.ci/retry-command.sh
WITH_RPM_TESTS=${WITH_RPM_TESTS:-true}

Expand All @@ -18,8 +17,6 @@ sed -i -e 's/test -r/test -f/g' -e 's/test -x/test -f/g' /bin/ldd

# Build the code under GCC and run standard tests
meson --buildtype=debugoptimized \
-Dverbose_tests=false \
$MESON_DIRTY_REPO_ARGS \
ci

meson test --suite formatters \
Expand All @@ -34,9 +31,14 @@ meson test --suite ci \
--print-errorlogs \
-t 5

# Disable the verbose tests and run the supported tests through valgrind
meson --buildtype=debugoptimized \
-Dverbose_tests=false \
ci-valgrind

meson test --suite ci_valgrind \
--wrap=/builddir/contrib/valgrind/valgrind_wrapper.sh \
-C ci \
-C ci-valgrind \
--num-processes=$PROCESSORS \
--print-errorlogs \
-t 10
Expand All @@ -53,7 +55,6 @@ else
set -e
meson --buildtype=debug \
-Dskip_introspection=true \
$COMMON_MESON_ARGS \
ci_scanbuild

pushd ci_scanbuild
Expand Down
46 changes: 0 additions & 46 deletions .ci/git_push_if_changes.sh

This file was deleted.

8 changes: 4 additions & 4 deletions .ci/mageia/ci-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ set -e
set -x

PROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
COMMON_MESON_ARGS="-Dtest_dirty_git=${DIRTY_REPO_CHECK:-false} -Ddeveloper_build=false"


pushd /builddir/

# Build the code under GCC and run standard tests
meson --buildtype=debugoptimized \
-Dverbose_tests=false \
$COMMON_MESON_ARGS \
ci

meson test --suite ci \
Expand All @@ -22,9 +19,12 @@ meson test --suite ci \
--print-errorlogs \
-t 5

meson --buildtype=debugoptimized \
-Dverbose_tests=false \
ci-valgrind
meson test --suite ci_valgrind \
--wrap=/builddir/contrib/valgrind/valgrind_wrapper.sh \
-C ci \
-C ci-valgrind \
--num-processes=$PROCESSORS \
--print-errorlogs \
-t 10
Expand Down
11 changes: 8 additions & 3 deletions .ci/openmandriva/ci-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ set -e
set -x

PROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
COMMON_MESON_ARGS="-Dtest_dirty_git=false -Ddeveloper_build=false -Dwith_docs=false"
COMMON_MESON_ARGS="-Dwith_docs=false"

pushd /builddir/

# Build the code under LLVM/clang and run standard tests
CC=clang CXX=clang++ meson --buildtype=debugoptimized \
-Dverbose_tests=false \
$COMMON_MESON_ARGS \
ci

Expand All @@ -21,9 +20,15 @@ meson test --suite ci \
--print-errorlogs \
-t 5

# Disable the verbose tests and run the supported tests through valgrind
CC=clang CXX=clang++ meson --buildtype=debugoptimized \
-Dverbose_tests=false \
$COMMON_MESON_ARGS \
ci-valgrind

meson test --suite ci_valgrind \
--wrap=/builddir/contrib/valgrind/valgrind_wrapper.sh \
-C ci \
-C ci-valgrind \
--num-processes=$PROCESSORS \
--print-errorlogs \
-t 10
Expand Down
2 changes: 1 addition & 1 deletion .ci/opensuse/ci-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
set -x


COMMON_MESON_ARGS="-Dtest_dirty_git=false -Ddeveloper_build=false -Dpython_name=python3"
COMMON_MESON_ARGS="-Dpython_name=python3"


pushd /builddir/
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/formatters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Automatic Code Formatters
on: push

jobs:
autoformat:
name: Auto-format code
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install formatters
run: |
sudo apt-get update
sudo apt-get install clang-format black
- name: Format code
run: |
clang-format -i --verbose $(find . -name "*.[ch]")
black --target-version py36 --verbose --line-length 79 .
- name: Commit changes
uses: EndBug/add-and-commit@v6
with:
author_name: Libmodulemd CI
author_email: [email protected]
message: 'Code auto-formatting'
add: -u
signoff: true
push: true
17 changes: 0 additions & 17 deletions .github/workflows/upstreamed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main

jobs:
static_analysis:
name: Static Analysis
Expand All @@ -30,19 +29,3 @@ jobs:
DOC_TOKEN: ${{ secrets.DOC_TOKEN }}
run: |
./.ci/ci-docs.sh
autoformat:
name: Auto-format code
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Format code
run: |
./.ci/ci-autoformat.sh
- name: Push any formatting changes
run: |
git add -u
$GITHUB_WORKSPACE/.ci/git_push_if_changes.sh -m "Code auto-formatting"
2 changes: 1 addition & 1 deletion contrib/release-tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ hub api "https://api.github.com/user" || error_out code=1 message="Invalid crede
OLDTAG=$(git describe --first-parent --abbrev=0)

# Configure the build directory
meson --buildtype=release -Dskip_formatters=true -Ddeveloper_build=false $TMPDIR
meson --buildtype=release $TMPDIR
MMD_SKIP_VALGRIND=True ninja -C $TMPDIR dist

# Get the version that will be tagged
Expand Down
3 changes: 1 addition & 2 deletions fedora/libmodulemd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ Development files for libmodulemd.


%build
%meson -Ddeveloper_build=false \
%{meson_python_flags}
%meson %{meson_python_flags}

%meson_build

Expand Down
2 changes: 1 addition & 1 deletion fedora/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
tests:
- build:
dir: .
run: meson -Dtest_installed_lib=true -Ddeveloper_build=false source
run: meson -Dtest_installed_lib=true source
- unittests:
dir: .
run: ninja test
5 changes: 1 addition & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,13 @@ if meson.version().version_compare('>=0.53')
'Python 3 GObject Overrides': gobject_overrides_dir_py3
}, section: 'Directories')

summary({'Developer Build': get_option('developer_build'),
'libmagic Support': magic_status,
summary({'libmagic Support': magic_status,
'Custom Python': get_option('python_name'),
'RPMIO Support': rpmio_status,
'Generate Manpages': manpages_status,
'Generate HTML Documentation': get_option('with_docs'),
'Python 2 Support': get_option('with_py2'),
'Skip Formatters': skip_formatters,
'Skip Introspection': get_option('skip_introspection'),
'Test Dirty Git': get_option('test_dirty_git'),
'Test Installed Library': get_option('test_installed_lib'),
}, section: 'Build Configuration')
endif
9 changes: 0 additions & 9 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#
# REMEMBER TO UPDATE THE SUMMARY() IN meson.build when adding options here

option('developer_build', type : 'boolean', value : true,
description : 'Enables automatic code formatters and memory leak checks. This option should be set to FALSE for release builds.')

option('verbose_tests', type : 'boolean', value : true,
description : 'Tests that are run under the "debug" configuration will print all debug messages. Disable this option for valgrind checks, as it speeds it up substantially.')

Expand All @@ -26,15 +23,9 @@ option('python_name', type : 'string',
option('rpmio', type : 'feature', value : 'enabled',
description : 'Use the rpmio library to automatically decompress gzip, bzip2 and xz YAML streams.')

option('skip_formatters', type : 'boolean', value : false,
description : 'Do not do any automatic formatting of source code.')

option('skip_introspection', type : 'boolean', value : false,
description : 'Do not generate GObject Introspection data.')

option('test_dirty_git', type : 'boolean', value : false,
description : 'Check whether the automatic formatting tools have made changes. Used during CI to verify coding style compliance.')

option('test_installed_lib', type : 'boolean', value : false,
description : 'Build only the test suite and run it against a copy of libmodulemd installed on the local system.')

Expand Down
Loading

0 comments on commit 8bb227d

Please sign in to comment.