Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set a new git flow #110

Merged
merged 3 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
liberapay: Seeneva
custom: https://seeneva.app/#donate
github: Seeneva
liberapay: Seeneva
51 changes: 51 additions & 0 deletions .github/actions/prepare_env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Prepare environment
description: Prepare required environment be the Seeneva project

runs:
using: composite
steps:
- name: Install packages
shell: bash
run: sudo apt install autopoint

- name: Setup asdf
uses: asdf-vm/actions/[email protected]

- name: Install asdf plugins
uses: asdf-vm/actions/[email protected]

- name: Setup required Java
shell: bash
run: |
asdf install java &&
echo "JAVA_HOME=$(asdf where java)" >> "$GITHUB_ENV"

- name: Setup required Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Cache Rust Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry
~/.cargo/git
./native/target
key: ${{ runner.os }}-cargo-${{ hashFiles('./native/**/Cargo.lock', '**/rust-toolchain') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Cache Gradle wrapper
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
85 changes: 11 additions & 74 deletions .github/workflows/pr_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on:
pull_request:
branches:
- master
- "hotfix/[0-9]+.[0-9]+.[0-9]+"
- develop

env:
FORK: "${{ github.event.pull_request.head.repo.full_name != github.repository }}"
APP_BUILD_TYPE: Release
RELEASE_CANDIDATE: "${{ github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.head_ref, 'release/') }}"
RELEASE_CANDIDATE: "${{ github.event.pull_request.head.repo.full_name == github.repository && github.base_ref == 'master' && startsWith(github.head_ref, 'release/') }}"
BUNDLE_WITHOUT: development
FASTLANE_SKIP_UPDATE_CHECK: true

Expand Down Expand Up @@ -144,42 +144,13 @@ jobs:
if: ${{ needs.bump_version.outputs.bumped == 'false' }}
needs: bump_version
steps:
- name: Install packages
run: sudo apt install autopoint

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup asdf
uses: asdf-vm/actions/[email protected]

- name: Install asdf plugins
uses: asdf-vm/actions/[email protected]

- name: Setup required Java
run: |
asdf install java &&
echo "JAVA_HOME=$(asdf where java)" >> "$GITHUB_ENV"

- name: Setup required Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Cache Gradle wrapper
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Prepare env
uses: ./.github/actions/prepare_env

- name: Run Android tests
run: |
Expand All @@ -202,29 +173,13 @@ jobs:
if: ${{ needs.bump_version.outputs.bumped == 'false' }}
needs: bump_version
steps:
- name: Install packages
run: sudo apt install autopoint

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup asdf
uses: asdf-vm/actions/[email protected]

- name: Install asdf plugins
uses: asdf-vm/actions/[email protected]

- name: Setup required Java
run: |
asdf install java &&
echo "JAVA_HOME=$(asdf where java)" >> "$GITHUB_ENV"

- name: Setup required Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Prepare env
uses: ./.github/actions/prepare_env

# Check that fastlane has changelog for the new version
- name: Check Fastlane changelog
Expand All @@ -239,32 +194,14 @@ jobs:
done

if [[ ! -z "$locales" ]]; then
msg=":exclamation: There is no Fastlane changelog for locales:\n\n${locales}\nIs it OK?"
bundle exec fastlane run issue_comment token:"${{ secrets.GITHUB_TOKEN }}" number:${{ github.event.number }} msg:"$(printf "${msg}")"
fi
msg=":exclamation: There is no Fastlane changelog for locales:\n\n${locales}"

- name: Cache Rust Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry
~/.cargo/git
./native/target
key: ${{ runner.os }}-cargo-${{ hashFiles('./native/**/Cargo.lock', '**/rust-toolchain') }}
echo "::error::${msg}"

- name: Cache Gradle wrapper
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
bundle exec fastlane run issue_comment token:"${{ secrets.GITHUB_TOKEN }}" number:${{ github.event.number }} msg:"$(printf "${msg}")"

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
exit 1
fi

- name: Run assemble task
if: ${{ env.FORK == 'false' }}
Expand Down
37 changes: 4 additions & 33 deletions .github/workflows/tag_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ jobs:
name: Check release before build
runs-on: ubuntu-latest
if: |
github.event.release.target_commitish == 'master' ||
startsWith(github.event.release.target_commitish, 'hotfix/')
github.event.release.target_commitish == 'master'
outputs:
valid: ${{ steps.check_tag.outputs.VALID }}
build_type: ${{ steps.check_tag.outputs.BUILD_TYPE }}
Expand Down Expand Up @@ -48,42 +47,13 @@ jobs:
strategy:
matrix: ${{ fromJson(needs.check_release.outputs.gh_envs) }}
steps:
- name: Install packages
run: sudo apt install autopoint

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup asdf
uses: asdf-vm/actions/[email protected]

- name: Install asdf plugins
uses: asdf-vm/actions/[email protected]

- name: Setup required Java
run: |
asdf install java &&
echo "JAVA_HOME=$(asdf where java)" >> "$GITHUB_ENV"

- name: Setup required Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Cache Gradle wrapper
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Prepare env
uses: ./.github/actions/prepare_env

# Calculate app's version name and code
# We don't need to do it on 'master' branch because all PR's alredy bumped version name and code
Expand All @@ -95,6 +65,7 @@ jobs:
# echo "SEENEVA_VERSION_CODE=${o[-1]}" >> $GITHUB_ENV

# Assemble the app. Output APK will be signed using environment's KEYSTORE

- name: Run assemble task
if: matrix.env != 'upload'
run: |
Expand Down
15 changes: 11 additions & 4 deletions docs/DEVELOPING-ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,14 @@ bundle exec fastlane gplay_publish_internal --env gplay

### Ветки

- **master**: защищённая ветка. Все git merge должны быть сделаны через GitHub Pull Request. Создание GitHub Release с тегом *vX.Y.Z* запустит CI. СI соберёт необходимые APK и прикрепит их к созданному GH Release, затем соберёт AAB и отправит в Google Play, используя Fastlane.
- **feature_branch**: может иметь любое имя. Всегда создаётся из **master** и вливается обратно.
- **hotfix/x.y.z**: экстренное исправление ошибки. x.y.z описывает новое имя версии приложения, например 0.1.0. Эта ветка всегда создаётся из **master** ветки. Вначале нужно исправить баг на **master** ветке (если там баг всё ещё актуален), а затем исправить его в этой ветке, используя cherry-pick. Создание GitHub Release с тегом *vX.Y.Z* запустит CI для сборки и отпарвки исправленной версии приложения.
- **release/x.y.z**: новая версия приложения готова. x.y.z описывает новое имя версии приложения, например 0.1.0. Эта ветка всегда создаётся из **master** или **hotfix** и вливается обратно. Имя и код версии будут высчитаны и закомичены в процессе Pull Request с помощью CI.
- **master**: защищённая ветка. Все git merge должны быть сделаны через GitHub Pull Request.
Создание GitHub Release с тегом *vX.Y.Z* запустит CI. СI соберёт необходимые APK и прикрепит их к
созданному GH Release, затем соберёт AAB и отправит в Google Play, используя Fastlane.
- **develop**: защищённая ветка. Все git merge должны быть сделаны через GitHub Pull Request. Эта
ветка является источником для всех feature веток.
- **feature_branch**: может иметь любое имя. Всегда создаётся из **develop** и вливается обратно.
- **hotfix/any_name**: экстренное исправление ошибки. Эта ветка всегда создаётся из **master**
ветки, затем вливается в **master** и **develop**
- **release/x.y.z**: новая версия приложения готова. x.y.z описывает новое имя версии приложения,
например 0.1.0. Эта ветка всегда создаётся из **master** и вливается в **master** и **develop**.
Имя и код версии будут высчитаны и закомичены в процессе Pull Request с помощью CI.
17 changes: 13 additions & 4 deletions docs/DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,16 @@ Based on well known [Github flow](https://guides.github.com/introduction/flow).

### Branches

- **master**: protected branch. All merges should be done through GitHub Pull Request. GitHub Release with tag name *vX.Y.Z* will start CI job. This job will build and attach APKs to the GH Release and upload AAB to the Google Play using Fastlane.
- **feature_branch**: can have any name. It is usually created from **master** branch and merged back.
- **hotfix/x.y.z**: the urgent bug fix. This branch always created from **master**. Bug should be fixed on **master** branch (if related) and cherry-picked to this branch. GitHub Release with tag name *vX.Y.Z* will start CI job to build and upload fixed app version.
- **release/x.y.z**: new app release is ready. x.y.z should describe new app version name e.g. 0.1.0. This branch created from **master** or **hotfix** branch and merged back. The app version name and code will be calculated and committed by CI during Pull Request.
- **master**: protected branch. All merges should be done through GitHub Pull Request. GitHub
Release with tag name *vX.Y.Z* will start CI job. This job will build and attach APKs to the GH
Release and upload AAB to the Google Play using Fastlane.
- **develop**: protected branch. All merges should be done through GitHub Pull Request. The source
branch for all feature branches.
- **feature_branch**: can have any name. It should be created from **develop** branch and merged
back.
- **hotfix/any_name**: the urgent bug fix. This branch always created from the **master** branch and
merged to the **master** and **develop** branches.
- **release/x.y.z**: new app release is ready. x.y.z should describe new app version name e.g.
0.1.0. This branch created from **master** branch and merged to the **master** and **develop**
branches. The app version name and code will be calculated and committed by CI during Pull
Request.