Migrate to GitHub Actions (#124)
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
new file mode 100644
index 0000000..c4f98d2
--- /dev/null
+++ b/.github/workflows/test-package.yml
@@ -0,0 +1,64 @@
+name: Dart CI
+
+on:
+ # Run on PRs and pushes to the default branch.
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+ schedule:
+ - cron: "0 0 * * 0"
+
+env:
+ PUB_ENVIRONMENT: bot.github
+
+jobs:
+ # Check code formatting and static analysis on a single OS (linux)
+ # against Dart stable.
+ analyze:
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ sdk: [stable]
+ steps:
+ - uses: actions/checkout@v2
+ - uses: dart-lang/setup-dart@v0.1
+ with:
+ channel: ${{ matrix.sdk }}
+ - id: install
+ name: Install dependencies
+ run: dart pub get
+ - name: Check formatting
+ run: dart format --output=none --set-exit-if-changed .
+ if: always() && steps.install.outcome == 'success'
+ - name: Analyze code
+ run: dart analyze --fatal-infos
+ if: always() && steps.install.outcome == 'success'
+
+ test:
+ needs: analyze
+ # This job requires clang-10 which is the default on 20.04
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - uses: dart-lang/setup-dart@v0.1
+ with:
+ channel: stable
+ - name: Install dependencies
+ run: dart pub get
+ - name: Install libclang-10-dev
+ run: sudo apt-get install libclang-10-dev
+ - name: Setup ffigen
+ run: dart pub run ffigen:setup
+ - name: Build test dylib
+ run: cd test/native_test && dart build_test_dylib.dart && cd ../..
+ - name: Run VM tests
+ run: dart test --platform vm
+ - name: Collect coverage
+ run: ./tool/travis.sh
+ - name: Upload coverage
+ uses: coverallsapp/github-action@v1.1.2
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ path-to-lcov: lcov.info
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 6f311a4..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-language: dart
-dart:
-- stable
-# Only building master means that we don't run two builds for each pull request.
-dart_task:
-- test: --platform vm
-- dartanalyzer
-- dartfmt
-branches:
- only: [master]
-cache:
- directories:
- - $HOME/.pub-cache
-before_install:
- # Install libclang-dev.
- - sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main"
- - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
- - sudo apt-get update
- - sudo apt-get install clang-10 libclang-10-dev
- # Use clang from installed llvm.
- - export PATH="/usr/lib/llvm-10/bin:$PATH"
-
-before_script:
- - 'dart pub run ffigen:setup'
- - cd test/native_test && dart build_test_dylib.dart && cd ../..
-
-matrix:
- include:
- - dart: stable
- script: ./tool/travis.sh
- name: Collect and report coverage.
diff --git a/README.md b/README.md
index a48185c..625acd2 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
[![pub package](https://img.shields.io/pub/v/ffigen.svg)](https://pub.dev/packages/ffigen)
-[![Build Status](https://travis-ci.org/dart-lang/ffigen.svg?branch=master)](https://travis-ci.org/dart-lang/ffigen)
+[![Build Status](https://github.com/dart-lang/ffigen/workflows/Dart%20CI/badge.svg)](https://github.com/dart-lang/ffigen/actions?query=workflow%3A"Dart+CI")
[![Coverage Status](https://coveralls.io/repos/github/dart-lang/ffigen/badge.svg?branch=master)](https://coveralls.io/github/dart-lang/ffigen?branch=master)
Experimental binding generator for [FFI](https://dart.dev/guides/libraries/c-interop)
diff --git a/tool/travis.sh b/tool/travis.sh
index 987955b..341aada 100755
--- a/tool/travis.sh
+++ b/tool/travis.sh
@@ -7,13 +7,10 @@
# Fast fail the script on failures.
set -e
-# Gather coverage and upload to Coveralls.
+# Gather coverage.
pub global activate remove_from_coverage
pub global activate dart_coveralls
# Generate coverage report.
pub global run dart_coveralls calc test/test_coverage.dart > lcov.info
# Remove extra files from coverage report.
pub global run remove_from_coverage -f lcov.info -r ".pub-cache"
-# Upload to coveralls.
-gem install coveralls-lcov
-coveralls-lcov lcov.info