blob: 3c89801e4421fb485d3c2a8561398e3535683d23 [file] [edit]
name: package:cupertino_http ffigen
permissions:
contents: read
# Verifies that the checked-in bindings match the bindings generated by
# `tool/ffigen.dart` on CI. The bindings generated here are the source of
# truth: if they differ, download the "FFIgen Bindings" artifact from the
# failed run and commit it.
#
# Only runs when the bindings or their configuration change, so that updates
# to the runner's Xcode version do not affect unrelated pull requests.
#
# Changes to the `ffigen` dependency in `pubspec.yaml` should also trigger
# this check but catching all changes to `pubspec.yaml` would result in a
# lot of false CI failures (because the Xcode version of the CI runners
# can change without notice). The intent of this check is to make sure that
# people are using `ffigen` to generate the bindings (and not hand-editing
# them afterwards), which makes triggering on changes to the generated files
# sufficient.
on:
push:
branches:
- main
- master
paths:
- '.github/workflows/cupertino_ffigen.yml'
- 'pkgs/cupertino_http/lib/src/native_cupertino_bindings.dart'
- 'pkgs/cupertino_http/src/native_cupertino_bindings.m'
- 'pkgs/cupertino_http/tool/ffigen.dart'
pull_request:
paths:
- '.github/workflows/cupertino_ffigen.yml'
- 'pkgs/cupertino_http/lib/src/native_cupertino_bindings.dart'
- 'pkgs/cupertino_http/src/native_cupertino_bindings.m'
- 'pkgs/cupertino_http/tool/ffigen.dart'
env:
PUB_ENVIRONMENT: bot.github
jobs:
generate:
name: ffigen
runs-on: macos-latest
defaults:
run:
working-directory: pkgs/cupertino_http
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: dart-lang/setup-dart@2286a0c042b44434fe26d292bbce8d34f7ec662b
with:
sdk: stable
- id: install
name: Install dependencies
run: dart pub get
- name: Regenerate
run: dart run tool/ffigen.dart
- name: Generated Diff
run: |
git diff --exit-code \
lib/src/native_cupertino_bindings.dart \
src/native_cupertino_bindings.m || {
echo "::error::The generated bindings are out of date." \
"Download the 'FFIgen Bindings' artifact from the Artifacts" \
"section of this run's Summary page, unzip it into" \
"pkgs/cupertino_http and commit the result to this PR."
exit 1
}
- name: Upload bindings
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
with:
name: FFIgen Bindings
path: |
pkgs/cupertino_http/lib/src/native_cupertino_bindings.dart
pkgs/cupertino_http/src/native_cupertino_bindings.m
retention-days: 1