Skip to content

Commit

Permalink
initiial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
arbyazra123 committed Jul 7, 2024
0 parents commit bf37136
Show file tree
Hide file tree
Showing 1,533 changed files with 208,460 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @sherlockvn @hoangdat @dab246 @nqhhdev @hieutbui @tddang-linagora @Te-Z
146 changes: 146 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
on:
workflow_dispatch:
schedule:
- cron: "0 11 * * *"

name: Build

env:
FLUTTER_VERSION: 3.22.2
XCODE_VERSION: ^15.0.1

jobs:
build_debug_mobile:
name: Build debug version for mobiles
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- os: android
runner: ubuntu-latest
- os: ios
runner: macos-latest
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}"

- name: Setup Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
bundler-cache: true
working-directory: ${{ matrix.os }}

- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: Setup Java
if: matrix.os == 'android'
uses: actions/setup-java@v4
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "17"

- name: Select Xcode version
if: matrix.os == 'ios'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}

- name: Setup iOS
if: matrix.os == 'ios'
run: ./scripts/prepare-ios.sh

- name: Build debug APK
if: matrix.os == 'android'
run: |
./scripts/build-android-debug.sh
cp build/app/outputs/apk/debug/app-debug.apk twake-on-matrix-debug.apk
- name: Build debug IPA
if: matrix.os == 'ios'
env:
APPLE_CERTIFICATES_SSH_KEY: ${{ secrets.APPLE_CERTIFICATES_SSH_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: |
bundle exec fastlane dev
cp Runner.ipa ../Runner.ipa
working-directory: ${{ matrix.os }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: twake-on-matrix-dev-${{ matrix.os }}
path: |
twake-on-matrix-debug.apk
Runner.ipa
build_debug_desktop:
name: Build debug version for desktops
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- os: macos
runner: macos-latest
- os: windows
runner: windows-latest
- os: linux
runner: ubuntu-latest
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}"

- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: Setup
run: |
ssh-keyscan github.com >> ~/.ssh/known_hosts
flutter pub global activate flutter_distributor
shell: bash

- name: Setup Fastlane (macOS only)
uses: ruby/setup-ruby@v1
if: matrix.os == 'macos'
with:
ruby-version: ruby
bundler-cache: true
working-directory: ${{ matrix.os }}

- name: Build
env:
APPLE_CERTIFICATES_SSH_KEY: ${{ secrets.APPLE_CERTIFICATES_SSH_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: ./scripts/build-${{ matrix.os }}-debug.sh
shell: bash

- name: Package
run: ./scripts/package-${{ matrix.os }}-debug.sh
shell: bash

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: twake-on-matrix-dev-${{ matrix.os }}
path: dist/
93 changes: 93 additions & 0 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
on:
pull_request:

env:
FLUTTER_VERSION: 3.22.2
LIBOLM_VERSION: 3.2.16

name: Deploying on GitHub Pages

jobs:
deploy_preview:
name: Deploy preview versions on pull requests
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions:
deployments: write
pull-requests: write
contents: write

environment:
name: PR-${{ github.event.pull_request.number }}
url: ${{ steps.configure.outputs.URL }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}"

- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: Setup Nix (to build libolm)
uses: cachix/install-nix-action@v26

- name: Build libolm
run: |
rm -rf assets/js
nix build -v "gitlab:matrix-org/olm/$LIBOLM_VERSION?host=gitlab.matrix.org#javascript" -o assets/js
sudo chmod 777 -R assets/js
cd assets/js/ && mv javascript package
- name: Build Web version
env:
FOLDER: ${{ github.event.pull_request.number }}
TWAKE_PREVIEW_CONFIG: ${{ secrets.TWAKE_PREVIEW_CONFIG }}
run: |
flutter config --enable-web
flutter clean
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
flutter build web --release --verbose --source-maps --base-href="/${GITHUB_REPOSITORY##*/}/$FOLDER/"
echo "$TWAKE_PREVIEW_CONFIG" | yq '.issue_id = strenv(FOLDER)' > ./build/web/config.json
- name: Configure environments
id: configure
env:
FOLDER: ${{ github.event.pull_request.number }}
run: |
echo "URL=https://$GITHUB_REPOSITORY_OWNER.github.io/${GITHUB_REPOSITORY##*/}/$FOLDER" >> $GITHUB_OUTPUT
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build/web
keep_files: true
destination_dir: "${{ github.event.pull_request.number }}"

- name: Find deployment comment
uses: peter-evans/find-comment@v3
id: fc
with:
comment-author: "github-actions[bot]"
issue-number: ${{ github.event.pull_request.number }}
body-includes: "This PR has been deployed to"

- name: Create or update deployment comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
This PR has been deployed to ${{ steps.configure.outputs.URL }}
edit-mode: replace
123 changes: 123 additions & 0 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
on:
push:
branches:
- "main"
tags:
- "v*.*.*"

name: Build Docker images

permissions:
pull-requests: read
contents: read
packages: write

jobs:
build_dev_image:
name: Build development image
if: github.ref_type == 'branch' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: dev

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository_owner }}/twake-web
ghcr.io/${{ github.repository_owner }}/twake-web
tags: |
type=ref,event=branch
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
uses: docker/build-push-action@v5
with:
push: true
platforms: "linux/amd64,linux/arm64"
cache-from: |
type=gha
cache-to: |
type=gha
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
ssh: |
default
build_release_image:
name: Build release image
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment: prod

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository_owner }}/twake-web
ghcr.io/${{ github.repository_owner }}/twake-web
tags: |
type=ref,event=tag
type=raw,value=release
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
uses: docker/build-push-action@v5
with:
push: true
platforms: "linux/amd64,linux/arm64"
cache-from: |
type=gha
cache-to: |
type=gha
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
ssh: |
default
Loading

0 comments on commit bf37136

Please sign in to comment.