Skip to content

Commit

Permalink
Added a cron workflow to build with server main/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
levb committed Jul 13, 2023
1 parent c37ee8b commit eb404dd
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 14 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,12 @@ jobs:
matrix:
compiler: [gcc, clang]
ubuntu_version: [latest, 20.04]
include:
- compiler: gcc
ubuntu_version: latest
use_cache_key: ubuntu-latest-gcc-${{ github.sha }}
uses: ./.github/workflows/build-test.yml
with:
ubuntu_version: ${{ matrix.ubuntu_version }}
compiler: ${{ matrix.compiler }}
name: "ubuntu.${{ matrix.ubuntu_version }}-${{ matrix.compiler }}-latest"
use_cache_key: ${{ matrix.use_cache_key }}
cache_build: ${{ matrix.compiler == 'gcc' && matrix.ubuntu_version == 'latest' }}

more-server-versions:
needs: [check, default]
Expand All @@ -63,7 +59,7 @@ jobs:
with:
server_version: ${{ matrix.server_version }}
name: "ubuntu.latest-gcc-${{ matrix.server_version }}"
use_cache_key: ubuntu-latest-gcc-${{ github.sha }}
cache_build: true

TLS-OFF:
needs: [check, default]
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
arch:
type: string
default: "64"
cache_build:
type: boolean
description: "whether to cache the build"
default: false
compiler:
type: string
default: "gcc"
Expand Down Expand Up @@ -45,9 +49,6 @@ on:
type: string
description: "Ubuntu version to use, e.g. '20.04'"
default: "latest"
use_cache_key:
type: string
description: "Use cache key to speed up build"
secrets:
COVERALLS_REPO_TOKEN:
description: "Coveralls repo token"
Expand Down Expand Up @@ -111,6 +112,9 @@ jobs:
fi
echo "CC=${{ inputs.compiler }}" >> $GITHUB_ENV
# note that the key is not truly unique, but it is good enough for our purposes
echo "cache_key=nats.c-u${{ inputs.ubuntu_version }}-${{ inputs.compiler }}-${{ inputs.type }}-${{ inputs.arch }}-$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
# install build dependencies
- name: Install ${{ inputs.compiler }} if needed
if: startsWith(inputs.compiler, 'clang-') || startsWith(inputs.compiler, 'gcc-')
Expand All @@ -120,12 +124,12 @@ jobs:
- name: Download previous build
id: download-prior-build
if: inputs.use_cache_key
if: inputs.cache_build
continue-on-error: true
uses: actions/cache/restore@v3
with:
path: build
key: ${{ inputs.use_cache_key }}
key: ${{ steps.nats-vars.outputs.cache_key }}

# otherwise, configure cmake, build, archive and upload
- name: CMake
Expand All @@ -147,11 +151,11 @@ jobs:
fi
- name: "Cache the build to reuse it later"
if: steps.download-prior-build.outputs.cache-hit != 'true' && inputs.use_cache_key
if: steps.download-prior-build.outputs.cache-hit != 'true' && inputs.cache_build
uses: actions/cache/save@v3
with:
path: build
key: ${{ inputs.use_cache_key }}
key: ${{ steps.nats-vars.outputs.cache_key }}

# testing
- name: "Test app using dynamic library does not crash if no NATS call is made"
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/cron-test-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: test-server

on:
schedule:
- cron: "0 2 * * *" # every day at 2AM

permissions:
contents: write # so it can comment

defaults:
run:
shell: bash --noprofile --norc -x -eo pipefail {0}

jobs:
test-server:
strategy:
fail-fast: false
matrix:
server_version: [main, dev]
concurrency:
group: test-server
uses: ./.github/workflows/build-test.yml
with:
server_version: ${{ matrix.server_version }}
name: "ubuntu.latest-gcc-${{ matrix.server_version }}"
cache_build: true
7 changes: 6 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ set(testIndex 0)
# Read the file 'list.txt' to get all the test names
file(STRINGS list.txt listOfTestNames)

# See https://github.com/nats-io/nats.c/issues/674
file(STRINGS flappers.txt listOfSkipFlappers)

# See https://github.com/nats-io/nats.c/issues/672
file(STRINGS no-sanitize.txt listOfSkipSanitize)

# For each test name
foreach(name ${listOfTestNames})
if(DEFINED ENV{NATS_SANITIZE} AND "${name}" IN_LIST listOfSkipSanitize)
if("${name}" IN_LIST listOfSkipFlappers)
# skip, see https://github.com/nats-io/nats.c/issues/674
elseif(DEFINED ENV{NATS_SANITIZE} AND "${name}" IN_LIST listOfSkipSanitize)
# skip, see https://github.com/nats-io/nats.c/issues/672
else()
# Create a test and pass the index (start and end are the same)
Expand Down
1 change: 1 addition & 0 deletions test/flappers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PendingLimitsDeliveredAndDropped

0 comments on commit eb404dd

Please sign in to comment.