Skip to content

Bump up FLUTTER_VER to 3.22 #8315

Bump up FLUTTER_VER to 3.22

Bump up FLUTTER_VER to 3.22 #8315

Workflow file for this run

name: CI
on:
push:
branches: ["main", "new-design-preview"]
tags: ["helm/**", "v*"]
pull_request:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FLUTTER_VER: "3.22"
jobs:
################
# Pull Request #
################
pr:
if: ${{ github.event_name == 'pull_request' }}
needs:
- build
- build-linux
- copyright
#- dartanalyze
#- dartdoc
#- dartfmt
#- docker
#- helm-lint
#- pubspec
#- test-e2e
#- test-unit
runs-on: ubuntu-latest
steps:
- run: true
##########################
# Linting and formatting #
##########################
copyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make copyright check=yes
############
# Building #
############
appcast-edge:
name: appcast (edge)
runs-on: ubuntu-latest
env:
NOTES: ${{ secrets.APPCAST_NOTES }}
ARTIFACTS: ${{ secrets.ARTIFACTS_EDGE }}
steps:
- uses: actions/checkout@v4
with:
# Unshallow the repository in order for `git describe` to work.
fetch-depth: 0
- run: git describe --tags --dirty --match "v*" --always
- run: |
APPCAST=$(make appcast.notes link=$ARTIFACTS notes=$NOTES)
echo "$APPCAST" > appcast.xml
- run: git describe --tags --dirty --match "v*" --always
- uses: actions/upload-artifact@v4
with:
name: appcast-${{ github.run_number }}
path: appcast.xml
if-no-files-found: error
retention-days: 1
build:
strategy:
fail-fast: false
matrix:
platform:
- apk
- appbundle
- ios
- macos
- web
- windows
runs-on: ${{ (contains('ios macos', matrix.platform) && 'macos-latest')
|| (matrix.platform == 'windows' && 'windows-latest')
|| 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
with:
# Unshallow the repository in order for `PubspecBuilder` and its
# `git describe` to work.
fetch-depth: 0
- run: git describe --tags --dirty --match "v*" --always
- uses: subosito/flutter-action@v2.12.0
with:
flutter-version: ${{ env.FLUTTER_VER }}
channel: stable
cache: true
- run: flutter config --enable-${{ matrix.platform }}-desktop
if: ${{ contains('macos windows', matrix.platform) }}
- run: git describe --tags --dirty --match "v*" --always
- run: make flutter.pub
- run: git describe --tags --dirty --match "v*" --always
# - name: Fetch Mac App Development certificates
# env:
# APP_STORE_KEY: ${{ secrets.APP_STORE_KEY }}
# APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APP_STORE_IDENTIFIER }}
# APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER }}
# APP_STORE_CERTIFICATE: ${{ secrets.APP_STORE_CERTIFICATE }}
# run: |
# pip3 install codemagic-cli-tools
#
# export APP_STORE_CONNECT_PRIVATE_KEY=`echo $APP_STORE_KEY | base64 --decode`
# export CERTIFICATE_PRIVATE_KEY=`echo $APP_STORE_CERTIFICATE | base64 --decode`
#
# app-store-connect fetch-signing-files com.team113.messenger \
# --platform MAC_OS \
# --type MAC_APP_DEVELOPMENT \
# --certificate-key=@env:CERTIFICATE_PRIVATE_KEY \
# --create
#
# keychain initialize
# keychain add-certificates
# if: ${{ matrix.platform == 'macos' }}
# - name: Codesign executable
# env:
# MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
# MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
# run: |
# echo $MACOS_CERTIFICATE | base64 —decode > certificate.p12
# security create-keychain -p password build.keychain
# security default-keychain -s build.keychain
# security unlock-keychain -p password build.keychain
# security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password build.keychain
# - name: Fetch Mac App Development certificates
# env:
# APP_STORE_KEY: ${{ secrets.APP_STORE_KEY }}
# APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APP_STORE_IDENTIFIER }}
# APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER }}
# run: |
# export APP_STORE_CONNECT_PRIVATE_KEY=`echo $APP_STORE_KEY | base64 —decode`
# ssh-keygen -t rsa -b 2048 -m PEM -f cert_key -q -N ""
# app-store-connect fetch-signing-files com.team113.messenger \
# --platform MAC_OS \
# --type MAC_APP_STORE \
# --certificate-key=@file:cert_key \
# --create
# app-store-connect create-certificate \
# --type MAC_INSTALLER_DISTRIBUTION \
# --certificate-key=@file:cert_key \
# --save
# security create-keychain -p password build.keychain
# security default-keychain -s build.keychain
# security unlock-keychain -p password build.keychain
# security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password build.keychain
- name: Configure FCM (Firebase Cloud Messaging)
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ runner.temp }}/service_account.json
run: |
set -ex
npm install -g firebase-tools
dart pub global activate flutterfire_cli
echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}' \
> ${{ runner.temp }}/service_account.json
make fcm.conf project-id=${{ secrets.FCM_PROJECT_ID }} \
platforms="android,ios,web" \
web-id=${{ secrets.FCM_WEB_APP_ID }} \
bundle-id=${{ secrets.FCM_BUNDLE_ID }}
if: ${{ contains('apk appbundle ios web', matrix.platform) }}
- name: Configure FCM (Firebase Cloud Messaging) service worker
run: echo '${{ secrets.GOOGLE_SERVICES_JS }}'
> web/firebase-messaging-sw.js
if: ${{ matrix.platform == 'web' }}
# - name: Fetch Mac App Development certificates
# env:
# APP_STORE_CERTIFICATE: ${{ secrets.APP_STORE_CERTIFICATE }}
# APP_STORE_CERTIFICATE_ID: ${{ secrets.APP_STORE_CERTIFICATE_ID }}
# APP_STORE_CERTIFICATE2: ${{ secrets.APP_STORE_CERTIFICATE2 }}
# APP_STORE_CERTIFICATE2_ID: ${{ secrets.APP_STORE_CERTIFICATE2_ID }}
# APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER }}
# APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APP_STORE_IDENTIFIER }}
# APP_STORE_KEY: ${{ secrets.APP_STORE_KEY }}
# APP_STORE_PROFILE: ${{ secrets.APP_STORE_PROFILE }}
# APP_STORE_PROFILE_ID: ${{ secrets.APP_STORE_PROFILE_ID }}
# run: |
# pip3 install codemagic-cli-tools
# export APP_STORE_CONNECT_PRIVATE_KEY=`echo $APP_STORE_KEY | base64 --decode`
# export PROFILE_PRIVATE_KEY=`echo $APP_STORE_PROFILE | base64 --decode`
# export CERTIFICATE_PRIVATE_KEY=`echo $APP_STORE_CERTIFICATE | base64 --decode`
# export CERTIFICATE2_PRIVATE_KEY=`echo $APP_STORE_CERTIFICATE2 | base64 --decode`
# app-store-connect get-profile $APP_STORE_PROFILE_ID --save
# app-store-connect get-certificate $APP_STORE_CERTIFICATE_ID \
# --certificate-key=@env:CERTIFICATE_PRIVATE_KEY \
# --save
# app-store-connect get-certificate $APP_STORE_CERTIFICATE2_ID \
# --certificate-key=@env:CERTIFICATE2_PRIVATE_KEY \
# --save
# app-store-connect fetch-signing-files com.team113.messenger \
# --platform MAC_OS \
# --type MAC_APP_DEVELOPMENT \
# --certificate-key=@env:PROFILE_PRIVATE_KEY \
# --create
# keychain initialize
# keychain add-certificates
# xcode-project use-profiles
# if: ${{ matrix.platform == 'macos' }}
- name: Parse semver versions from Git tag
id: semver
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.ref }}
regex: '^refs/tags/v(((([0-9]+)\.[0-9]+)\.[0-9]+)(-.+)?)$'
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
# SOCAPP_SENTRY_DSN=${{ secrets.SENTRY_DSN2 }}
- run: make flutter.build platform=${{ matrix.platform }} profile=yes
dart-env='SOCAPP_FCM_VAPID_KEY=${{ secrets.FCM_VAPID_KEY }}
SOCAPP_LINK_PREFIX=${{ secrets.LINK_PREFIX2 }}
SOCAPP_GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}'
if: ${{ matrix.platform == 'web' }}
# split-debug-info=${{ contains('web windows', matrix.platform) && 'no' || 'yes' }}
# TODO: Use `split-debug-info` for Windows once Sentry supports it:
# https://github.com/getsentry/sentry-dart/issues/433
# https://github.com/getsentry/sentry-dart/issues/896
# SOCAPP_SENTRY_DSN=${{ secrets.SENTRY_DSN2 }}
- run: make flutter.build platform=${{ matrix.platform }}
dart-env='SOCAPP_HTTP_URL=${{ secrets.BACKEND_URL }}
SOCAPP_HTTP_PORT=${{ secrets.BACKEND_PORT }}
SOCAPP_WS_URL=${{ secrets.BACKEND_WS }}
SOCAPP_WS_PORT=${{ secrets.BACKEND_PORT }}
SOCAPP_LINK_PREFIX=${{ secrets.LINK_PREFIX2 }}
SOCAPP_APPCAST_URL=${{ secrets.APPCAST_EDGE }}
SOCAPP_GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}
SOCAPP_USER_AGENT_VERSION=${{ steps.semver.outputs.group1 }}'
if: ${{ matrix.platform != 'web' }}
- name: Parse application name from Git repository name
id: app
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.repository }}
regex: '^${{ github.repository_owner }}/(.+)$'
- run: mkdir artifacts/
- run: mv build/app/outputs/flutter-apk/app-release.apk
artifacts/${{ steps.app.outputs.group1 }}-android.apk
if: ${{ matrix.platform == 'apk' }}
- run: mv build/app/outputs/bundle/release/app-release.aab
artifacts/${{ steps.app.outputs.group1 }}-android.aab
if: ${{ matrix.platform == 'appbundle' }}
- run: mkdir -p dist/ && mv *.app dist/ # `.app` executable is a folder itself
working-directory: build/ios/iphoneos/
if: ${{ matrix.platform == 'ios' }}
- run: mkdir -p dist/ && mv *.app dist/ # `.app` executable is a folder itself
working-directory: build/macos/Build/Products/Release/
if: ${{ matrix.platform == 'macos' }}
- uses: thedoctor0/zip-release@0.7.6
with:
custom: ${{ (runner.os == 'Windows' && ' ') || '--symlinks' }} # preserve symlinks, instead of copying files
filename: ${{ github.workspace }}/artifacts/${{ steps.app.outputs.group1 }}-${{ matrix.platform }}.zip
directory: ${{ (matrix.platform == 'ios'
&& 'build/ios/iphoneos/dist')
|| (matrix.platform == 'macos'
&& 'build/macos/Build/Products/Release/dist')
|| (matrix.platform == 'windows'
&& 'build/windows/x64/runner/Release')
|| 'build/web'}}
if: ${{ contains('ios macos web windows', matrix.platform) }}
- name: Generate SHA256 checksums
run: ${{ (runner.os == 'Windows'
&& 'forfiles /M *.zip /C "cmd /c sha256sum @file > @file.sha256sum"')
|| (runner.os == 'macOS'
&& 'ls -1 | xargs -I {} sh -c "shasum -a 256 {} > {}.sha256sum"')
|| 'ls -1 | xargs -I {} sh -c "sha256sum {} > {}.sha256sum"' }}
working-directory: artifacts/
- name: Show generated SHA256 checksums
run: ${{ (runner.os == 'Windows'
&& 'type *.sha256sum')
|| 'cat *.sha256sum' }}
working-directory: artifacts/
- uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.platform }}-${{ github.run_number }}
path: artifacts/
if-no-files-found: error
retention-days: 1
# Globstar is supported in Bash 4.0+, `macos-latest` runner uses Bash 3.2.
# - name: Prepare `*.dSYM` debug symbols
# run: find build -name "*.dSYM" -prune -exec mv {} debug/ \;
# if: ${{ contains('ios macos', matrix.platform) }}
# - name: Prepare debug web source maps
# run: |
# shopt -s globstar
# mkdir -p debug/
# mv build/web/**/*.map debug/
# cd build/web && cp --parents **/*.js ../../debug/
# if: ${{ matrix.platform == 'web' }}
# - uses: thedoctor0/zip-release@0.7.6
# with:
# filename: ${{ github.workspace }}/debug-${{ matrix.platform }}.zip
# directory: debug
# if: ${{ contains('apk appbundle ios macos web', matrix.platform) }}
# - uses: actions/upload-artifact@v4
# with:
# name: debug-${{ matrix.platform }}-${{ github.run_number }}
# path: debug-${{ matrix.platform }}.zip
# if-no-files-found: error
# retention-days: 1
# if: ${{ contains('apk appbundle ios macos web', matrix.platform) }}
build-linux:
name: build (linux)
runs-on: ubuntu-latest
# Pin glibc to 2.31 version for better compatibility.
container: debian:bullseye
steps:
- uses: actions/checkout@v4
with:
# Unshallow the repository in order for `PubspecBuilder` and its
# `git describe` to work.
fetch-depth: 0
- run: apt-get update -y
- run: apt-get install -y
ninja-build
libunwind-dev
libgtk-3-dev
libpulse-dev
libmpv-dev
mpv
jq
curl
git
make
procps
cmake
clang
zip
- run: git config --global --add safe.directory '*'
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VER }}
channel: stable
cache: true
- run: flutter config --enable-linux-desktop
- name: Parse semver versions from Git tag
id: semver
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.ref }}
regex: '^refs/tags/v(((([0-9]+)\.[0-9]+)\.[0-9]+)(-.+)?)$'
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
- run: make flutter.pub
# TODO: Use `split-debug-info` when Sentry supports Linux debug symbols.
# https://github.com/getsentry/sentry-dart/issues/433
# SOCAPP_SENTRY_DSN=${{ secrets.SENTRY_DSN2 }}
- run: make flutter.build platform=linux
dart-env='SOCAPP_HTTP_URL=${{ secrets.BACKEND_URL }}
SOCAPP_HTTP_PORT=${{ secrets.BACKEND_PORT }}
SOCAPP_WS_URL=${{ secrets.BACKEND_WS }}
SOCAPP_WS_PORT=${{ secrets.BACKEND_PORT }}
SOCAPP_APPCAST_URL=${{ secrets.APPCAST_EDGE }}
SOCAPP_LINK_PREFIX=${{ secrets.LINK_PREFIX2 }}
SOCAPP_USER_AGENT_VERSION=${{ steps.semver.outputs.group1 }}'
- name: Parse application name from Git repository name
id: app
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.repository }}
regex: '^${{ github.repository_owner }}/(.+)$'
- run: mkdir artifacts/
- uses: thedoctor0/zip-release@0.7.6
with:
filename: ${{ github.workspace }}/artifacts/${{ steps.app.outputs.group1 }}-linux.zip
directory: build/linux/x64/release/bundle
- name: Generate SHA256 checksums
run: ${{ 'ls -1 | xargs -I {} sh -c "sha256sum {} > {}.sha256sum"' }}
working-directory: artifacts/
- name: Show generated SHA256 checksums
run: ${{ 'cat *.sha256sum' }}
working-directory: artifacts/
- uses: actions/upload-artifact@v4
with:
name: build-linux-${{ github.run_number }}
path: artifacts/
if-no-files-found: error
retention-days: 1
docker:
needs: ["build", "build-linux", "appcast-edge"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: actions/download-artifact@v4
with:
name: build-web-${{ github.run_number }}
- run: mkdir -p build/web/
- run: unzip *.zip -d build/web/
- run: mkdir -p build/web/artifacts/
- uses: actions/download-artifact@v4
with:
name: build-apk-${{ github.run_number }}
path: build/web/artifacts/
- uses: actions/download-artifact@v4
with:
name: build-appbundle-${{ github.run_number }}
path: build/web/artifacts/
- uses: actions/download-artifact@v4
with:
name: build-ios-${{ github.run_number }}
path: build/web/artifacts/
- uses: actions/download-artifact@v4
with:
name: build-linux-${{ github.run_number }}
path: build/web/artifacts/
- uses: actions/download-artifact@v4
with:
name: build-macos-${{ github.run_number }}
path: build/web/artifacts/
- uses: actions/download-artifact@v4
with:
name: build-windows-${{ github.run_number }}
path: build/web/artifacts/
- uses: actions/download-artifact@v4
with:
name: appcast-${{ github.run_number }}
path: build/web/
- run: cp -r web/.well-known/ build/web/.well-known/
- run: make docker.image no-cache=yes
tag=build-${{ github.run_number }}
- run: make docker.tar to-file=.cache/image.tar
tags=build-${{ github.run_number }}
- uses: actions/upload-artifact@v4
with:
name: docker-${{ github.run_number }}
path: .cache/image.tar
if-no-files-found: error
retention-days: 1
###########
# Testing #
###########
#############
# Releasing #
#############
docker-push:
name: docker push
if: ${{ github.ref == 'refs/heads/new-design-preview' }}
needs:
- docker
strategy:
fail-fast: false
matrix:
registry: ["ghcr.io"]
runs-on: ubuntu-latest
steps:
# Skip if this is fork and no credentials are provided.
- id: skip
run: echo ::set-output name=no::${{ !(
github.repository_owner != 'team113'
&& ((matrix.registry == 'quay.io'
&& secrets.QUAYIO_ROBOT_USER == '')
|| (matrix.registry == 'docker.io'
&& secrets.DOCKERHUB_BOT_USER == ''))
) }}
- uses: actions/checkout@v4
if: ${{ steps.skip.outputs.no == 'true' }}
- uses: actions/download-artifact@v4
with:
name: docker-${{ github.run_number }}
path: .cache/
if: ${{ steps.skip.outputs.no == 'true' }}
- run: make docker.untar from-file=.cache/image.tar
if: ${{ steps.skip.outputs.no == 'true' }}
- name: Login to ${{ matrix.registry }} container registry
uses: docker/login-action@v3
with:
registry: ${{ matrix.registry }}
username: ${{ (matrix.registry == 'docker.io'
&& secrets.DOCKERHUB_BOT_USER)
|| (matrix.registry == 'quay.io'
&& secrets.QUAYIO_ROBOT_USER)
|| github.repository_owner }}
password: ${{ (matrix.registry == 'docker.io'
&& secrets.DOCKERHUB_BOT_PASS)
|| (matrix.registry == 'quay.io'
&& secrets.QUAYIO_ROBOT_TOKEN)
|| secrets.GITHUB_TOKEN }}
if: ${{ steps.skip.outputs.no == 'true' }}
- run: make docker.tags of=build-${{ github.run_number }}
registries=${{ matrix.registry }}
tags=${{ 'new-design-preview' }}
as=review
if: ${{ steps.skip.outputs.no == 'true' }}
- run: make docker.push
registries=${{ matrix.registry }}
tags=${{ 'new-design-preview' }}
image=review
if: ${{ steps.skip.outputs.no == 'true' }}
#############
# Deploying #
#############
# deploy-sentry:
# name: deploy (symbols, Sentry)
# # if: ${{ startsWith(github.ref, 'refs/tags/v') }}
# needs:
# - build
# - build-linux
# - docker
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/download-artifact@v4
# with:
# name: debug-apk-${{ github.run_number }}
# path: debug/
# - uses: actions/download-artifact@v4
# with:
# name: debug-appbundle-${{ github.run_number }}
# path: debug/
# - uses: actions/download-artifact@v4
# with:
# name: debug-ios-${{ github.run_number }}
# path: debug/
# - uses: actions/download-artifact@v4
# with:
# name: debug-macos-${{ github.run_number }}
# path: debug/
# - name: Unzip debug symbols
# run: |
# set -e
# for f in debug/debug-*.zip
# do unzip "$f" -d "${f%.zip}/"
# done
# - uses: actions/download-artifact@v4
# with:
# name: debug-web-${{ github.run_number }}
# # `sentry_dart_plugin` expects source maps to be in `build/web/` dir.
# - run: mkdir -p build/web/
# - name: Unzip web source maps
# run: unzip debug-*.zip -d build/web/
# - run: tree debug
# - uses: subosito/flutter-action@v2
# with:
# flutter-version: ${{ env.FLUTTER_VER }}
# channel: stable
# cache: true
# - run: make flutter.gen only=lib/pubspec.g.dart
# - run: make sentry.upload
# project=${{ secrets.SENTRY_PROJECT }}
# org=${{ secrets.SENTRY_ORG }}
# token=${{ secrets.SENTRY_TOKEN }}
# release=${{ steps.semver.outputs.group1 }}