Skip to content

Commit

Permalink
feat(ci): connect repo to Community-TC
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-boris committed Aug 3, 2022
1 parent 1fc8f5f commit 6247148
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .git-template/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
if [ -f .pre-commit-config.yaml ]; then
echo 'pre-commit configuration detected, but `pre-commit install` was never run' 1>&2
exit 1
fi
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
# Trims trailing whitespace
- id: trailing-whitespace
# Makes sure files end in a newline and only a newline
- id: end-of-file-fixer
# Check for files that contain merge conflict strings
- id: check-merge-conflict

- repo: https://github.com/marco-c/taskcluster_yml_validator
rev: v0.0.9
hooks:
# Validates .taskcluster.yml file against possible GitHub events
- id: taskcluster_yml

ci:
skip: [taskcluster_yml]
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Style/StringLiterals:
Enabled: false

AllCops:
NewCops: enable
67 changes: 67 additions & 0 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
version: 1
reporting: checks-v1
policy:
pullRequests: public
tasks:
$let:
head_rev:
$if: tasks_for == "github-pull-request"
then: ${event.pull_request.head.sha}
else: ${event.after}
repository:
$if: tasks_for == "github-pull-request"
then: ${event.pull_request.head.repo.html_url}
else: ${event.repository.html_url}
in:
$let:
tests:
- image: ruby
name: lint-ruby
command:
- /bin/bash
- '--login'
- '-c'
- >-
git clone ${repository} repo &&
cd repo &&
git config advice.detachedHead false &&
git checkout ${head_rev} &&
bundle install &&
rubocop
- image: homebrew/brew
name: brew {audit, test, install}
command:
- /bin/bash
- '--login'
- '-c'
- >-
git clone ${repository} repo &&
cd repo &&
git config advice.detachedHead false &&
git checkout ${head_rev} &&
brew audit --strict ./Formula/taskcluster.rb &&
brew test ./Formula/taskcluster.rb &&
brew install ./Formula/taskcluster.rb
in:
$let:
test_tasks:
$map: {$eval: tests}
each(test):
taskId: {$eval: as_slugid(test.name)}
taskQueueId: proj-taskcluster/ci
created: {$fromNow: ''}
deadline: {$fromNow: '30 minutes'}
payload:
maxRunTime: 1800
image: ${test.image}
command: {$eval: 'test.command'}
metadata:
name: ${test.name}
description: ${test.name}
owner: [email protected]
source: ${repository}
in:
$flattenDeep:
$match:
(tasks_for == "github-pull-request" && event["action"] in ["opened","reopened","synchronize"]):
{$eval: test_tasks}
15 changes: 9 additions & 6 deletions Formula/taskcluster.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# frozen_string_literal: true

# Homebrew formula for taskcluster CLI
class Taskcluster < Formula
desc "A Taskcluster client library for the command line"
desc "Client library for the Taskcluster CLI"
homepage "https://github.com/taskcluster/taskcluster/tree/main/clients/client-shell"
version "v44.17.2"
version "44.17.2"
license "MPL-2.0"

if OS.mac?
if Hardware::CPU.physical_cpu_arm64?
url "https://github.com/taskcluster/taskcluster/releases/download/#{version}/taskcluster-darwin-arm64", :using => :curl
url "https://github.com/taskcluster/taskcluster/releases/download/v#{version}/taskcluster-darwin-arm64"
sha256 "1ccf56972988f45c88e9a21a536728f1064eabef49a9d085e16ac41db14214a5"
else
url "https://github.com/taskcluster/taskcluster/releases/download/#{version}/taskcluster-darwin-amd64", :using => :curl
url "https://github.com/taskcluster/taskcluster/releases/download/v#{version}/taskcluster-darwin-amd64"
sha256 "7897baf6c27350e5a6fe46e93f9bb4890f5dd98a117196acfb4267e639624a5c"
end
elsif OS.linux?
url "https://github.com/taskcluster/taskcluster/releases/download/#{version}/taskcluster-linux-amd64", :using => :curl
url "https://github.com/taskcluster/taskcluster/releases/download/v#{version}/taskcluster-linux-amd64"
sha256 "d12b40c048e96bd5376f9d28c4831075ee6b74b3c8b9bd3d85f57cc1a9ec1971"
end

Expand All @@ -30,6 +33,6 @@ def install
end

test do
system "#{bin}/taskcluster --help"
system "#{bin}/taskcluster", "--help"
end
end
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gem 'rubocop', require: false
34 changes: 34 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
json (2.6.2)
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
rainbow (3.1.1)
regexp_parser (2.5.0)
rexml (3.2.5)
rubocop (1.32.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.19.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.19.1)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
unicode-display_width (2.2.0)

PLATFORMS
arm64-darwin-21

DEPENDENCIES
rubocop

BUNDLED WITH
2.3.11

0 comments on commit 6247148

Please sign in to comment.