Skip to content

Commit

Permalink
Run yamllint in CI
Browse files Browse the repository at this point in the history
Helps find errors in GitHub workflows.
  • Loading branch information
akuzm committed Jan 31, 2023
1 parent c0f2ed1 commit f75a51d
Show file tree
Hide file tree
Showing 31 changed files with 253 additions and 114 deletions.
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/flaky-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ body:
id: tests
attributes:
label: Which test is flaky?
description: Use this template to submit reports about flaky tests (pass or fail with no underlying change in code) in TimescaleDB CI.
description: >-
Use this template to submit reports about flaky tests (pass or fail with
no underlying change in code) in TimescaleDB CI.
validations:
required: true

Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/abi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# This test is expected to fail when upstream does ABI incompatible changes
# in a new minor postgresql version.
name: ABI Test
on:
"on":
schedule:
# run daily 20:00 on main branch
- cron: '0 20 * * *'
Expand Down Expand Up @@ -41,7 +41,8 @@ jobs:
strategy:
fail-fast: false
matrix:
test: [ "12backward", "12forward", "13backward", "13forward", "14backward", "14forward", "15backward", "15forward" ]
test: [ "12backward", "12forward", "13backward", "13forward",
"14backward", "14forward", "15backward", "15forward" ]
os: [ windows-2019 ]
include:
- test: 12backward
Expand Down Expand Up @@ -123,7 +124,8 @@ jobs:
cp build_abi/install_lib/* `pg_config --pkglibdir`
chown -R postgres /mnt
set -o pipefail
sudo -u postgres make -C build_abi -k regresscheck regresscheck-t regresscheck-shared IGNORES="${{matrix.ignores}}" | tee installcheck.log
sudo -u postgres make -C build_abi -k regresscheck regresscheck-t \
regresscheck-shared IGNORES="${{matrix.ignores}}" | tee installcheck.log
EOF
- name: Show regression diffs
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/apt-arm-packages.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test installing our ubuntu and debian ARM64 packages for the latest version.
name: APT ARM64 packages
on:
"on":
schedule:
# run daily 0:00 on main branch
- cron: '0 0 * * *'
Expand Down Expand Up @@ -33,22 +33,27 @@ jobs:
run: |
cat <<"EOF" | docker exec -i arm_container bash
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl lsb-release gnupg apt-transport-https sudo postgresql-common
apt-get install -y --no-install-recommends ca-certificates curl \
lsb-release gnupg apt-transport-https sudo postgresql-common
yes | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
curl -s https://packagecloud.io/install/repositories/timescale/timescaledb/script.deb.sh | bash
EOF
- name: Install timescaledb
run: |
cat <<"EOF" | docker exec -i arm_container bash
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends timescaledb-2-postgresql-${{ matrix.pg }} timescaledb-tools
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
timescaledb-2-postgresql-${{ matrix.pg }} timescaledb-tools
timescaledb-tune --quiet --yes
EOF
- name: List available versions
run: |
cat <<"EOF" | docker exec -i arm_container bash
apt-cache show timescaledb-2-postgresql-${{ matrix.pg }} | grep -e Version: -e Depends: | tr '\n' ' ' | sed -e 's! Version: !\n!g' -e 's!Version: !!' -e 's!$!\n!'
apt-cache show timescaledb-2-postgresql-${{ matrix.pg }} \
| grep -e Version: -e Depends: \
| tr '\n' ' ' \
| sed -e 's! Version: !\n!g' -e 's!Version: !!' -e 's!$!\n!'
EOF
- name: Show files in package
Expand Down Expand Up @@ -77,8 +82,11 @@ jobs:
cat <<"EOF" | docker exec -i arm_container bash
set -e
pg_ctlcluster ${{ matrix.pg }} main start
sudo -u postgres psql -X -c "CREATE EXTENSION timescaledb;SELECT extname,extversion,version() FROM pg_extension WHERE extname='timescaledb';"
installed_version=$(sudo -u postgres psql -X -t -c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" | sed -e 's! !!g')
sudo -u postgres psql -X -c "CREATE EXTENSION timescaledb" \
-c "SELECT extname,extversion,version() FROM pg_extension WHERE extname='timescaledb'"
installed_version=$(sudo -u postgres psql -X -t \
-c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" \
| sed -e 's! !!g')
if [ "${{ steps.versions.outputs.version }}" != "$installed_version" ];then
false
fi
Expand Down
30 changes: 20 additions & 10 deletions .github/workflows/apt-packages.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test installing our ubuntu and debian packages for the latest version.
name: APT packages
on:
"on":
schedule:
# run daily 0:00 on main branch
- cron: '0 0 * * *'
Expand Down Expand Up @@ -36,18 +36,21 @@ jobs:
apt-get install -y wget lsb-release gnupg apt-transport-https sudo postgresql-common
yes | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
image_type=$(lsb_release -i -s | tr '[:upper:]' '[:lower:]')
echo "deb https://packagecloud.io/timescale/timescaledb/${image_type}/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/timescaledb.list
echo "deb https://packagecloud.io/timescale/timescaledb/${image_type}/ $(lsb_release -c -s) main" \
> /etc/apt/sources.list.d/timescaledb.list
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add -
- name: Install timescaledb
run: |
apt-get update
apt-get install -y --no-install-recommends timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} timescaledb-tools
apt-get install -y --no-install-recommends \
timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} timescaledb-tools
timescaledb-tune --quiet --yes
- name: List available versions
run: |
apt-cache show timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} | grep -e Version: -e Depends: | tr '\n' ' ' | sed -e 's! Version: !\n!g' -e 's!Version: !!' -e 's!$!\n!'
apt-cache show timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} \
| grep -e Version: -e Depends: | tr '\n' ' ' | sed -e 's! Version: !\n!g' -e 's!Version: !!' -e 's!$!\n!'
- name: Show files in package
run: |
Expand All @@ -71,18 +74,25 @@ jobs:
- name: Test Installation
run: |
pg_ctlcluster ${{ matrix.pg }} main start
sudo -u postgres psql -X -c "CREATE EXTENSION timescaledb;SELECT extname,extversion,version() FROM pg_extension WHERE extname='timescaledb';"
installed_version=$(sudo -u postgres psql -X -t -c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" | sed -e 's! !!g')
sudo -u postgres psql -X -c "CREATE EXTENSION timescaledb" \
-c "SELECT extname,extversion,version() FROM pg_extension WHERE extname='timescaledb'"
installed_version=$(sudo -u postgres psql -X -t \
-c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" | sed -e 's! !!g')
if [ "${{ steps.versions.outputs.version }}" != "$installed_version" ];then
false
fi
- name: Test Downgrade
run: |
# since this runs nightly on main we have to get the previous version from the last released version and not current branch
prev_version=$(wget --quiet -O - https://raw.githubusercontent.com/timescale/timescaledb/${{ steps.versions.outputs.version }}/version.config | grep update_from_version | sed -e 's!update_from_version = !!')
sudo -u postgres psql -X -c "ALTER EXTENSION timescaledb UPDATE TO '${prev_version}';SELECT extname,extversion,version() FROM pg_extension WHERE extname='timescaledb';"
installed_version=$(sudo -u postgres psql -X -t -c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" | sed -e 's! !!g')
# Since this runs nightly on main we have to get the previous version
# from the last released version and not current branch.
prev_version=$(wget --quiet -O - \
https://raw.githubusercontent.com/timescale/timescaledb/${{ steps.versions.outputs.version }}/version.config \
| grep update_from_version | sed -e 's!update_from_version = !!')
sudo -u postgres psql -X -c "ALTER EXTENSION timescaledb UPDATE TO '${prev_version}'" \
-c "SELECT extname,extversion,version() FROM pg_extension WHERE extname='timescaledb'"
installed_version=$(sudo -u postgres psql -X -t \
-c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" | sed -e 's! !!g')
if [ "$prev_version" != "$installed_version" ];then
false
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog-check.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Check CHANGELOG.md updated
on:
"on":
pull_request:
types: [opened, synchronize, reopened, edited]
branches: [main]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coccinelle.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Check our codebase for defective programming patterns
name: Coccinelle
on:
"on":
pull_request:
push:
branches:
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/code_style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ jobs:
find . -name '*.p[lm]' -exec perltidy -b -bext=/ {} +
git diff --exit-code
yaml_checks:
name: Check YAML code in tree
runs-on: ubuntu-latest
steps:
- name: Install prerequisites
run: |
pip install yamllint
- name: Checkout source
uses: actions/checkout@v3
- name: Run yamllint
run: |
find . -type f \( -name "*.yaml" -or -name "*.yml" \) -print -exec yamllint {} \+
cc_checks:
name: Check code formatting
runs-on: ubuntu-22.04
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/coverity.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Coverity
on:
"on":
schedule:
# run at 22:00 on every saturday
- cron: '0 22 * * SAT'
Expand Down Expand Up @@ -31,7 +31,9 @@ jobs:

- name: Coverity tools
run: |
wget https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=timescale%2Ftimescaledb" -O coverity_tool.tgz -q
wget https://scan.coverity.com/download/linux64 \
--post-data "token=${{ secrets.COVERITY_TOKEN }}&project=timescale%2Ftimescaledb" \
-O coverity_tool.tgz -q
tar xf coverity_tool.tgz
mv cov-analysis-linux64-* coverity
Expand All @@ -50,4 +52,5 @@ jobs:
COVERITY_URL: https://scan.coverity.com/builds?project=timescale%2Ftimescaledb
run: |
tar czf timescaledb.tgz cov-int
curl $FORM_TOKEN $FORM_EMAIL $FORM_DESC $FORM_FILE --form version="$(grep '^version' version.config | cut -b11-)-${{ matrix.pg }}" $COVERITY_URL
curl $FORM_TOKEN $FORM_EMAIL $FORM_DESC $FORM_FILE \
--form version="$(grep '^version' version.config | cut -b11-)-${{ matrix.pg }}" $COVERITY_URL
2 changes: 1 addition & 1 deletion .github/workflows/cron-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Additional tests
on:
"on":
push:
branches:
- main
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/homebrew.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test installation of our homebrew tap for latest version
name: Homebrew
on:
"on":
schedule:
# run daily 20:00 on main branch
- cron: '0 20 * * *'
Expand Down Expand Up @@ -49,7 +49,9 @@ jobs:
else
version=$(grep '^update_from_version = ' version.config | sed -e 's!^update_from_version = !!')
fi
installed_version=$(psql -X -t -c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" postgres | sed -e 's! !!g')
installed_version=$(psql -X -t \
-c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" \
postgres | sed -e 's! !!g')
if [ "$version" != "$installed_version" ];then
echo "Installed version \"${installed_version}\" does not match expected version \"${version}\"."
false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux-32bit-build-and-test-ignored.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# needed to run required workflows even when the real workflow is not
# executed because some files were ignored.
name: Regression Linux i386
on:
"on":
push:
branches:
- prerelease_test
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/linux-32bit-build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Regression Linux i386
on:
"on":
push:
branches:
- main
Expand Down Expand Up @@ -35,7 +35,8 @@ jobs:
options: --privileged --ulimit core=-1
env:
DEBIAN_FRONTEND: noninteractive
IGNORES: append-* debug_notice transparent_decompression-* transparent_decompress_chunk-* plan_skip_scan-12 pg_dump
IGNORES: "append-* debug_notice transparent_decompression-*
transparent_decompress_chunk-* plan_skip_scan-12 pg_dump"
SKIPS: chunk_adaptive
strategy:
fail-fast: false
Expand All @@ -55,17 +56,20 @@ jobs:
apt-get update
apt-get install -y gnupg postgresql-common
yes | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
apt-get install -y gcc make cmake libssl-dev libkrb5-dev libipc-run-perl libtest-most-perl sudo gdb git wget gawk
apt-get install -y gcc make cmake libssl-dev libkrb5-dev libipc-run-perl \
libtest-most-perl sudo gdb git wget gawk
apt-get install -y postgresql-${PG_MAJOR} postgresql-server-dev-${PG_MAJOR}
- name: Build pg_isolation_regress
run: |
PG_MAJOR=$(echo "${{ matrix.pg }}" | sed -e 's![.].*!!')
wget -q -O postgresql.tar.bz2 https://ftp.postgresql.org/pub/source/v${{ matrix.pg }}/postgresql-${{ matrix.pg }}.tar.bz2
wget -q -O postgresql.tar.bz2 \
https://ftp.postgresql.org/pub/source/v${{ matrix.pg }}/postgresql-${{ matrix.pg }}.tar.bz2
mkdir -p ~/postgresql
tar --extract --file postgresql.tar.bz2 --directory ~/postgresql --strip-components 1
cd ~/postgresql
./configure --prefix=/usr/lib/postgresql/${PG_MAJOR} --enable-debug --enable-cassert --with-openssl --without-readline --without-zlib
./configure --prefix=/usr/lib/postgresql/${PG_MAJOR} --enable-debug \
--enable-cassert --with-openssl --without-readline --without-zlib
make -C src/test/isolation
chown -R postgres:postgres ~/postgresql
Expand All @@ -88,7 +92,8 @@ jobs:
run: |
set -o pipefail
export LANG=C.UTF-8
sudo -u postgres make -k -C build installcheck IGNORES="${IGNORES} ${{ matrix.ignores_version }}" SKIPS="${SKIPS}" | tee installcheck.log
sudo -u postgres make -k -C build installcheck IGNORES="${IGNORES} \
${{ matrix.ignores_version }}" SKIPS="${SKIPS}" | tee installcheck.log
- name: Show regression diffs
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux-build-and-test-ignored.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# needed to run required workflows even when the real workflow is not
# executed because some files were ignored.
name: Regression
on:
"on":
push:
branches:
- prerelease_test
Expand Down
25 changes: 17 additions & 8 deletions .github/workflows/linux-build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Regression
on:
"on":
schedule:
# run daily 0:00 on main branch
# Since we use the date as a part of the cache key to ensure no
Expand Down Expand Up @@ -63,7 +63,8 @@ jobs:
# Don't add ddebs here because the ddebs mirror is always 503 Service Unavailable.
# If needed, install them before opening the core dump.
sudo apt-get update
sudo apt-get install flex bison lcov systemd-coredump gdb libipc-run-perl libtest-most-perl ${{ matrix.extra_packages }}
sudo apt-get install flex bison lcov systemd-coredump gdb libipc-run-perl \
libtest-most-perl ${{ matrix.extra_packages }}
# The GCC 11 gcov segfaults with the coverage info generated by clang.
sudo ln -sf $(which llvm-cov-14) $(which gcov)
Expand Down Expand Up @@ -103,20 +104,24 @@ jobs:
uses: actions/cache@v3
with:
path: ~/${{ env.PG_SRC_DIR }}
key: ${{ matrix.os }}-postgresql-${{ matrix.pg }}-${{ matrix.cc }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('.github/**') }}${{ env.CACHE_SUFFIX }}
key: "${{ matrix.os }}-postgresql-${{ matrix.pg }}-${{ matrix.cc }}\
-${{ steps.get-date.outputs.date }}-${{ hashFiles('.github/**') }}${{ env.CACHE_SUFFIX }}"

- name: Build PostgreSQL ${{ matrix.pg }}${{ matrix.snapshot }}
if: steps.cache-postgresql.outputs.cache-hit != 'true'
run: |
if [ "${{ matrix.snapshot }}" = "snapshot" ]; then
wget -q -O postgresql.tar.bz2 https://ftp.postgresql.org/pub/snapshot/${{ matrix.pg }}/postgresql-${{ matrix.pg }}-snapshot.tar.bz2
wget -q -O postgresql.tar.bz2 \
https://ftp.postgresql.org/pub/snapshot/${{ matrix.pg }}/postgresql-${{ matrix.pg }}-snapshot.tar.bz2
else
wget -q -O postgresql.tar.bz2 https://ftp.postgresql.org/pub/source/v${{ matrix.pg }}/postgresql-${{ matrix.pg }}.tar.bz2
wget -q -O postgresql.tar.bz2 \
https://ftp.postgresql.org/pub/source/v${{ matrix.pg }}/postgresql-${{ matrix.pg }}.tar.bz2
fi
mkdir -p ~/$PG_SRC_DIR
tar --extract --file postgresql.tar.bz2 --directory ~/$PG_SRC_DIR --strip-components 1
cd ~/$PG_SRC_DIR
./configure --prefix=$HOME/$PG_INSTALL_DIR --with-openssl --without-readline --without-zlib --without-libxml ${{ matrix.pg_extra_args }}
./configure --prefix=$HOME/$PG_INSTALL_DIR --with-openssl \
--without-readline --without-zlib --without-libxml ${{ matrix.pg_extra_args }}
make -j $MAKE_JOBS
make -j $MAKE_JOBS -C src/test/isolation
make -j $MAKE_JOBS -C contrib/postgres_fdw
Expand All @@ -136,14 +141,18 @@ jobs:
- name: Test telemetry without OpenSSL
if: github.event_name != 'pull_request' && runner.os == 'Linux' && matrix.build_type == 'Debug'
run: |
BUILD_DIR=nossl ./bootstrap -DCMAKE_BUILD_TYPE=Debug -DPG_SOURCE_DIR=~/$PG_SRC_DIR -DPG_PATH=~/$PG_INSTALL_DIR ${{ matrix.tsdb_build_args }} -DCODECOVERAGE=${{ matrix.coverage }} -DUSE_OPENSSL=OFF
BUILD_DIR=nossl ./bootstrap -DCMAKE_BUILD_TYPE=Debug \
-DPG_SOURCE_DIR=~/$PG_SRC_DIR -DPG_PATH=~/$PG_INSTALL_DIR \
${{ matrix.tsdb_build_args }} -DCODECOVERAGE=${{ matrix.coverage }} -DUSE_OPENSSL=OFF
make -j $MAKE_JOBS -C nossl
make -C nossl install
make -C nossl regresscheck TESTS=telemetry
- name: Build TimescaleDB
run: |
./bootstrap -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DPG_SOURCE_DIR=~/$PG_SRC_DIR -DPG_PATH=~/$PG_INSTALL_DIR ${{ matrix.tsdb_build_args }} -DCODECOVERAGE=${{ matrix.coverage }} -DLINTER_STRICT=ON
./bootstrap -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DPG_SOURCE_DIR=~/$PG_SRC_DIR -DPG_PATH=~/$PG_INSTALL_DIR \
${{ matrix.tsdb_build_args }} -DCODECOVERAGE=${{ matrix.coverage }} -DLINTER_STRICT=ON
make -j $MAKE_JOBS -C build
make -C build install
Expand Down
Loading

0 comments on commit f75a51d

Please sign in to comment.