Skip to content

Commit

Permalink
Don't run CI unless there are salient code changes (#434)
Browse files Browse the repository at this point in the history
* Don't run CI unless there are salient code changes

* Key off of file extensions, not directories

* Also filter unit test builds

* Make a change to a non-HPKE component

* Properly quote YAML strings

* Require a specific path

* Touch the file again

* Revert top-level filters

* Revert all changes

* Trigger on changes to workflows

* Trigger on code changes

* Reinstate filters

* Try a different strategy

* Trigger on workflow changes

* Fix copy/paste error

* Fix copy/paste error

* Touch an hpke file

* Revert code changes

* Use the crypto matrix to guide CI jobs

* Correct 'needs'

* Restore accidentally deleted checkout step
  • Loading branch information
bifurcation authored Nov 1, 2024
1 parent 7d94b14 commit 8ec63dd
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ on:
push:
branches:
- main
paths:
- ".github/**"
- "**.cpp"
- "**.h"
pull_request:
branches:
- main
paths:
- ".github/**"
- "**.cpp"
- "**.h"

env:
CMAKE_BUILD_PARALLEL_LEVEL: 3
Expand All @@ -15,8 +23,33 @@ env:
CMAKE_TOOLCHAIN_FILE: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake

jobs:
choose_crypto_matrix:
name: Choose crypto libraries to test with
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: dorny/paths-filter@v3
id: filterV
with:
filters: |
hpke:
- 'lib/hpke/include/**'
- 'lib/hpke/src/**'
- 'lib/hpke/test/**'
- id: set-matrix
run: |
if [ ${{ steps.filter.outputs.hpke }} = "true" ];
then
echo "matrix=[\"openssl_1.1\",\"openssl_3\",\"boringssl\"]" >> $GITHUB_OUTPUT;
else
echo "matrix=[\"openssl_3\"]" >> $GITHUB_OUTPUT
fi
formatting-check:
name: Formatting Check
needs: choose_crypto_matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -29,13 +62,13 @@ jobs:
fallback-style: 'Mozilla'

build-and-unit-test:
needs: formatting-check
needs: [formatting-check, choose_crypto_matrix]
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
crypto: [openssl_1.1, openssl_3, boringssl]
crypto: ${{ fromJson(needs.choose_crypto_matrix.outputs.matrix )}}

env:
CRYPTO_DIR: "./alternatives/${{ matrix.crypto }}"
Expand Down Expand Up @@ -108,12 +141,12 @@ jobs:
clang-tidy:
if: github.event.pull_request.draft == false
needs: build-and-unit-test
needs: [build-and-unit-test, choose_crypto_matrix]
name: Build with clang-tidy
runs-on: ubuntu-latest
strategy:
matrix:
crypto: [openssl_1.1, openssl_3, boringssl]
crypto: ${{ fromJson(needs.choose_crypto_matrix.outputs.matrix )}}

env:
CRYPTO_DIR: "./alternatives/${{ matrix.crypto }}"
Expand Down

0 comments on commit 8ec63dd

Please sign in to comment.