Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How Artsy Automates Team Culture

How Artsy Automates Team Culture

Ash Furrow

May 31, 2019
Tweet

More Decks by Ash Furrow

Other Decks in Technology

Transcript

  1. SwiftLint.lint(inline: true, directory: "Sources")

    View full-size slide

  2. build_file = File.join(ENV["CIRCLE_ARTIFACTS"], "xcode_build_raw.log")
    # Sort the symbols, then grab the top 1000
    most_expensive_swift_table = `…` # Some command-line stuff
    # Look for statistical outliers in compile times
    outliers = most_expensive_swift_table
    .lines.map { |line| line.split.first.to_i }
    .reject { |value| value "# 0 }
    .outliers(3)
    if outliers.any?
    warn("Detected some Swift building time outliers")
    headings = "Time | Class | Function |\n| ""$ | ----- | ----- |"
    warnings = ""% # Construct a Markdown table
    markdown(([headings] + warnings).join)
    end

    View full-size slide

  3. # Ask to update Chinese docs if only English docs are updated and vice-versa.
    en_docs_modified = git.modified_files.grep(%r{docs/}).empty?
    cn_docs_modified = git.modified_files.grep(%r{docs_CN}).empty?
    # xor operator ftw
    if en_docs_modified ^ cn_docs_modified
    warn("Consider "&also"& updating the "'
    en_docs_modified ? "English" : "Chinese"
    } docs.")
    end

    View full-size slide

  4. Webhook Events
    LITERALLY
    WHATEVER
    YOU WANT

    View full-size slide

  5. {
    "settings": {
    "ignored_repos": ["artsy/design", "artsy/hokusai"]
    },
    "rules": {
    "( Jira integration
    "pull_request": "org/allPRs.ts",
    "pull_request.closed": ["org/closedPRs.ts", "org/jira/pr.ts"],
    "pull_request.opened": "org/addPatchLabel.ts",
    "( The RFC process
    "issues": "org/rfc/addRFCToNewIssues.ts",
    "issues.labeled": "org/rfc/scheduleRFCsForLabels.ts",
    "( Merge on Green
    "issue_comment": "org/markAsMergeOnGreen.ts",
    "pull_request_review": "org/markAsMergeOnGreen.ts",
    "status.success": "org/mergeOnGreen.ts"
    },
    "repos": {
    "artsy/peril-settings": {
    "pull_request.review_requested": "org/addReviewer.ts"
    },

    View full-size slide

  6. {
    "settings": {
    "ignored_repos": ["artsy/design", "artsy/hokusai"]
    },
    "rules": {
    "( Jira integration
    "pull_request": "org/allPRs.ts",
    "pull_request.closed": ["org/closedPRs.ts", "org/jira/pr.ts"],
    "pull_request.opened": "org/addPatchLabel.ts",
    "( The RFC process
    "issues": "org/rfc/addRFCToNewIssues.ts",
    "issues.labeled": "org/rfc/scheduleRFCsForLabels.ts",
    "( Merge on Green
    "issue_comment": "org/markAsMergeOnGreen.ts",
    "pull_request_review": "org/markAsMergeOnGreen.ts",
    "status.success": "org/mergeOnGreen.ts"
    },
    "repos": {
    "artsy/peril-settings": {
    "pull_request.review_requested": "org/addReviewer.ts"
    },

    View full-size slide

  7. {
    "settings": {
    "ignored_repos": ["artsy/design", "artsy/hokusai"]
    },
    "rules": {
    "( Jira integration
    "pull_request": "org/allPRs.ts",
    "pull_request.closed": ["org/closedPRs.ts", "org/jira/pr.ts"],
    "pull_request.opened": "org/addPatchLabel.ts",
    "( The RFC process
    "issues": "org/rfc/addRFCToNewIssues.ts",
    "issues.labeled": "org/rfc/scheduleRFCsForLabels.ts",
    "( Merge on Green
    "issue_comment": "org/markAsMergeOnGreen.ts",
    "pull_request_review": "org/markAsMergeOnGreen.ts",
    "status.success": "org/mergeOnGreen.ts"
    },
    "repos": {
    "artsy/peril-settings": {
    "pull_request.review_requested": "org/addReviewer.ts"
    },

    View full-size slide

  8. • Requires Per-repo setup
    • Simpler to get started
    • Ruby, JS, Swift, more…
    • Setup once per GitHub Org
    • Requires hosting
    • Far more powerful
    • TypeScript/JS

    View full-size slide

  9. export default async () ") {
    const pr = danger.github.pr
    if (pr.body.includes("#trivial")) {
    return
    }
    const changelogs = ["CHANGELOG.md", "changelog.md", "CHANGELOG.yml"]
    "( Some code to check if the repo has one of these files in it.
    if (isPROpen "* repoHasChangelog) {
    const files = [""%danger.git.modified_files, ""%danger.git.created_files]
    const hasCodeChanges = files.find(file ") !file.match(/(test|spec)/i))
    const hasChangelogChanges = files.find(file ") changelogs.includes(file))
    if (hasCodeChanges "* !hasChangelogChanges) {
    warn("…")
    }
    }
    }

    View full-size slide

  10. import { danger, warn, fail } from "danger"
    const mobileRepos = ["eigen", "emission", "eidolon", "energy", "emergence"]
    export default async () ") {
    const pr = danger.github.pr
    const isMobileRepo = mobileRepos.filter(name ")
    pr.base.repo.name.endsWith(name)
    ).length > 0
    if (isMobileRepo "* pr.head.repo.fork) {
    try {
    "( Are they a member of the Artsy GitHub org? This will throw if not.
    await danger.github.api.orgs.checkMembership(
    { org: "artsy", username: pr.user.login }
    )
    fail("…")
    } catch (error) {
    "( They are not.
    }
    }
    }

    View full-size slide

  11. github.com/artsy/peril-settings

    View full-size slide

  12. React Component Primitives
    Web Component Library
    Artsy.net Website

    View full-size slide