Skip to content

Commit

Permalink
Working Flutter CI for Linux and Windows, version 2024.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ArendJanKramer committed Nov 6, 2024
1 parent 24e4015 commit a7f7b7d
Show file tree
Hide file tree
Showing 9 changed files with 777 additions and 13 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/linux-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Linux build

on: push

jobs:
build-linux-bindings:
name: Build Linux bindings
runs-on: ubuntu-22.04-16-cores
permissions:
contents: write

steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4

# Step 2: Set up Docker Buildx (if you want cross-platform support, otherwise you can skip this)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Step 3: Navigate to the src directory and build the Docker image
- name: Build Docker image
run: |
cd openvino_bindings
docker build -f Dockerfile.ubuntu -t linux-bindings-ubuntu .
docker create --name bindings_container linux-bindings-ubuntu
docker cp bindings_container:/bindings-out/linux_bindings.tgz ./linux_bindings.tgz
docker rm bindings_container
pwd
ls -lh
- name: Upload Release Artifact
uses: actions/upload-artifact@v4
with:
name: "linux_bindings.tgz"
path: openvino_bindings/linux_bindings.tgz
if-no-files-found: error


build-linux-ui:
name: Build Linux UI

runs-on: ubuntu-22.04
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.24.0'
- name: Install dependencies
run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libmpv-dev
- name: Install project dependencies
run: flutter pub get
- name: Generate intermediates
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Enable linux build
run: flutter config --enable-linux-desktop
- name: Build artifacts
run: flutter build linux --release
- name: Archive Release
uses: thedoctor0/zip-release@master
with:
type: 'zip'
filename: "OpenVINO-TestDrive-no-bindings-linux.zip"
path: build/linux/x64/release/bundle
- name: Upload Release Artifact
uses: actions/upload-artifact@v4
with:
name: "OpenVINO-TestDrive-no-bindings-linux.zip"
path: build/linux/x64/release/bundle

package:
name: Package combined Linux release
runs-on: ubuntu-22.04
needs: [ build-linux-bindings, build-linux-ui ] # Waits for both jobs to succeed
steps:
# Step 1: Check out the repository
- name: Checkout repository
uses: actions/checkout@v4

# Step 2: Set filename for release
- name: Set safe filename
id: set_filename
run: |
SAFE_REF_NAME=${GITHUB_REF_NAME//\//_}
echo "SANITIZED_FILENAME=OpenVINO-TestDrive-${SAFE_REF_NAME}-linux.zip" >> $GITHUB_ENV
# Step 3: Download artifact from build-linux-ui
- name: Download bindings build artifact
uses: actions/download-artifact@v4
with:
name: "linux_bindings.tgz" # Matches the artifact name from build-linux-ui
path: ./bindings # Directory to store the downloaded artifact

# Step 4: Download artifact from build-linux-ui
- name: Download flutter build artifact
uses: actions/download-artifact@v4
with:
name: "OpenVINO-TestDrive-no-bindings-linux.zip" # Matches the artifact name from build-linux-ui
path: ./flutter # Directory to store the downloaded artifact

# Step 5: Combine artifacts
- name: Combine artifacts
run: |
ls -la ./
ls -la ./bindings
ls -la ./flutter
tar -xvf ./bindings/linux_bindings.tgz -C ./bindings
rm ./bindings/linux_bindings.tgz
ls -la ./bindings
mkdir -p ./flutter/data/flutter_assets/bindings
mv ./bindings/* ./flutter/data/flutter_assets/bindings
# Step 5: Archive combined folder
- name: Archive Release artifact
uses: thedoctor0/zip-release@master
with:
type: 'zip'
filename: ${{ env.SANITIZED_FILENAME }}
path: ./flutter/

# Step 5: Upload new artifact
- name: Upload Release Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.SANITIZED_FILENAME }}
path: ./flutter/

# Step 6: Update release
- name: Linux Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ env.SANITIZED_FILENAME }}
50 changes: 50 additions & 0 deletions .github/workflows/macos-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: macOS build

on: push

jobs:
build-macos-ui:
name: Build macOS ui
runs-on: macos-latest
permissions:
contents: write

if: false

steps:
- uses: actions/checkout@v4
- name: Set safe filename
id: set_filename
run: |
SAFE_REF_NAME=${GITHUB_REF_NAME//\//_}
echo "SANITIZED_FILENAME=OpenVINO-TestDrive-${SAFE_REF_NAME}-macos.zip" >> $GITHUB_ENV
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.24.0'
- name: Install project dependencies
run: flutter pub get
- name: Generate intermediates
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Enable macOS build
run: flutter config --enable-macos-desktop
- name: Build artifacts
run: flutter build macos --release
- name: Archive Release
uses: thedoctor0/zip-release@master
with:
type: 'zip'
filename: ${{ env.SANITIZED_FILENAME }}
path: build/macos/Build/Products/Release
- name: Upload Release Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.SANITIZED_FILENAME }}
path: build/macos/Build/Products/Release
- name: macOS Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ env.SANITIZED_FILENAME }}
Loading

0 comments on commit a7f7b7d

Please sign in to comment.