From cabcacbc9e9d73375e56f4065df78e64d55248bc Mon Sep 17 00:00:00 2001 From: Andre Nogueira Date: Thu, 4 Dec 2025 14:25:28 +0000 Subject: [PATCH] feat: add CI --- .github/ISSUE_TEMPLATE/bug_report.yml | 94 +++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 8 ++ .github/ISSUE_TEMPLATE/feature_request.yml | 72 ++++++++++++ .github/dependabot.yml | 14 +++ .github/pull_request_template.md | 54 +++++++++ .github/workflows/ci.yml | 126 +++++++++++++++++++++ .github/workflows/release.yml | 78 +++++++++++++ 7 files changed, 446 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..006d541 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,94 @@ +name: Bug Report +description: File a bug report to help us improve +title: "[Bug]: " +labels: ["bug", "needs-triage"] +assignees: [] + +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + + - type: textarea + id: description + attributes: + label: Bug Description + description: A clear and concise description of what the bug is. + placeholder: Tell us what happened + validations: + required: true + + - type: textarea + id: steps + attributes: + label: Steps to Reproduce + description: Steps to reproduce the behavior + placeholder: | + 1. Go to '...' + 2. Click on '....' + 3. Enter cron expression '...' + 4. See error + validations: + required: true + + - type: textarea + id: expected + attributes: + label: Expected Behavior + description: What did you expect to happen? + placeholder: I expected... + validations: + required: true + + - type: textarea + id: actual + attributes: + label: Actual Behavior + description: What actually happened? + placeholder: Instead... + validations: + required: true + + - type: input + id: version + attributes: + label: Version + description: What version of git-context are you running? + placeholder: v1.0.0 or commit hash + validations: + required: true + + - type: dropdown + id: os + attributes: + label: Operating System + description: What OS are you using? + options: + - macOS + - Linux + - Windows + - Other + validations: + required: true + + - type: input + id: terminal + attributes: + label: Terminal + description: What terminal emulator are you using? + placeholder: e.g., iTerm2, Terminal.app, Alacritty, etc. + + - type: textarea + id: logs + attributes: + label: Logs + description: Please copy and paste any relevant log output or error messages + render: shell + + - type: textarea + id: context + attributes: + label: Additional Context + description: Add any other context about the problem here + placeholder: Screenshots, GIFs, or additional information diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..cbbe473 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: 💬 Discussions + url: https://github.com/techquestsdev/macos-free/discussions + about: Ask questions and discuss ideas with the community + - name: 📖 Documentation + url: https://github.com/techquestsdev/macos-free#readme + about: Read the documentation for help and examples diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..2003a35 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,72 @@ +name: Feature Request +description: Suggest an idea for this project +title: "[Feature]: " +labels: ["enhancement", "needs-triage"] +assignees: [] + +body: + - type: markdown + attributes: + value: | + Thanks for suggesting a new feature! + + - type: textarea + id: problem + attributes: + label: Problem Statement + description: Is your feature request related to a problem? Please describe. + placeholder: I'm frustrated when... + validations: + required: true + + - type: textarea + id: solution + attributes: + label: Proposed Solution + description: Describe the solution you'd like + placeholder: I would like to see... + validations: + required: true + + - type: textarea + id: alternatives + attributes: + label: Alternatives Considered + description: Describe alternatives you've considered + placeholder: I also thought about... + + - type: textarea + id: examples + attributes: + label: Examples + description: Provide examples of how this feature would be used + placeholder: | + Example 1: ... + Example 2: ... + + - type: dropdown + id: priority + attributes: + label: Priority + description: How important is this feature to you? + options: + - Nice to have + - Important + - Critical + validations: + required: true + + - type: checkboxes + id: contribution + attributes: + label: Contribution + description: Would you be willing to contribute this feature? + options: + - label: I am willing to submit a PR for this feature + required: false + + - type: textarea + id: context + attributes: + label: Additional Context + description: Add any other context, screenshots, or mockups about the feature request here diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..1ef5c3f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 +updates: + # Enable version updates for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 5 + labels: + - "dependencies" + - "github-actions" + commit-message: + prefix: "chore" + include: "scope" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..e3d4cd0 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,54 @@ +# Pull Request + +## Description + + +## Type of Change + + +- [ ] 🐛 Bug fix (non-breaking change which fixes an issue) +- [ ] ✨ New feature (non-breaking change which adds functionality) +- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] 📝 Documentation update +- [ ] 🎨 Code style update (formatting, renaming) +- [ ] ♻️ Code refactoring (no functional changes) +- [ ] ⚡ Performance improvement +- [ ] ✅ Test update +- [ ] 🔒 Security fix + +## Related Issues + +Fixes #(issue number) +Related to #(issue number) + +## Changes Made + + +- +- +- + +## Testing + + +- [ ] Existing tests pass (`make test`) +- [ ] New tests added (if applicable) +- [ ] Manual testing performed + +## Screenshots/Recordings + + +## Checklist + + +- [ ] My code follows the project's style guidelines +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes +- [ ] Any dependent changes have been merged and published + +## Additional Notes + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0c99829 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,126 @@ +name: CI + +on: + push: + branches: [main] + tags: ["v*"] + pull_request: + branches: [main] + +jobs: + build: + name: Build & Test + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Xcode Command Line Tools + run: | + if ! xcode-select -p &>/dev/null; then + xcode-select --install + fi + + - name: Build + run: make + + - name: Run tests + run: make test + + - name: Build debug version + run: make debug + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: macos-free-darwin + path: bin/free + + semantic-version: + name: Semantic Version + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + needs: [build] + outputs: + new_tag: ${{ steps.tag.outputs.new_tag }} + changelog: ${{ steps.tag.outputs.changelog }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get latest tag + id: get_tag + run: | + LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") + echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT + echo "Latest tag: $LATEST_TAG" + + - name: Determine version bump + id: bump + run: | + COMMIT_MSG=$(git log -1 --pretty=%B) + echo "Commit message: $COMMIT_MSG" + + if echo "$COMMIT_MSG" | grep -qiE '^(feat|fix|perf|refactor|style|test|docs|chore)!:' || echo "$COMMIT_MSG" | grep -qi 'BREAKING CHANGE'; then + BUMP_TYPE="major" + elif echo "$COMMIT_MSG" | grep -qiE '^feat(\(.+\))?:'; then + BUMP_TYPE="minor" + elif echo "$COMMIT_MSG" | grep -qiE '^(fix|perf)(\(.+\))?:'; then + BUMP_TYPE="patch" + else + BUMP_TYPE="none" + fi + + echo "bump_type=$BUMP_TYPE" >> $GITHUB_OUTPUT + echo "Bump type: $BUMP_TYPE" + + - name: Calculate new version + id: tag + run: | + LATEST_TAG="${{ steps.get_tag.outputs.latest_tag }}" + BUMP_TYPE="${{ steps.bump.outputs.bump_type }}" + + if [ "$BUMP_TYPE" = "none" ]; then + echo "No semantic commit detected, skipping versioning" + echo "new_tag=" >> $GITHUB_OUTPUT + exit 0 + fi + + VERSION=${LATEST_TAG#v} + IFS='.' read -r -a VERSION_PARTS <<< "$VERSION" + MAJOR=${VERSION_PARTS[0]:-0} + MINOR=${VERSION_PARTS[1]:-0} + PATCH=${VERSION_PARTS[2]:-0} + + case $BUMP_TYPE in + major) + MAJOR=$((MAJOR + 1)) + MINOR=0 + PATCH=0 + ;; + minor) + MINOR=$((MINOR + 1)) + PATCH=0 + ;; + patch) + PATCH=$((PATCH + 1)) + ;; + esac + + NEW_TAG="v${MAJOR}.${MINOR}.${PATCH}" + echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT + echo "New tag: $NEW_TAG" + + COMMIT_MSG=$(git log -1 --pretty=%B) + echo "changelog=$COMMIT_MSG" >> $GITHUB_OUTPUT + + - name: Create and push tag + if: steps.tag.outputs.new_tag != '' + run: | + NEW_TAG="${{ steps.tag.outputs.new_tag }}" + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a "$NEW_TAG" -m "Release $NEW_TAG" + git push origin "$NEW_TAG" + echo "✓ Created and pushed tag: $NEW_TAG" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..734e803 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,78 @@ +name: Release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + build: + name: Build Release + runs-on: macos-latest + outputs: + sha256: ${{ steps.sha.outputs.sha256 }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build + run: make + + - name: Create tarball + run: | + VERSION=${GITHUB_REF#refs/tags/} + mkdir -p release/macos-free-${VERSION} + cp bin/free release/macos-free-${VERSION}/ + cp README.md LICENSE release/macos-free-${VERSION}/ + cd release && tar -czvf macos-free-${VERSION}-darwin-arm64.tar.gz macos-free-${VERSION} + + - name: Calculate SHA256 + id: sha + run: | + VERSION=${GITHUB_REF#refs/tags/} + SHA256=$(shasum -a 256 release/macos-free-${VERSION}-darwin-arm64.tar.gz | cut -d ' ' -f 1) + echo "sha256=$SHA256" >> $GITHUB_OUTPUT + echo "SHA256: $SHA256" + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: release-tarball + path: release/*.tar.gz + + release: + name: Create GitHub Release + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: release-tarball + path: ./release + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + files: release/*.tar.gz + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + homebrew: + name: Update Homebrew Tap + runs-on: ubuntu-latest + needs: [build, release] + steps: + - name: Update Homebrew formula + uses: mislav/bump-homebrew-formula-action@v3 + with: + formula-name: macos-free + homebrew-tap: techquestsdev/homebrew-tap + download-url: https://github.com/techquestsdev/mac-free/releases/download/${{ github.ref_name }}/macos-free-${{ github.ref_name }}-darwin-arm64.tar.gz + download-sha256: ${{ needs.build.outputs.sha256 }} + env: + COMMITTER_TOKEN: ${{ secrets.HOMEBREW_TOKEN }}