ci: run builds on trusted contribution (#410) #729
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: C++ Conformance CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
env: | |
vcpkg_SHA: "2023.06.20" | |
jobs: | |
coverage: | |
name: coverage | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: install tools | |
run: sudo apt install ninja-build lcov | |
- uses: actions/checkout@v4 | |
- name: clone-vcpkg | |
working-directory: "${{runner.temp}}" | |
run: > | |
mkdir -p vcpkg && | |
curl -sSL "https://github.com/microsoft/vcpkg/archive/${{env.vcpkg_SHA}}.tar.gz" | | |
tar -C vcpkg --strip-components=1 -zxf - | |
- name: cache-vcpkg | |
id: cache-vcpkg | |
uses: actions/cache@v4 | |
with: | |
# Preserve the vcpkg binary *and* the vcpkg binary cache in the build cache | |
path: | | |
~/.cache/vcpkg | |
~/.cache/bin | |
key: | | |
vcpkg-${{ env.vcpkg_SHA }}-coverage-${{ hashFiles('vcpkg.json') }} | |
restore-keys: | | |
vcpkg-${{ env.vcpkg_SHA }}-coverage- | |
- name: boostrap-vcpkg | |
run: ci/restore-vcpkg-from-cache.sh "${{runner.temp}}/vcpkg" | |
- name: configure | |
run: > | |
cmake -S . -B ${{runner.workspace}}/build -GNinja | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
-DCMAKE_BUILD_TYPE=Debug | |
-DCMAKE_CXX_FLAGS=--coverage | |
-DCMAKE_TOOLCHAIN_FILE="${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake" | |
- uses: actions/cache/save@v4 | |
if: always() | |
with: | |
path: | | |
~/.cache/vcpkg | |
~/.cache/bin | |
key: vcpkg-${{ env.vcpkg_SHA }}-coverage-${{ hashFiles('vcpkg.json') }} | |
- name: build | |
run: cmake --build ${{runner.workspace}}/build | |
- name: test | |
working-directory: ${{runner.workspace}}/build | |
run: ctest --output-on-failure --timeout=60s | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '^1.16' | |
- name: Run Cloud Event conformance tests | |
uses: GoogleCloudPlatform/functions-framework-conformance/action@v1.8.6 | |
with: | |
functionType: 'cloudevent' | |
useBuildpacks: false | |
validateMapping: true | |
cmd: '${{runner.workspace}}/build/google/cloud/functions/integration_tests/cloud_event_conformance' | |
- name: Run HTTP conformance tests | |
uses: GoogleCloudPlatform/functions-framework-conformance/action@v1.8.6 | |
with: | |
functionType: 'http' | |
useBuildpacks: false | |
validateMapping: true | |
cmd: '${{runner.workspace}}/build/google/cloud/functions/integration_tests/http_conformance' | |
- name: coverage-upload | |
uses: codecov/codecov-action@v4 | |
with: | |
directory: ${{ runner.workspace }} | |
token: ${{ vars.CODECOV_TOKEN }} |