| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- name: Run Conformance Tests
- # This workflow is a subset of the build.yml. It *only* try to run the
- # conformance checks. It is triggered weekly on a cron to catch when new
- # conformance tests are added and they don't pass.
- #
- # Without this workflow the new tests wouldn't be noticed until a PR was made.
- #
- # This workflow shares the caching logic with build.yml. It should serve to
- # update a subset of the caches for when things do land on trunk. If that
- # is deemed not worth it in the future, this can be simplify.
- # NOTE: If making changes to most of the steps, please also look to update
- # build.yml also.
- on:
- schedule:
- # Every Sunday at 5am.
- - cron: '0 5 * * 0'
- # Also allow manual triggering from the github UX to revalidate things.
- workflow_dispatch:
- jobs:
- build:
- runs-on: ubuntu-latest
- strategy:
- matrix:
- # We "float" the bug fix so we pick up new ones. This helps since the GitHub CI
- # is set to ensure the actions pass, thus updates are only needed when the
- # "major.minor" pairs changes.
- #
- # Looking at https://hub.docker.com/_/swift, the version only tags (i.e. - 6.1)
- # could use different Ubuntu releases. At the moment they are all the "noble",
- # which is also what would be desired, so we don't bother listing explicit ones.
- swift:
- - "6.2"
- # protobuf_git can reference a commit, tag, or branch
- # commit: "commits/6935eae45c99926a000ecbef0be20dfd3d159e71"
- # tag: "ref/tags/v3.11.4"
- # branch: "ref/heads/main"
- protobuf_git: ["ref/heads/main"]
- container:
- image: swift:${{ matrix.swift }}
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- path: swift-protobuf
- - name: Update and install dependencies
- # dependencies from https://github.com/protocolbuffers/protobuf/blob/main/src/README.md
- # this step is run before get-sha because we need curl and jq for get-sha
- run: apt-get update && apt-get install -y curl make g++ cmake jq
- - name: Get Protobuf Commit SHA
- id: get-sha
- run: |
- set -eu
- url="https://api.github.com/repos/protocolbuffers/protobuf/git/${{ matrix.protobuf_git }}"
- case ${{ matrix.protobuf_git }} in
- ref/*)
- echo "sha=$( curl -s -u "u:${{ github.token }}" "${url}" | jq -r .object.sha )" >> $GITHUB_OUTPUT
- ;;
- commits/*)
- echo "sha=$( curl -s -u "u:${{ github.token }}" "${url}" | jq -r .sha )" >> $GITHUB_OUTPUT
- ;;
- esac
- - name: Cache protobuf
- id: cache-protobuf
- uses: actions/cache@v4
- with:
- path: protobuf
- # NOTE: for refs that can float like 'main' the cache might be out of date!
- key: ${{ runner.os }}-${{ matrix.swift }}-protobuf-${{ steps.get-sha.outputs.sha }}
- - name: Checkout protobuf repo
- if: steps.cache-protobuf.outputs.cache-hit != 'true'
- uses: actions/checkout@v4
- with:
- repository: protocolbuffers/protobuf
- ref: ${{ steps.get-sha.outputs.sha }}
- submodules: true
- path: protobuf
- - name: Build protobuf
- if: steps.cache-protobuf.outputs.cache-hit != 'true'
- working-directory: protobuf
- # https://github.com/protocolbuffers/protobuf/blob/main/cmake/README.md#c-version
- run: |
- mkdir cmake_build
- cd cmake_build
- cmake \
- -DCMAKE_CXX_STANDARD=17 \
- -DCMAKE_BUILD_TYPE=Release \
- -Dprotobuf_BUILD_TESTS=OFF \
- -Dprotobuf_INSTALL=OFF \
- -Dprotobuf_BUILD_CONFORMANCE=ON \
- -S ..
- NUM_CPUS=$(getconf _NPROCESSORS_ONLN)
- make -j "${NUM_CPUS}" protoc conformance_test_runner
- - name: Test conformance
- working-directory: swift-protobuf
- run: make test-conformance CONFORMANCE_TEST_RUNNER=../protobuf/cmake_build/conformance_test_runner
|