Skip to content

CI check

CI check #241

Workflow file for this run

name: CI check
on:
schedule:
- cron: '0 8 1/7 * *'
push:
branches:
- master
tags:
pull_request:
release:
types: # This configuration does not affect the page_build event above
- created
jobs:
# Set up Flutter for all other tasks.
setup:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
include:
- os: ubuntu-latest
flutter_path: /opt/hostedtoolcache/flutter
# - os: macos-10.15
# flutter_path: /Users/runner/hostedtoolcache/flutter
# - os: macos-11.0
# flutter_path: /Users/runner/hostedtoolcache/flutter
- os: macos-latest
flutter_path: /Users/runner/hostedtoolcache/flutter
- os: windows-latest
flutter_path: C:\Users\runneradmin\hostedtoolcache\flutter
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Cache Flutter dependencies
uses: actions/cache@v3
with:
path: ${{ matrix.flutter_path }}
key: ${{ matrix.os }}-flutter
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
build-rust-and-test:
runs-on: ${{ matrix.os }}
needs: setup
timeout-minutes: 30
strategy:
matrix:
os: [macos-latest]
include:
# - os: ubuntu-latest
# flutter_path: /opt/hostedtoolcache/flutter
# - os: macos-10.15
# flutter_path: /Users/runner/hostedtoolcache/flutter
# - os: macos-11.0
# flutter_path: /Users/runner/hostedtoolcache/flutter
- os: macos-latest
flutter_path: /Users/runner/hostedtoolcache/flutter
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r22b
add-to-path: true
- name: build and test rust
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
make init
make test
make all
working-directory: rust
- name: upload rust artifact
uses: actions/upload-artifact@v3
with:
name: crypto-unix-target
path: |
rust/target/aarch64-apple-ios/release/librcrypto.a
rust/target/aarch64-linux-android/release/librcrypto.so
rust/target/armv7-linux-androideabi/release/librcrypto.so
rust/target/i686-linux-android/release/librcrypto.so
rust/target/universal/release/librcrypto.a
rust/target/x86_64-apple-darwin/release/librcrypto.dylib
rust/target/x86_64-apple-ios/release/librcrypto.a
retention-days: 1
build-rust-on-windows:
runs-on: windows-latest
needs: setup
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: build rust
run: |
rustup target add x86_64-pc-windows-gnu
cargo build --target x86_64-pc-windows-gnu --release
# rustup target add i686-pc-windows-gnu
# rustup install i686-pc-windows-gnu
# rustup default i686-pc-windows-gnu
# rustup show
# cargo build --target i686-pc-windows-gnu --release
working-directory: rust
- name: upload rust artifact
uses: actions/upload-artifact@v3
with:
name: crypto-windows-target
path: |
rust/target/x86_64-pc-windows-gnu/release/rcrypto.dll
rust/target/i686-pc-windows-gnu/release/rcrypto.dll
retention-days: 1
build-rust-on-linux:
runs-on: ubuntu-latest
needs: setup
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: build rust
run: |
rustup target add x86_64-unknown-linux-gnu
cargo build --target x86_64-unknown-linux-gnu --release
# rustup target add i686-unknown-linux-gnu
# rustup install stable-i686-unknown-linux-gnu
# rustup default stable-i686-unknown-linux-gnu
# rustup show
# cargo build --target i686-unknown-linux-gnu --release
working-directory: rust
- name: upload rust artifact
uses: actions/upload-artifact@v3
with:
name: crypto-linux-target
path: |
rust/target/x86_64-unknown-linux-gnu/release/librcrypto.so
rust/target/i686-unknown-linux-gnu/release/librcrypto.so
retention-days: 1
publish-windows-artifacts:
runs-on: ubuntu-latest
needs: build-rust-and-test
timeout-minutes: 15
if: "startsWith(github.ref, 'refs/tags/')"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: download rust target
uses: actions/download-artifact@v3
with:
name: crypto-windows-target
path: rust/target
- name: Release
uses: softprops/action-gh-release@v1
with:
files: rust/target/x86_64-pc-windows-gnu/release/rcrypto.dll
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
bench-rust:
runs-on: ${{ matrix.os }}
needs: build-rust-and-test
timeout-minutes: 60
strategy:
matrix:
os: [macos-latest]
include:
# - os: ubuntu-latest
# flutter_path: /opt/hostedtoolcache/flutter
# - os: macos-10.15
# flutter_path: /Users/runner/hostedtoolcache/flutter
# - os: macos-11.0
# flutter_path: /Users/runner/hostedtoolcache/flutter
- os: macos-latest
flutter_path: /Users/runner/hostedtoolcache/flutter
fail-fast: false
steps:
- uses: actions/checkout@v3
- if: startsWith(github.ref, 'refs/tags/')
name: bench crypto
run: cargo bench --verbose
working-directory: rust
build-flutter-and-test:
runs-on: ${{ matrix.os }}
needs: [build-rust-and-test, build-rust-on-linux, build-rust-on-windows]
timeout-minutes: 30
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
include:
- os: ubuntu-latest
flutter_path: /opt/hostedtoolcache/flutter
# - os: macos-10.15
# flutter_path: /Users/runner/hostedtoolcache/flutter
# - os: macos-11.0
# flutter_path: /Users/runner/hostedtoolcache/flutter
- os: macos-latest
flutter_path: /Users/runner/hostedtoolcache/flutter
- os: windows-latest
flutter_path: C:\Users\runneradmin\hostedtoolcache\flutter
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '11'
- name: Cache Flutter
id: cache-flutter
uses: actions/cache@v3
with:
path: ${{ matrix.flutter_path }}
key: ${{ matrix.os }}-flutter
# Download targets
- name: download unix rust target
uses: actions/download-artifact@v3
with:
name: crypto-unix-target
path: rust/target
- name: download linux rust target
uses: actions/download-artifact@v3
with:
name: crypto-linux-target
path: rust/target
- name: download windows rust target
uses: actions/download-artifact@v3
with:
name: crypto-windows-target
path: rust/target
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: enabled exp platform
run: |
flutter config --enable-windows-desktop
flutter config --enable-macos-desktop
flutter config --enable-linux-desktop
# Pub get
- name: get example dependencies
working-directory: ./example
run: flutter pub get
# Analyze Plugin Dart code
- run: flutter analyze
# Run plugin tests
- run: flutter test -v
# Run example tests
- working-directory: ./example
run: flutter test -v
- if: runner.os == 'Linux'
name: install ninja dependencies
id: install-linux-dependencies
continue-on-error: true
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build
sudo apt-get install build-essential libgtk-3-dev
# Build all example
- if: runner.os == 'Linux'
name: build android artifact
run: flutter build aar --no-profile --no-release -v
- if: runner.os == 'Linux'
name: build android example
working-directory: ./example
run: flutter build appbundle --release -v
- if: runner.os == 'macOS'
name: build ios example
working-directory: ./example
run: flutter build ios --release --no-codesign -v
- if: runner.os == 'macOS'
name: build macos example
working-directory: ./example
run: |
flutter build macos --release -v
- if: runner.os == 'Windows'
name: build windows example
working-directory: ./example
run: |
flutter build windows --release -v
- if: runner.os == 'Linux' && steps.install-linux-dependencies.outcome == 'success' && steps.install-linux-dependencies.conclusion == 'success'
name: build linux example
continue-on-error: true
working-directory: ./example
run: |
flutter build linux --release -v
# driver test
- if: runner.os == 'Linux'
name: linux driver test
continue-on-error: true
working-directory: ./example
run: flutter drive --target=test_driver/app.dart -d linux
# - if: runner.os == 'Windows'
# name: windows driver test
# continue-on-error: true
# working-directory: ./example
# run: |
# copy ..\rust\target\x86_64-pc-windows-gnu\release\rcrypto.dll ..\example\build\windows\runner\x86_64
# flutter drive --target=test_driver/app.dart -d windows
- if: runner.os == 'MacOS'
name: macOS driver test
continue-on-error: true
working-directory: ./example
run: flutter drive --target=test_driver/app.dart -d macOS
publish-flutter:
runs-on: macos-latest
needs: build-flutter-and-test
timeout-minutes: 15
if: "startsWith(github.ref, 'refs/tags/')"
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '11'
- name: Cache Flutter
id: cache-flutter
uses: actions/cache@v3
with:
path: /Users/runner/hostedtoolcache/flutter
key: macos-latest-flutter
# Download targets
- name: download unix rust target
uses: actions/download-artifact@v3
with:
name: crypto-unix-target
path: rust/target
- name: download linux rust target
uses: actions/download-artifact@v3
with:
name: crypto-linux-target
path: rust/target
- name: download windows rust target
uses: actions/download-artifact@v3
with:
name: crypto-windows-target
path: rust/target
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: "Copy credential"
shell: bash
env:
PUB_DEV_PUBLISH_REFRESH_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }}
PUB_DEV_PUBLISH_ACCESS_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }}
PUB_DEV_PUBLISH_TOKEN_ENDPOINT: ${{ secrets.PUB_DEV_PUBLISH_TOKEN_ENDPOINT }}
PUB_DEV_PUBLISH_EXPIRATION: ${{ secrets.PUB_DEV_PUBLISH_EXPIRATION }}
run: |
sh ./credential_config.sh
- name: "Deploy dry-run"
run: flutter pub publish --dry-run
- name: "Deploy"
continue-on-error: true
run: |
echo start copy
cp rust/target/x86_64-apple-darwin/release/librcrypto.dylib macos/librcrypto.dylib
echo end copy
flutter pub publish -f
- name: "Clean"
run: rm -rf ~/.pub-cache