From 9f6ace24c6bc96ffeb14037f1bd7c9736daac3f5 Mon Sep 17 00:00:00 2001 From: Aakash Hemadri Date: Wed, 20 Apr 2022 17:50:50 +0530 Subject: [PATCH 1/2] ci: use self-hosted runner Signed-off-by: Aakash Hemadri --- .github/workflows/ci.yml | 103 ++++++++++++------------ .github/workflows/clean-workflow.yml | 2 +- .github/workflows/linter.yml | 2 +- .github/workflows/pr.yml | 58 ++++++------- .github/workflows/semantic-pr-title.yml | 2 +- 5 files changed, 83 insertions(+), 84 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4032e14..00efc83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ on: jobs: cancel-previous-runs: name: Cancel previous runs - runs-on: ubuntu-latest + runs-on: [self-hosted, linux] steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.9.1 @@ -22,7 +22,7 @@ jobs: test: name: Run flutter tests - runs-on: ubuntu-latest + runs-on: [self-hosted, linux] steps: - name: Clone repo uses: actions/checkout@v2 @@ -52,7 +52,7 @@ jobs: build: name: Build for Android & Web - runs-on: ubuntu-latest + runs-on: [self-hosted, linux] needs: [test] steps: - name: Clone repo @@ -108,53 +108,54 @@ jobs: build/app/outputs/bundle/release/app-release.aab gnucashx-web.tar - build-ios: - name: Build for iOS - runs-on: macos-latest - needs: [test] - steps: - - name: Clone repo - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: '2.10.3' - channel: 'stable' - cache: true - cache-key: flutter - cache-path: ${{ runner.tool_cache }}/flutter - - - name: Disable analytics - run: flutter config --no-analytics - shell: bash - - - name: Retrieve dependencies - run: flutter pub get - shell: bash - - - name: Build iOS target - run: flutter build ios --release --no-codesign - shell: bash - - - name: Tar files - run: | - cd /Users/runner/work/GnuCashX/GnuCashX/ - tar -cvf gnucashx-ios.tar build/ios/iphoneos/Runner.app - shell: bash - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: iOS - path: gnucashx-ios.tar + # build-ios: + # name: Build for iOS + # runs-on: macos-latest + # needs: [test] + # steps: + # - name: Clone repo + # uses: actions/checkout@v2 + # with: + # fetch-depth: 1 + + # - name: Setup Flutter + # uses: subosito/flutter-action@v2 + # with: + # flutter-version: '2.10.3' + # channel: 'stable' + # cache: true + # cache-key: flutter + # cache-path: ${{ runner.tool_cache }}/flutter + + # - name: Disable analytics + # run: flutter config --no-analytics + # shell: bash + + # - name: Retrieve dependencies + # run: flutter pub get + # shell: bash + + # - name: Build iOS target + # run: flutter build ios --release --no-codesign + # shell: bash + + # - name: Tar files + # run: | + # cd /Users/runner/work/GnuCashX/GnuCashX/ + # tar -cvf gnucashx-ios.tar build/ios/iphoneos/Runner.app + # shell: bash + + # - name: Upload artifacts + # uses: actions/upload-artifact@v3 + # with: + # name: iOS + # path: gnucashx-ios.tar release: name: Create Release - runs-on: ubuntu-latest - needs: [build, build-ios] + runs-on: [self-hosted, linux] + # needs: [build, build-ios] + needs: [build] if: startsWith(github.ref, 'refs/tags/') && github.repository == 'aakashhemadri/GnuCashX' steps: - name: Get tag name @@ -183,9 +184,9 @@ jobs: sha=`sha256sum gnucashx-${{ env.VERSION_TAG }}.aab | awk '{ print $1 }'` echo "AAB_SHA=$sha" >> $GITHUB_ENV - mv artifacts/iOS/gnucashx-ios.tar gnucashx-ios-${{ env.VERSION_TAG }}.tar - sha=`sha256sum gnucashx-ios-${{ env.VERSION_TAG }}.tar | awk '{ print $1 }'` - echo "IOS_SHA=$sha" >> $GITHUB_ENV + # mv artifacts/iOS/gnucashx-ios.tar gnucashx-ios-${{ env.VERSION_TAG }}.tar + # sha=`sha256sum gnucashx-ios-${{ env.VERSION_TAG }}.tar | awk '{ print $1 }'` + # echo "IOS_SHA=$sha" >> $GITHUB_ENV mv artifacts/Android_Web/gnucashx-web.tar gnucashx-web-${{ env.VERSION_TAG }}.tar sha=`sha256sum gnucashx-web-${{ env.VERSION_TAG }}.tar | awk '{ print $1 }'` @@ -206,12 +207,10 @@ jobs: | ------- | ------- | | Android APK | ${{ env.APK_SHA }} | | Android Bundle | ${{ env.AAB_SHA }} | - | iOS | ${{ env.IOS_SHA }} | | Web | ${{ env.WEB_TAR_SHA }} | files: | gnucashx-${{ env.VERSION_TAG }}.apk gnucashx-${{ env.VERSION_TAG }}.aab - gnucashx-ios-${{ env.VERSION_TAG }}.tar gnucashx-web-${{ env.VERSION_TAG }}.tar draft: true prerelease: false diff --git a/.github/workflows/clean-workflow.yml b/.github/workflows/clean-workflow.yml index c4cad7b..ca8d13f 100644 --- a/.github/workflows/clean-workflow.yml +++ b/.github/workflows/clean-workflow.yml @@ -10,7 +10,7 @@ on: jobs: clean-logs: - runs-on: ubuntu-latest + runs-on: [self-hosted, linux] steps: - uses: igorjs/gh-actions-clean-workflow@v1 with: diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 3c5b4e0..60a2b42 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -19,7 +19,7 @@ on: jobs: linter: name: Lint Code Base - runs-on: ubuntu-latest + runs-on: [self-hosted, linux] steps: - name: Checkout Code diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 1e9fb26..69a05aa 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -11,7 +11,7 @@ on: jobs: test: name: Run flutter tests - runs-on: ubuntu-latest + runs-on: [self-hosted, linux] steps: - name: Clone repo uses: actions/checkout@v2 @@ -38,7 +38,7 @@ jobs: build: name: Build for Android & Web - runs-on: ubuntu-latest + runs-on: [self-hosted, linux] needs: [test] steps: - name: Clone repo @@ -76,30 +76,30 @@ jobs: - name: Build for target Web run: flutter build web - build-ios: - name: Build for iOS - runs-on: macos-latest - needs: [test] - steps: - - name: Clone repo - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: '2.10.3' - channel: 'stable' - cache: true - cache-key: flutter - cache-path: ${{ runner.tool_cache }}/flutter - - - name: Disable analytics - run: flutter config --no-analytics - - - name: Retrieve dependencies - run: flutter pub get - - - name: Build iOS target - run: flutter build ios --release --no-codesign \ No newline at end of file + # build-ios: + # name: Build for iOS + # runs-on: macos-latest + # needs: [test] + # steps: + # - name: Clone repo + # uses: actions/checkout@v2 + # with: + # fetch-depth: 1 + + # - name: Setup Flutter + # uses: subosito/flutter-action@v2 + # with: + # flutter-version: '2.10.3' + # channel: 'stable' + # cache: true + # cache-key: flutter + # cache-path: ${{ runner.tool_cache }}/flutter + + # - name: Disable analytics + # run: flutter config --no-analytics + + # - name: Retrieve dependencies + # run: flutter pub get + + # - name: Build iOS target + # run: flutter build ios --release --no-codesign \ No newline at end of file diff --git a/.github/workflows/semantic-pr-title.yml b/.github/workflows/semantic-pr-title.yml index 80a66dd..4d7c9d5 100644 --- a/.github/workflows/semantic-pr-title.yml +++ b/.github/workflows/semantic-pr-title.yml @@ -12,7 +12,7 @@ on: jobs: main: name: Validate PR title - runs-on: ubuntu-latest + runs-on: [self-hosted, linux] steps: - uses: amannn/action-semantic-pull-request@v4 env: From ad6d695c102ccf65b3f0e6408b3e95022fdb3aaf Mon Sep 17 00:00:00 2001 From: Aakash Hemadri Date: Wed, 20 Apr 2022 17:51:47 +0530 Subject: [PATCH 2/2] ci: update git hook `commit-msg` Signed-off-by: Aakash Hemadri --- hooks/commit-msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/commit-msg b/hooks/commit-msg index 04d8808..ce729b7 100755 --- a/hooks/commit-msg +++ b/hooks/commit-msg @@ -30,7 +30,7 @@ if echo "$commit_title" | grep -qP "^Merge branch \'"; then fi # check semantic versioning scheme -if ! echo "$commit_title" | grep -qP '^(?:feat|fix|docs|style|refactor|perf|test|chore)\(?(?:\w+|\s|\-|_)?\)?:\s(?:\s|\w+|\W*)+'; then +if ! echo "$commit_title" | grep -qP '^(?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\(?(?:\w+|\s|\-|_)?\)?:\s(?:\s|[a-z0-9_]+|\W*)+'; then echo "commit-msg hook: Your commit title did not follow semantic versioning: $commit_title" echo "commit-msg hook: Please see https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commit-message-format" exit 1