Skip to content

Merge pull request #244 from edufolly/dev #298

Merge pull request #244 from edufolly/dev

Merge pull request #244 from edufolly/dev #298

Workflow file for this run

name: Main CI
on:
push:
branches: [ main ]
jobs:
########
# Boot #
########
boot:
name: Boot
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
version: ${{ steps.version-step.outputs.version }}
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Check Pubspec Version
id: version-step
run: |
VERSION=$(grep 'version:' pubspec.yaml | cut -c 10- | cut -f 1 -d '+')
echo "version=$VERSION" >> $GITHUB_OUTPUT
URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/latest
LATEST=$(curl --silent "$URL" | jq -r .name)
if [ "$LATEST" == "v$VERSION" ]; then
echo "Version already used: $VERSION"
exit 1
fi
###################
# Tests & Release #
###################
tests:
name: Tests & Release
needs: [ boot ]
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: stable
cache: false
- name: Install lcov
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update -y
sudo apt install -y lcov
- name: Flutter Config
timeout-minutes: 2
run: flutter config --no-analytics
- name: Flutter Pub Get
timeout-minutes: 5
run: flutter pub get
# - name: Dart Analyze
# timeout-minutes: 5
# run: dart analyze --fatal-infos
- name: Flutter Test
run: |
flutter test --coverage \
-r github \
-j $(grep -c processor /proc/cpuinfo)
# - name: Flutter Publish Dry Run
# run: flutter pub publish --dry-run
- name: Creating Test Coverage HTML
run: |
genhtml coverage/lcov.info \
--output-directory coverage/html \
--title "Folly Fields" \
--show-details
# --header-title "Folly Fields" \
# --dark-mode \
- name: Compress Test Coverage
run: tar -cvzf folly-fields-test-coverage.tar.gz coverage
- name: Upload Test Coverage Artifact
uses: actions/upload-artifact@v4
with:
name: folly-fields-test-coverage
path: folly-fields-test-coverage.tar.gz
retention-days: 1
- name: Publishing Flutter Package
uses: k-paxian/dart-package-publisher@master
with:
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
skipTests: true
format: false
flutter: true
flutterBranch: stable
- name: Creating a GitHub Tag
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ needs.boot.outputs.version }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub Release
uses: ncipollo/release-action@v1
with:
tag: v${{ needs.boot.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
#######################
# Deploy GitHub Pages #
#######################
build-web:
name: Deploy GitHub Pages
needs: [ tests ]
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: stable
cache: false
- name: Flutter Config
run: flutter config --enable-web --no-analytics
- name: Flutter Pub Get
run: flutter pub get
- name: Flutter Build Web
working-directory: example
run: flutter build web --base-href /folly_fields/
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: folly-fields-test-coverage
path: example/build/web
- name: Decompress Test Coverage
working-directory: example/build/web
run: |
tar -xvzf folly-fields-test-coverage.tar.gz
rm -f folly-fields-test-coverage.tar.gz
- name: Publishing to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
publish_dir: ./example/build/web
github_token: ${{ secrets.GITHUB_TOKEN }}
#################
# Build Windows #
#################
build-windows:
name: Windows Native Build
needs: [ boot, tests ]
runs-on: windows-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: stable
cache: false
- name: Flutter Config
run: flutter config --enable-windows-desktop --no-analytics
- name: Flutter Pub Get
run: flutter pub get
- name: Flutter Build Windows Native
working-directory: example
run: flutter build windows
- name: Compress Flutter Build
working-directory: example
run: Compress-Archive build/windows/x64/runner/Release/* folly-fields-example-windows.zip
- name: Adding Zip to GitHub Release
uses: ncipollo/release-action@v1
with:
tag: v${{ needs.boot.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
artifacts: "example/*.zip"
###############
# Build Linux #
###############
build-linux:
name: Linux Native Build
needs: [ tests ]
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Install Dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update -y
sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip xvfb
- name: Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: stable
cache: false
- name: Flutter Config
run: flutter config --enable-linux-desktop --no-analytics
- name: Flutter Pub Get
run: flutter pub get
- name: Flutter Build Linux Native
working-directory: example
run: flutter build linux
- name: Compress Flutter Build
working-directory: example
run: tar -cvzf folly-fields-example-linux.tar.gz build/linux/x64/release/bundle
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: folly-fields-example-linux
path: example/folly-fields-example-linux.tar.gz
retention-days: 1
##########################
# Deploy Linux App Image #
##########################
deploy-linux-app-image:
name: Deploy Linux App Image
needs: [ boot, build-linux ]
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Install Dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update -y
sudo apt install -y libfuse2
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: folly-fields-example-linux
- name: Decompress Flutter Build
run: tar -xvzf folly-fields-example-linux.tar.gz
- name: Build App Image
run: |
mkdir -p AppDir/usr/bin
cp -r build/linux/x64/release/bundle/. AppDir/usr/bin/
ln -sr AppDir/usr/bin/example AppDir/folly-fields-example
wget -q -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod a+x appimagetool
./appimagetool AppDir folly-fields-example.AppImage
- name: Adding AppImage to GitHub Release
uses: ncipollo/release-action@v1
with:
tag: v${{ needs.boot.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
artifacts: "*.AppImage"