diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 48a91f8332..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,136 +0,0 @@ -name: Build App - -on: - push: - branches: [ develop, master, feature/* ] - pull_request: - branches: [ develop, master, feature/* ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -permissions: - id-token: write - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: macos-14 - env: - FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60 - - steps: - - - name: Checkout code - uses: actions/checkout@v4 - - - name: Select Xcode Version - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '15.4.0' - - # Required for KotlinMultiplatform - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version-file: ".java-version" - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Setup Gradle - uses: gradle/gradle-build-action@v3 - - - name: Cache Cocoapods - uses: actions/cache@v4 - with: - path: ~/.cocoapods/repos - key: ${{ runner.os }}-cocoapods-${{ github.sha }} - restore-keys: ${{ runner.os }}-cocoapods- - - - name: Cache Konan - uses: actions/cache@v4 - with: - path: ~/.konan - key: ${{ runner.os }}-konan-${{ github.sha }} - restore-keys: ${{ runner.os }}-konan- - - - name: Pod install - run: bundle exec pod install --repo-update - - # (Levi) Disabling UITests until random crash can be resolved. "godtoolsUITests-Runner (45101) encountered an error (The test runner failed to initialize for UI testing. (Underlying Error: Timed out while loading Accessibility.))" - #- name: Run UITests - # run: bundle exec fastlane cru_shared_lane_run_tests scheme:GodTools-UITests reset_simulator:true should_clear_derived_data:true - - - name: Run Tests and Generate Code Coverage Report (.xcresult) - run: bundle exec fastlane cru_shared_lane_run_tests output_directory:fastlane_scan_output_directory result_bundle:true reset_simulator:true should_clear_derived_data:true - - - name: Upload Xcode Code Coverage Report to CodeCov - uses: codecov/codecov-action@v4 - with: - fail_ci_if_error: true - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - xcode: true - xcode_archive_path: /Users/runner/work/godtools-swift/godtools-swift/fastlane_scan_output_directory/GodTools-Production.xcresult - - - name: Configure AWS credentials - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ secrets.AWS_IAM_ONESKY_ROLE_ARN }} - aws-region: us-east-1 - - - name: Import OneSky Keys - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - uses: dkershner6/aws-ssm-getparameters-action@v2 - with: - parameterPairs: | - /shared/onesky/PUBLIC_KEY = ONESKY_PUBLIC_KEY, - /shared/onesky/SECRET_KEY = ONESKY_SECRET_KEY - - - name: Download And Commit Latest OneSky Localizations - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - run: bundle exec fastlane cru_shared_lane_download_and_commit_latest_one_sky_localizations - - - name: Import App Store Connect API Key - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - env: - APP_STORE_CONNECT_API_JSON_PAYLOAD: ${{ secrets.APP_STORE_CONNECT_API_JSON_PAYLOAD }} - run: echo $APP_STORE_CONNECT_API_JSON_PAYLOAD > fastlane/AppleAppStoreApi.json - - - name: Increment Xcode Project Build Number - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - run: bundle exec fastlane cru_shared_lane_increment_xcode_project_build_number - - - name: Build And Deploy For TestFlight Release - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - env: - MATCH_GIT_BASIC_AUTHORIZATION_PAT: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION_PAT }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - run: bundle exec fastlane cru_shared_lane_build_and_deploy_for_testflight_release is_running_in_ci:true - - - name: Push Commits To Remote - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - run: git push - - - name: Archive XCode Logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: xcode-logs - path: "/Users/runner/Library/Developer/Xcode/DerivedData/Logs/godtools-*/**" - - - name: Archive Fastlane Gym Logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: fastlane-gym-logs - path: "/Users/runner/Library/Logs/gym/godtools-*/**" diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml new file mode 100644 index 0000000000..5671485bc7 --- /dev/null +++ b/.github/workflows/create-version.yml @@ -0,0 +1,177 @@ +name: Create Version + +on: + push: + branches: [ main, releases/* ] + pull_request: + branches: [ main, releases/* ] + + workflow_dispatch: + inputs: + versionIncrementType: + description: 'Version Increment Type' + required: true + default: 'patch' + type: choice + options: + - patch + - minor + - major + - manual + manualVersionNumber: + description: 'Manually Enter Version Number (Requires manual Version Increment Type)' + required: false + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + version_increment_is_bump: + name: Check If Version Increment Is Bump + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' + outputs: + isBump: ${{ steps.check_if_increment_is_bump.outputs.value }} + steps: + - name: Check If Version Increment Is Bump + id: check_if_increment_is_bump + run: | + if [ ${{ inputs.versionIncrementType }} == 'patch' ]; then + echo "value=true" >> "$GITHUB_OUTPUT" + elif [ ${{ inputs.versionIncrementType }} == 'minor' ]; then + echo "value=true" >> "$GITHUB_OUTPUT" + elif [ ${{ inputs.versionIncrementType }} == 'major' ]; then + echo "value=true" >> "$GITHUB_OUTPUT" + else + echo echo "value=false" >> "$GITHUB_OUTPUT" + fi + + current_version: + name: Store Current Version + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set Version Output + id: version + run: | + echo "version=$(grep -m 1 MARKETING_VERSION godtools.xcodeproj/project.pbxproj | sed 's/;//g' | sed 's/ //g' | sed 's/=//g' | sed 's/MARKETING_VERSION//g' | sed 's/^ *//g' | sed 's/^[[:space:]]*//g')" >> $GITHUB_OUTPUT + + print_current_version: + name: Print Current Version + runs-on: ubuntu-latest + needs: [ current_version ] + steps: + - name: Print Current Version + env: + VERSION: ${{ needs.current_version.outputs.version }} + run: | + printf '%s\n' "$VERSION" + + bump_version: + name: Store Bump Version + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + needs: [ current_version, version_increment_is_bump ] + steps: + - name: Bump Version + if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' }} + id: bump-semver + uses: actions-ecosystem/action-bump-semver@v1 + with: + current_version: ${{ needs.current_version.outputs.version }} + level: ${{ inputs.versionIncrementType }} + - name: Store Bump Version + id: version + run: | + echo "version=${{ steps.bump-semver.outputs.new_version }}" >> $GITHUB_OUTPUT + + print_bump_version: + name: Print Bump Version + runs-on: ubuntu-latest + needs: [ bump_version, version_increment_is_bump ] + if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' }} + steps: + - name: Print Bump Version + env: + VERSION: ${{ needs.bump_version.outputs.version }} + run: | + printf '%s\n' "$VERSION" + + manual_version: + name: Store Manual Version + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + if: inputs.versionIncrementType == 'manual' + steps: + - name: Store Manual Version + id: version + run: | + echo "version=${{ inputs.manualVersionNumber }}" >> $GITHUB_OUTPUT + + print_manual_version: + name: Print Manual Version + runs-on: ubuntu-latest + needs: [ manual_version ] + if: inputs.versionIncrementType == 'manual' + steps: + - name: Print Manual Version + env: + VERSION: ${{ needs.manual_version.outputs.version }} + run: | + printf '%s\n' "$VERSION" + + new_version: + name: Store New Version + runs-on: ubuntu-latest + needs: [ version_increment_is_bump, bump_version ] + if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' || inputs.versionIncrementType == 'manual' }} + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Store New Version + id: version + run: | + if [ ${{ needs.version_increment_is_bump.outputs.isBump }} == 'true' ]; then + echo "version=${{ needs.bump_version.outputs.version }}" >> $GITHUB_OUTPUT + elif [ ${{ inputs.versionIncrementType }} == 'manual' ]; then + echo "version=${{ inputs.manualVersionNumber }}" >> $GITHUB_OUTPUT + else + echo "No Version" + fi + + print_new_version: + name: Print New Version + runs-on: ubuntu-latest + needs: [ new_version ] + steps: + - name: Print New Version + env: + VERSION: ${{ needs.new_version.outputs.version }} + run: | + printf '%s\n' "$VERSION" + + create_version_branch_and_pull_request: + name: Create Version Branch and PR + runs-on: ubuntu-latest + needs: [ current_version, new_version ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set Podspec Version to New Version + run: | + sed -i "s/MARKETING_VERSION = ${{ needs.current_version.outputs.version }}/MARKETING_VERSION = ${{ needs.new_version.outputs.version }}/g" godtools.xcodeproj/project.pbxproj + - name: Create Version Branch and PR + uses: peter-evans/create-pull-request@v6 + with: + branch: "versions/${{ needs.new_version.outputs.version }}" + title: "Version ${{needs.new_version.outputs.version}}" + commit-message: "Increase version to ${{needs.new_version.outputs.version}}" \ No newline at end of file diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000000..27db0cd78f --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,46 @@ +name: Run Tests + +on: + push: + branches: [ develop, master, feature/*, releases/* ] + pull_request: + branches: [ develop, master, feature/*, releases/* ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + run_tests: + runs-on: macos-14 + env: + FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Pod Install + uses: ./.github/actions/pod-install + + - name: Run Tests and Generate Code Coverage Report (.xcresult) + run: bundle exec fastlane cru_shared_lane_run_tests output_directory:fastlane_scan_output_directory result_bundle:true reset_simulator:true should_clear_derived_data:true + + - name: Upload Xcode Code Coverage Report to CodeCov + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + xcode: true + xcode_archive_path: /Users/runner/work/godtools-swift/godtools-swift/fastlane_scan_output_directory/GodTools-Production.xcresult + + # - name: Archive XCode Logs + # if: always() + # uses: actions/upload-artifact@v4 + # with: + # name: xcode-logs + # path: "/Users/runner/Library/Developer/Xcode/DerivedData/Logs/godtools-*/**" \ No newline at end of file diff --git a/.github/workflows/testflight.yml b/.github/workflows/testflight.yml new file mode 100644 index 0000000000..588a63e0e7 --- /dev/null +++ b/.github/workflows/testflight.yml @@ -0,0 +1,46 @@ +name: Distribute To Testflight + +on: + push: + branches: [ master, releases/* ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + distribute_to_testflight: + runs-on: macos-14 + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + env: + FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Pod Install + uses: ./.github/actions/pod-install + + - name: Import App Store Connect API Key + env: + APP_STORE_CONNECT_API_JSON_PAYLOAD: ${{ secrets.APP_STORE_CONNECT_API_JSON_PAYLOAD }} + run: echo $APP_STORE_CONNECT_API_JSON_PAYLOAD > fastlane/AppleAppStoreApi.json + + - name: Increment Xcode Project Build Number + run: bundle exec fastlane cru_shared_lane_increment_xcode_project_build_number + + - name: Build And Deploy For TestFlight Release + env: + MATCH_GIT_BASIC_AUTHORIZATION_PAT: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION_PAT }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + run: bundle exec fastlane cru_shared_lane_build_and_deploy_for_testflight_release is_running_in_ci:true + + - name: Archive Fastlane Gym Logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: fastlane-gym-logs + path: "/Users/runner/Library/Logs/gym/godtools-*/**"