diff --git a/.cspell.json b/.cspell.json index b798d29..d42f889 100644 --- a/.cspell.json +++ b/.cspell.json @@ -4,6 +4,7 @@ "**/vscode-extension/**", "**/.git/**", "**/.pnpm-lock.json", + ".github/workflows/**", ".vscode", "megalinter", "package-lock.json", diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0dd17c6..fd48648 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ env: # Comment env block if you do not want to apply fixes concurrency: group: ${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true + cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }} jobs: build: @@ -34,7 +34,7 @@ jobs: - name: Checkout Code uses: actions/checkout@v3 with: - token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances # MegaLinter @@ -42,36 +42,38 @@ jobs: id: ml # You can override MegaLinter flavor used to have faster performances # More info at https://megalinter.io/flavors/ - uses: oxsecurity/megalinter@v7 + uses: oxsecurity/megalinter/flavors/cupcake@v7 env: # All available variables are described in documentation # https://megalinter.io/configuration/ - VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} # Validates all source when push on main, else just the git diff with main. Set 'true' if you always want to lint all sources + VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }} # Validates all source when push on main, else just the git diff with main. Set 'true' if you always want to lint all sources GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # ADD YOUR CUSTOM ENV VARIABLES HERE TO OVERRIDE VALUES OF .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY - # Upload MegaLinter artifacts - - name: Archive production artifacts - if: ${{ success() }} || ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: MegaLinter reports - path: | - megalinter-reports - mega-linter.log - # Create pull request if applicable (for now works only on PR from same repository, not from forks) - name: Create Pull Request with applied fixes id: cpr if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') uses: peter-evans/create-pull-request@v5 with: - token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} commit-message: "[MegaLinter] Apply linters automatic fixes" title: "[MegaLinter] Apply linters automatic fixes" labels: bot - name: Create PR output - if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') + if: ${{ + steps.ml.outputs.has_updated_sources == 1 + && ( + env.APPLY_FIXES_EVENT == 'all' || + env.APPLY_FIXES_EVENT == github.event_name + ) + && env.APPLY_FIXES_MODE == 'pull_request' + && ( + github.event_name == 'push' || + github.event.pull_request.head.repo.full_name == github.repository + ) + && !contains(github.event.head_commit.message, 'skip fix') + }} run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index b424344..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: brew pr-pull - -on: - workflow_dispatch: # triggered manually -jobs: - pr-pull: - if: contains(github.event.pull_request.labels.*.name, 'pr-pull') - runs-on: ubuntu-22.04 - steps: - - name: Set up Homebrew - uses: Homebrew/actions/setup-homebrew@master - - - name: Set up git - uses: Homebrew/actions/git-user-config@master - - - name: Pull bottles - env: - HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }} - HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{ github.token }} - HOMEBREW_GITHUB_PACKAGES_USER: ${{ github.actor }} - PULL_REQUEST: ${{ github.event.pull_request.number }} - run: brew pr-pull --debug --tap=$GITHUB_REPOSITORY $PULL_REQUEST - - - name: Push commits - uses: Homebrew/actions/git-try-push@master - with: - token: ${{ github.token }} - branch: main - - - name: Delete branch - if: github.event.pull_request.head.repo.fork == false - env: - BRANCH: ${{ github.event.pull_request.head.ref }} - run: git push --delete origin $BRANCH diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 731b893..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: brew test-bot -on: - workflow_dispatch: # triggered manually - # push: - # branches: - # - main - # pull_request: -jobs: - test-bot: - strategy: - matrix: - os: [ubuntu-22.04, macos-13] - runs-on: ${{ matrix.os }} - steps: - - name: Set up Homebrew - id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@master - - - name: Cache Homebrew Bundler RubyGems - id: cache - uses: actions/cache@v3 - with: - path: ${{ steps.set-up-homebrew.outputs.gems-path }} - key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} - restore-keys: ${{ runner.os }}-rubygems- - - - name: Install Homebrew Bundler RubyGems - if: steps.cache.outputs.cache-hit != 'true' - run: brew install-bundler-gems - - - run: brew test-bot --only-cleanup-before - - - run: brew test-bot --only-setup - - - run: brew test-bot --only-tap-syntax - - - run: brew test-bot --only-formulae - if: github.event_name == 'pull_request' - - - name: Upload bottles as artifact - if: always() && github.event_name == 'pull_request' - uses: actions/upload-artifact@main - with: - name: bottles - path: '*.bottle.*' diff --git a/.mega-linter.yml b/.mega-linter.yml index e85913f..a10eb6d 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -2,11 +2,13 @@ # See all available variables at https://megalinter.io/configuration/ and in linters documentation APPLY_FIXES: all # all, none, or list of linter keys + # ENABLE: # If you use ENABLE variable, all other languages/formats/tooling-formats will be disabled by default # ENABLE_LINTERS: # If you use ENABLE_LINTERS variable, all other linters will be disabled by default DISABLE: - COPYPASTE # Comment to enable checks of excessive copy-pastes - # - SPELL # Uncomment to disable checks of spelling mistakes + - SPELL # Uncomment to disable checks of spelling mistakes SHOW_ELAPSED_TIME: true FILEIO_REPORTER: false +FLAVOR_SUGGESTIONS: true # suggest smaller flavors if available # DISABLE_ERRORS: true # Uncomment if you want MegaLinter to detect errors but not block CI to pass diff --git a/README.md b/README.md index 21d02d1..daf186f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -<<<<<<< HEAD # homebrew-devsetup A template for your own homebrew tap. Fork this repo (or copy it) and add your own formula to set up new devices how you want. @@ -37,6 +36,11 @@ devsetup set-tap nsheaps/devsetup devsetup install devsetup-base ``` +## Maintenance + +### Linting + +`npx mega-linter-runner --flavor cupcake` ## Getting Started With Your Own Tap This tap is to serve as an example and template for new taps for your own personalized setup. The only thing it comes with a basic structure of a homebrew tap, some example formulas to demonstrate OS-agnostic installs of specific software, and a tool for keeping your own devsetup up to date for use in an organization. The real power of this comes in when you customize it. @@ -57,12 +61,12 @@ Fork or copy this repo and add your own formula to set up new devices how you wa Uses `$HOME/.config/devsetup/` for any needed configuration files. -| command | description | -| --------- | ------------------- | -| `devsetup set-tap ` | sets the tap to use for installing software. This is the tap that will be used when running `devsetup install `. | -| `devsetup get-tap` | prints the current tap. eg `nsheaps/devsetup` | +| command | description | +|--------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `devsetup set-tap ` | sets the tap to use for installing software. This is the tap that will be used when running `devsetup install `. | +| `devsetup get-tap` | prints the current tap. eg `nsheaps/devsetup` | | `devsetup install `
`devsetup i ` | installs a formula from this tap, an alias for `brew install $(devsetup get-tap)/`. This is to avoid trying to pin this tap ([deprecated](https://github.com/Homebrew/brew/pull/5925)) when installing your locked versions of software | -| `devsetup upgrade-all` | updates the local clone of this tap (`devsetup update`), then upgrades all software installed from it (list, filter by `$(devsetup get-tap)/.*, run `brew upgrade `)| +| `devsetup upgrade-all` | updates the local clone of this tap (`devsetup update`), then upgrades all software installed from it (list, filter by `$(devsetup get-tap)/.*, run`brew upgrade `)| | `devsetup upgrade `
`devsetup u ` | alias for `brew upgrade $(devsetup get-tap)/`, always upgrades `devsetup` even if from another tap. | | `devsetup update` | Alias for `$(cd $(brew --repository $(devsetup get-tap)) && git pull)`. This is to avoid updating other taps. | | `devsetup outdated` | Alias for `brew outdated $(devsetup get-tap)/.*` | @@ -95,32 +99,19 @@ Passing `--force` will remove the configuration without warning. If you want any of these configurations to happen automatically on `devsetup install`, add the formula as a depdendency to the `devsetup` formula. -| topic | description | -| --------- | ------------------- | -| `git` | sets up git with a global user and email. | -| `github-token` | sets up a GITHUB_TOKEN and adds it to your `~/.profile` | -| `github-ssh` | sets up github to prefer ssh via `git config --global url.ssh://git@github.com/.insteadOf https://github.com/`, and then runs `gh ssh-key add $(devsetup-configure-ssh --keyfile)`.
Note: depends on `gh` and `nsheaps/devsetup/devsetup-configure-ssh` | -| `ssh` | sets up ssh with a key and config. Also provides a `--keyfile [keytype]` to return the location of the requested keyfile | -| `gpg` | sets up gpg with a key and config | -| `aws` | sets up aws with a profile and config | +| topic | description | +|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `git` | sets up git with a global user and email. | +| `github-token` | sets up a GITHUB_TOKEN and adds it to your `~/.profile` | +| `github-ssh` | sets up github to prefer ssh via `git config --global url.ssh://git@github.com/.insteadOf https://github.com/`, and then runs `gh ssh-key add $(devsetup-configure-ssh --keyfile)`.
Note: depends on `gh` and `nsheaps/devsetup/devsetup-configure-ssh` | +| `ssh` | sets up ssh with a key and config. Also provides a `--keyfile [keytype]` to return the location of the requested keyfile | +| `gpg` | sets up gpg with a key and config | +| `aws` | sets up aws with a profile and config | ## TODO * [ ] Test `brew list` and see if it dumps list prefixed with installed tap (no tap is `homebrew/core`) * [ ] Test creating an alias via [`livecheck`](https://docs.brew.sh/Brew-Livecheck#referenced-formulacask) and see if it works - * It should, since normally it's looking at the local tap, `livecheck` should check upstream if there are updates. + * It should, since normally it's looking at the local tap, `livecheck` should check upstream if there are updates. * [ ] Figure out a way to pass flags for devsetup-configure scripts * [ ] Figure out a way to reference dependencies via env var for referencing the tap rather than fully qualified -======= -# Nsheaps Devsetup - -## How do I install these formulae? - -`brew install nsheaps/devsetup/` - -Or `brew tap nsheaps/devsetup` and then `brew install `. - -## Documentation - -`brew help`, `man brew` or check [Homebrew's documentation](https://docs.brew.sh). ->>>>>>> 96f8bab (Create nsheaps/devsetup tap)