Skip to content
New issue

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

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

Already on GitHub? # to your account

ci: use self-hosted runners #23

Merged
merged 2 commits into from
Apr 20, 2022
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
103 changes: 51 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }'`
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clean-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
jobs:
linter:
name: Lint Code Base
runs-on: ubuntu-latest
runs-on: [self-hosted, linux]

steps:
- name: Checkout Code
Expand Down
58 changes: 29 additions & 29 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
# 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
2 changes: 1 addition & 1 deletion .github/workflows/semantic-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion hooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down