Skip to content

Commit

Permalink
Adds new tap : gwv (#2)
Browse files Browse the repository at this point in the history
* Adds gwv formula

* Change dir

* Tweaks Dockerfile

* Wires CI check

* Runs linters on CI
  • Loading branch information
ubiratansoares authored Apr 30, 2024
1 parent 205dac7 commit 6b164f4
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 7 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2024 Dotanuki Labs
# SPDX-License-Identifier: MIT

name: CI

on:
Expand All @@ -7,13 +10,25 @@ on:
- main

jobs:
lint:
runs-on: ubuntu-22.04
steps:
- name: Project Checkout
uses: actions/[email protected]

- name: Run essential checks
uses: dotanuki-labs/github-actions/essentials@main
with:
file-patterns: '*.sh,*.rb,*.yml,*Dockerfile'
license: 'mit'

checks:
runs-on: macOS-14
runs-on: ubuntu-22.04
needs: lint

steps:
- name: Project Checkout
uses: actions/[email protected]

- name: Run checks
run: echo "✅ Passed!"

- name: Run E2E tests
run: ./e2e/run.sh
File renamed without changes.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

> A collection of curated Homebrew Taps 🍻

## Installing taps


```bash
brew tap dotanuki-labs/taps
brew install <some-tap>
```

## Available taps

- TODO
- [gwv](https://github.com/dotanuki-labs/gradle-wrapper-validator)

## License

Expand Down
9 changes: 9 additions & 0 deletions e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2024 Dotanuki Labs
# SPDX-License-Identifier: MIT

FROM homebrew/brew:4.2.20

COPY . "/home/linuxbrew/dotanuki-taps"
COPY e2e/tests.sh /usr/bin/tests.sh

ENTRYPOINT ["/usr/bin/tests.sh"]
24 changes: 24 additions & 0 deletions e2e/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Copyright 2024 Dotanuki Labs
# SPDX-License-Identifier: MIT

set -euo pipefail

dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${dir%/*}"

echo
echo "🔥 Building Docker image for tests!"
echo

docker build . -t dotanuki-labs/homebrew-taps -f e2e/Dockerfile

echo
echo "🔥 Running tests"
echo

docker run --rm dotanuki-labs/homebrew-taps

echo
echo "✅ Done!"
echo
43 changes: 43 additions & 0 deletions e2e/tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Copyright 2024 Dotanuki Labs
# SPDX-License-Identifier: MIT

set -euo pipefail

export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_INSTALL_UPGRADE=1

tap_formulas() {
brew tap dotanuki-labs/tap "/home/linuxbrew/dotanuki-taps"

echo
echo "Checking formulae collection"
echo
brew tap-info dotanuki-labs/tap
echo
}

test_formula() {
local name="$1"
local url="$2"

echo
echo "Installing $name ($url)"
brew install "$name"

echo
echo "Testing installation ($name) --help"
echo
"$name" --help

echo
}

tap_formulas
test_formula "gwv" "https://github.com/dotanuki-labs/gradle-wrapper-validator"

echo
echo "🔥 Done!"
echo
43 changes: 43 additions & 0 deletions gwv.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2024 Dotanuki Labs
# SPDX-License-Identifier: MIT

class Gwv < Formula
desc "A validator for gradle/wrapper jar binaries, intended to be used in CI pipelines"
homepage "https://github.com/dotanuki-labs/gradle-wrapper-validator"
version "0.2.0"

os = OS.mac? ? "apple-darwin" : "unknown-linux-gnu"
arch = case Hardware::CPU.arch
when :x86_64 then "x86_64"
when :arm64 then "aarch64"
else
raise "gorush: Unsupported system architecture #{Hardware::CPU.arch}"
end

@@filename = "gwv-#{arch}-#{os}"
@@url = "#{homepage}/releases/download/#{version}/#{@@filename}"
@@using = :nounzip

@@sha256 = case "#{arch}-#{os}"
when "x86_64-unknown-linux-gnu" then "ad4d81bd7f30a2a05e65313ec273139f24b260fb343f94abbdc02fdc4cd7585e"
when "x86_64-apple-darwin" then "d975f93599b17829d6b016d54163db657be7899215869756501df38c513d86a8"
when "aarch64-unknown-linux-gnu" then "1c0248acc279b5dbc4cf8776016dfc4d39f243902bc1544d59f06d91e9d93dc8"
when "aarch64-apple-darwin" then "3ab1d6eef8e48fd3697f9f4cf535a106e46f7e530982ab324779bada3fca9921"
else
raise "gwv: Unsupported combination (arch / operating system) #{arch}-#{os}"
end

sha256 @@sha256
url @@url,
using: @@using


def install
filename = Gwv.class_variable_get("@@filename")
bin.install filename => "gwv"
end

test do
system "#{bin}/gwv", "--version"
end
end

0 comments on commit 6b164f4

Please sign in to comment.