Skip to content

Commit

Permalink
Merge pull request #185 from dart-lang/merge-ffigen-package
Browse files Browse the repository at this point in the history
Merge package:ffigen into dart-lang/native
  • Loading branch information
dcharkes authored Nov 14, 2023
2 parents eaea725 + ff47496 commit 29e423c
Show file tree
Hide file tree
Showing 311 changed files with 218,124 additions and 0 deletions.
139 changes: 139 additions & 0 deletions .github/workflows/ffigen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: ffigen CI

on:
# Run on PRs and pushes to the default branch.
push:
branches: [main, stable]
paths:
- '.github/workflows/ffigen.yml'
- 'pkgs/ffigen/**'
pull_request:
branches: [main, stable]
paths:
- '.github/workflows/ffigen.yml'
- 'pkgs/ffigen/**'
schedule:
- cron: "0 0 * * 0"

env:
PUB_ENVIRONMENT: bot.github

jobs:
# Check code formatting and static analysis on a single OS (macos).
analyze:
runs-on: macos-latest
defaults:
run:
working-directory: pkgs/ffigen/
strategy:
fail-fast: false
matrix:
# TODO: Change to 3.2.0 stable once it's released.
sdk: [3.2.0-210.4.beta]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get && dart pub get --directory="example/shared_bindings"
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
if: always() && steps.install.outcome == 'success'
- name: Build test dylib and bindings
run: dart test/setup.dart
- name: Analyze code
run: dart analyze --fatal-infos
if: always() && steps.install.outcome == 'success'

test-linux:
needs: analyze
runs-on: ubuntu-22.04
defaults:
run:
working-directory: pkgs/ffigen/
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
with:
sdk: 3.2.0-210.4.beta
- name: Install dependencies
run: dart pub get
- name: Install libclang-14-dev
run: sudo apt-get install libclang-14-dev
- name: Build test dylib and bindings
run: dart test/setup.dart
- name: Run VM tests
run: dart test --platform vm --concurrency=1

test-mac:
needs: analyze
runs-on: macos-latest
defaults:
run:
working-directory: pkgs/ffigen/
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
with:
sdk: 3.2.0-210.4.beta
- name: Install dependencies
run: dart pub get
- name: Build test dylib and bindings
run: dart test/setup.dart
- name: Run VM tests
run: dart test --platform vm --concurrency=1
- name: Collect coverage
run: ./tool/coverage.sh
- name: Upload coverage
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: pkgs/ffigen/lcov.info

test-windows:
needs: analyze
runs-on: windows-latest
defaults:
run:
working-directory: pkgs/ffigen/
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
with:
sdk: 3.2.0-210.4.beta
- name: Install dependencies
run: dart pub get
- name: Build test dylib and bindings
run: dart test/setup.dart
- name: Run VM tests
run: dart test --platform vm --concurrency=1

# Sanity check the latest `flutter create --template plugin_ffi`.
# This will break if we change the Flutter template or the generated code.
# But, getting libclang on the LUCI infrastructure has proven to be
# non-trivial. See discussion on
# https://github.com/flutter/flutter/issues/105513.
# If we need to change the generated code, we should temporarily disable this
# test, or temporarily disable the requirement for all bots to be green to
# merge PRs.
# Running this sanity check on one OS should be sufficient. Chosing Windows
# because it is the most likely to break.
test-windows-flutter:
needs: analyze
runs-on: windows-latest
defaults:
run:
working-directory: pkgs/ffigen/
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: "master"
- name: Install dependencies
run: flutter pub get
- name: Build test dylib and bindings
run: dart test/setup.dart
- name: Run VM tests
run: flutter pub run test test_flutter/ --platform vm
1 change: 1 addition & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ jobs:
pull-requests: write # Required for writing the pull request note
with:
write-comments: false
sdk: beta
44 changes: 44 additions & 0 deletions pkgs/ffigen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# See https://dart.dev/guides/libraries/private-files

# Files and directories created by pub.
.dart_tool/
.packages
pubspec.lock

# IDE and debugger files.
.clangd
.gdb_history
.history
.vscode
compile_commands.json

# Directory created by dartdoc.
# If you don't generate documentation locally you can remove this line.
doc/api/

# Avoid committing generated Javascript files:
*.dart.js
*.info.json # Produced by the --dump-info flag.
*.js # When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js_
*.js.deps
*.js.map

# Generated shared libraries.
*.so
*.so.*
*.dylib
*.dll

# Directory for quick experiments.
experiments/

# Files generated by tests for debugging purposes.
test/debug_generated/*
!test/debug_generated/readme.md
lcov.info
coverage.json

# Files generated by various OSs.
.DS_Store
8 changes: 8 additions & 0 deletions pkgs/ffigen/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Below is a list of people and organizations that have contributed
# to the Dart project. Names should be added to the list like so:
#
# Name/Organization <email address>

Google LLC

Prerak Mann <mannprerak2@gmail.com>
Loading

0 comments on commit 29e423c

Please sign in to comment.