From 3f370cc0b8ac7e3e00d8a6a8d74350f489fe1b84 Mon Sep 17 00:00:00 2001 From: N3v1 Date: Fri, 25 Oct 2024 22:32:42 +0200 Subject: [PATCH] (chore): Rework github workflows --- .github/pull_request_template.md | 46 ++++++++----- .github/workflows/CI-ScribbleLab.yml | 67 ------------------- .github/workflows/CI-bumb-build-number.yml | 39 ----------- .../{greetings.yml => autorespond.yml} | 6 +- .github/workflows/build_test.yml | 45 +++++++++++++ .github/workflows/compile_gyb_sources.yml | 46 +++++++++++++ .../{update-spm.yml => dependencies.yml} | 10 +-- .github/workflows/lint.yml | 13 ---- .github/workflows/publish-pages.yml | 48 ------------- .github/workflows/stale.yml | 26 ------- .github/workflows/swiflint.yml | 17 +++++ 11 files changed, 146 insertions(+), 217 deletions(-) delete mode 100644 .github/workflows/CI-ScribbleLab.yml delete mode 100644 .github/workflows/CI-bumb-build-number.yml rename .github/workflows/{greetings.yml => autorespond.yml} (54%) create mode 100644 .github/workflows/build_test.yml create mode 100644 .github/workflows/compile_gyb_sources.yml rename .github/workflows/{update-spm.yml => dependencies.yml} (83%) delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/publish-pages.yml delete mode 100644 .github/workflows/stale.yml create mode 100644 .github/workflows/swiflint.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 927976503..aec3d4f4f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,31 +1,45 @@ -### Description +### Overview - + -### Related issues +### Implementation Details + + + +### Related Issues - - + + + +* Related Issues: + - * #ISSUE_NUMBER -* #ISSUE_NUMBER +### Testing + + ### Checklist - + -- [ ] I read and understood the [contributing guide](https://github.com/ScribbleLabApp/ScribbleLab/blob/main/CONTRIBUTING.md) as well as the [code of conduct](https://github.com/ScribbleLabApp/ScribbleLab/blob/main/CODE_OF_CONDUCT.md) -- [ ] The issues this PR addresses are related to each other -- [ ] My changes generate no new warnings -- [ ] My code builds and runs on my machine -- [ ] My changes are all related to the related issue above -- [ ] I documented my code -- [ ] I fixed all my swiftlint warnings +- [ ] I have read and understood the [contributing guide](https://github.com/ScribbleLabApp/ScribbleLab/blob/main/CONTRIBUTING.md) and the [code of conduct](https://github.com/ScribbleLabApp/ScribbleLab/blob/main/CODE_OF_CONDUCT.md). +- [ ] The issues this PR addresses are related to one another. +- [ ] My changes generate no new warnings. +- [ ] My code builds and runs on my machine without errors. +- [ ] I have documented my code where applicable. +- [ ] I have added tests to cover my changes, if applicable. +- [ ] All existing tests pass. +- [ ] I have fixed all SwiftLint warnings. ### Screenshots - + + +### Additional Notes + + - \ No newline at end of file + diff --git a/.github/workflows/CI-ScribbleLab.yml b/.github/workflows/CI-ScribbleLab.yml deleted file mode 100644 index 9b84ce2fc..000000000 --- a/.github/workflows/CI-ScribbleLab.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: CI-ScribbleLab -on: - pull_request: - branches: - - main - workflow_dispatch: -jobs: - setup-workflow: - name: Setup Environment - runs-on: macos-13 - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - name: Set up Ruby 💎 - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.2.2 - - name: Install Slather 💎 - run: gem install slather - - name: Install Homebrew 🍺 - run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - - name: Install swiftlint 🍺 - run: brew install swiftlint - - name: List Xcode Versions 📋 - run: ls /Applications | grep Xcode - - name: Select Xcode ✨ - run: sudo xcode-select -switch /Applications/Xcode_15.0.1.app/Contents/Developer - - name: Delete DerivedData directory 🗑️ - run: rm -rf ~/Library/Developer/Xcode/DerivedData - - name: List SDKs 🎊 - run: xcodebuild -showsdks - - name: List Simulators 📱 - run: xcrun simctl list --json - - run-tests: - name: Build ScribbleLab and execute tests - runs-on: macos-13 - needs: setup-workflow - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - name: Run tests (UI & Unit tests) ✅ - run: xcodebuild -scheme ScribbleLab -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPad Pro (12.9-inch) (6th generation)' test - - coverage: - name: Generate coverage report - runs-on: macos-13 - needs: run-tests - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - name: Generate Coverage Report 💎 - run: slather coverage --cobertura-xml - - upload-coverage: - name: Upload coverage report to Codecov - runs-on: macos-13 - needs: coverage - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - name: Upload Coverage to Codecov 📊 - uses: codecov/codecov-action@v3 - with: - file: ./cobertura.xml - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/CI-bumb-build-number.yml b/.github/workflows/CI-bumb-build-number.yml deleted file mode 100644 index d082fc9e8..000000000 --- a/.github/workflows/CI-bumb-build-number.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: CI- Update Build Number -on: - workflow_dispatch: -jobs: - update_build_number: - name: Update Build Number - runs-on: macos-13 - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - name: Bump Build Number - run: | - xcrun agvtool next-version -all - APP_BUILD=$(xcrun agvtool vers -terse) - echo "APP_BUILD=$APP_BUILD" >> $GITHUB_ENV - - name: Commit Changes ✨ - env: - APP_BUILD: ${{ env.APP_BUILD }} - run: | - git add . - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git commit -m "bump build number to $APP_BUILD" - - name: Push Changes 🎊 - uses: ad-m/github-push-action@v0.6.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: temp/bump-build-number - force: true - - name: Create Pull Request 🏷️ - uses: peter-evans/create-pull-request@v4 - env: - APP_BUILD: ${{ env.APP_BUILD }} - with: - branch: temp/bump-build-number - delete-branch: true - base: main - title: Bump Build Number to ${{ env.APP_BUILD }} - body: Automatically bump build number of all targets to ${{ env.APP_BUILD }} \ No newline at end of file diff --git a/.github/workflows/greetings.yml b/.github/workflows/autorespond.yml similarity index 54% rename from .github/workflows/greetings.yml rename to .github/workflows/autorespond.yml index 637f99b55..40dde4816 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/autorespond.yml @@ -1,4 +1,4 @@ -name: Greetings +name: Autoresponder on: [pull_request_target, issues] @@ -12,5 +12,5 @@ jobs: - uses: actions/first-interaction@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: "Hi there, Thank you for reporting this issue - @N3v1 will look into it. To make communication even better join our Discord Community [here]() `(not available yet)`." - pr-message: "Hi there, Thank you for creating this PR - @N3v1 will look into it. To make communication even better join our Discord Community [here]() `(not available yet)." + issue-message: "Hi there, Thank you for reporting this issue - Our maintainers and interns will soon respond. To make communication even better join our Discord Community [here](https://discord.gg/Y5mUJbNC8h)." + pr-message: "Hi there, Thank you for creating this PR - Our maintainers and interns will soon respond. To make communication even better join our Discord Community [here](https://discord.gg/Y5mUJbNC8h)." diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml new file mode 100644 index 000000000..734da1859 --- /dev/null +++ b/.github/workflows/build_test.yml @@ -0,0 +1,45 @@ +name: Build & Test ScribbleLab + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: macos-latest + + strategy: + matrix: + os: [macOS, iOS] + configuration: [Alpha, Beta, Debug, Release] + + steps: + - name: Check out the repository + uses: actions/checkout@v4 + + - name: Select Xcode version + run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer + + - name: Install dependencies + run: | + swift package update + + - name: Build project using Matrix build system + run: | + if [ "${{ matrix.os }}" == "iOS" ]; then + xcodebuild -scheme ScribbleLab -configuration ${{ matrix.configuration }} build + else + xcodebuild -scheme ScribbleLab -configuration ${{ matrix.configuration }} build + fi + + - name: Run Tests + run: | + if [ "${{ matrix.os }}" == "iOS" ]; then + xcodebuild test -scheme ScribbleLab -configuration ${{ matrix.configuration }} + else + xcodebuild test -scheme ScribbleLab -configuration ${{ matrix.configuration }} + fi diff --git a/.github/workflows/compile_gyb_sources.yml b/.github/workflows/compile_gyb_sources.yml new file mode 100644 index 000000000..3b041770a --- /dev/null +++ b/.github/workflows/compile_gyb_sources.yml @@ -0,0 +1,46 @@ +name: Compile gyb sources + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + compile_gyb_sources: + runs-on: macOS-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Run generate_sources.sh + run: | + chmod +x ./Utilities/generate_sources.sh + ./Utilities/generate_sources.sh + + - name: Check for changes + id: check_changes + run: | + git diff --quiet || echo "Change detected" + - name: Commit and push changes + if: steps.check_changes.outputs.changed == 'true' + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git add . + git commit -m "(automated/ci): Generate missing swift.gyb Sources" + git push origin HEAD:automated-update-sourcefile-generation + - name: Install GitHub CLI on macOS + run: | + brew install gh + + - name: Create Pull Request + if: steps.check_changes.outputs.changed == 'true' + run: | + gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}" + gh pr create --title "Automated compiling of gyb sources" \ + --body "This pull request includes newly generated sources after running the gyb compilation." \ + --base main \ + --head automated-update-sourcefile-generation \ + --repo ${{ github.repository }} \ No newline at end of file diff --git a/.github/workflows/update-spm.yml b/.github/workflows/dependencies.yml similarity index 83% rename from .github/workflows/update-spm.yml rename to .github/workflows/dependencies.yml index 1f2f2bcc7..3ae348297 100644 --- a/.github/workflows/update-spm.yml +++ b/.github/workflows/dependencies.yml @@ -1,17 +1,17 @@ -name: Update SPM +name: Update Dependencies on: schedule: - - cron: '0 0 */2 * *' # Run every 2 days + - cron: '0 0 */2 * *' workflow_dispatch: jobs: update-dependencies: - runs-on: macos-14 + runs-on: macos-latest steps: - name: Select Xcode - run: sudo xcode-select -switch /Applications/Xcode_15.0.1.app/Contents/Developer + run: sudo xcode-select -switch /Applications/Xcode_16.app/Contents/Developer - name: Delete DerivedData directory run: rm -rf ~/Library/Developer/Xcode/DerivedData @@ -36,7 +36,7 @@ jobs: git config --local user.name "GitHub Actions" git checkout -b auto-update-dependencies git add . - git commit -m "Auto-update dependencies" + git commit -m "(chore/ci): Auto-update dependencies" git push origin auto-update-dependencies - name: Create Pull Request diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index d97467b60..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: SwiftLint - -on: - pull_request: - branches: ["main"] -jobs: - SwiftLint: - runs-on: macOS-13 - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - name: Run SwiftLint ✨ - run: swiftlint --strict diff --git a/.github/workflows/publish-pages.yml b/.github/workflows/publish-pages.yml deleted file mode 100644 index d4e1dcd26..000000000 --- a/.github/workflows/publish-pages.yml +++ /dev/null @@ -1,48 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Deploy DocC -on: - # Runs on pushes targeting the default branch - push: - branches: ["main"] - pull_request: - branches: ["main"] -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write -# Allow one concurrent deployment -concurrency: - group: "pages" - cancel-in-progress: true - -jobs: - # Single deploy job since we're just deploying - deploy: - environment: - # Must be set to this for deploying to GitHub Pages - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: macos-13 - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - name: Build DocC - run: | - xcodebuild docbuild -scheme ScribbleLab \ - -derivedDataPath /tmp/docbuild \ - -destination 'generic/platform=iOS' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO; - $(xcrun --find docc) process-archive \ - transform-for-static-hosting /tmp/docbuild/Build/Products/Debug-iphoneos/ScribbleLab.doccarchive \ - --hosting-base-path ScribbleLab \ - --output-path docs; - echo "" > docs/index.html; - - name: Upload artifact - uses: actions/upload-pages-artifact@v1 - with: - # Upload only docs directory - path: 'docs' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index f9d4555bd..000000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,26 +0,0 @@ -# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. -# -# You can adjust the behavior by modifying this file. -# For more information, see: -# https://github.com/actions/stale -name: Mark Stale issues - -on: - schedule: - - cron: '16 13 * * *' - -jobs: - stale: - runs-on: ubuntu-latest - permissions: - issues: write -# pull-requests: write - - steps: - - uses: actions/stale@v5 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.' -# stale-pr-message: 'Stale pull request message' - stale-issue-label: 'stale' -# stale-pr-label: 'no-pr-activity' diff --git a/.github/workflows/swiflint.yml b/.github/workflows/swiflint.yml new file mode 100644 index 000000000..4f352cf8d --- /dev/null +++ b/.github/workflows/swiflint.yml @@ -0,0 +1,17 @@ +name: Linting ScribbleLab + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] +jobs: + SwiftLint: + runs-on: macOS-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install SwiftLint + run: brew install swiftlint + - name: Run SwiftLint + run: swiftlint --strict \ No newline at end of file