Skip to content

Commit

Permalink
Import ElasticGraph from private Block repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
myronmarston committed Oct 24, 2024
1 parent 8d33e69 commit f1b0345
Show file tree
Hide file tree
Showing 1,238 changed files with 179,722 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This CODEOWNERS file denotes the project leads
# and encodes their responsibilities for code review.

# Instructions: At a minimum, replace the '@GITHUB_USER_NAME_GOES_HERE'
# here with at least one project lead.

# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# The format is described: https://github.blog/2017-07-06-introducing-code-owners/

# These owners will be the default owners for everything in the repo.
* @myronmarston
* @BrianSigafoos-SQ

# -----------------------------------------------
# BELOW THIS LINE ARE TEMPLATES, UNUSED
# -----------------------------------------------
# Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches javascript files, only these owners
# will be requested to review.
# *.js @octocat @github/js

# You can also use email addresses if you prefer.
# docs/* [email protected]
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: 🐛 Bug Report
about: Thank you for taking the time, please report a reproducible bug
title: "[Bug] <Bug Title Here>"
labels: bug
assignees: myronmarston, BrianSigafoos-SQ
---

**Describe the bug**
*A clear and concise description of what the bug is.*

**To Reproduce:**
*Steps to reproduce the behavior:*
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior:**
*A clear and concise description of what you expected to happen.*

**Supporting Material**
*If applicable, add screenshots, output log and/or other documentation to help explain your problem.*

**Environment (please complete the following information):**
- OS: [ex: iOS]
- Version

**Additional context**
Add any other context that you feel is relevant about the problem here.
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contact_links:
- name: ❓ Questions and Help 🤔
url: https://discord.gg/tbd (/add your discord channel if applicable)
about: This issue tracker is not for support questions. Please refer to the community for more help.
68 changes: 68 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This file is generated by `script/update_ci_yaml` based on input from `config/tested_datastore_versions.yaml`.
# To edit it, make changes to the template at the bottom of `script/update_ci_yaml` and run it.
name: ElasticGraph CI

on:
push:
branches:
- main
pull_request:

env:
# It's recommended to run ElasticGraph with this option to get better performance. We want to run
# our CI builds with it to ensure that the option always works.
RUBYOPT: "--enable-frozen-string-literal"
# We use the VCR gem as a local "test accelerator" which caches datastore requests/responses for us.
# But in our CI build we don't want to use it at all, so we disable it here.
NO_VCR: "1"

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build_part:
- run_each_gem_spec
ruby:
- "3.2"
- "3.3"
datastore:
- "elasticsearch:8.15.1"
- "opensearch:2.16.0"
- "opensearch:2.7.0"
include:
# We have 4 build parts. The "primary" one is `run_each_gem_spec`, and we need that to be run on
# every supported Ruby version and against every supported datastore. It's not necessary to run
# these others against every combination of `ruby` and `datastore` so we just run each with one
# configuration here.
- build_part: "run_misc_checks"
ruby: "3.3"
datastore: "elasticsearch:8.15.1"
- build_part: "run_most_specs_with_vcr"
ruby: "3.3"
datastore: "elasticsearch:8.15.1"
- build_part: "run_specs_file_by_file"
ruby: "3.3"
datastore: "elasticsearch:8.15.1"

steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- uses: actions/setup-node@v3
with:
node-version: "23.x"

- uses: KengoTODA/actions-setup-docker-compose@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Note: the `10` argument on the end is a number of seconds to sleep after booting the datastore.
# We've found that there is a minor race condition where the shards aren't fully ready for the tests
# to hit them if we don't wait a bit after booting.
- run: script/ci_parts/${{ matrix.build_part }} ${{ matrix.datastore }} 10
47 changes: 47 additions & 0 deletions .github/workflows/publish-site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Site

on:
push:
branches:
- main

jobs:
publish-docs:
runs-on: ubuntu-latest

permissions:
contents: write

concurrency:
# Ensures only one job per workflow and branch runs at a time
group: ${{ github.workflow }}-${{ github.ref }}

steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Set up Node
- uses: actions/setup-node@v3
with:
node-version: "23.x"

- name: Build YARD docs and Jekyll site
run: bundle exec rake site:build

- name: Deploy to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
# The GitHub Actions runner automatically creates this `GITHUB_TOKEN` secret
github_token: ${{ secrets.GITHUB_TOKEN }}
# The output directory for Jekyll
publish_dir: config/site/_site
# The branch to push to for GitHub Pages
publish_branch: gh-pages
enable_jekyll: true
96 changes: 96 additions & 0 deletions .github/workflows/push_gem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# This workflow was generated by https://github.com/rubygems/configure_trusted_publisher
name: Push Gem

on:
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g. 1.2.0)"
required: true
type: string
dry-run:
description: "Dry Run"
required: false
type: boolean
default: false

permissions:
contents: read

jobs:
push:
# Limit who can run run this action to core maintainers.
if: github.repository == 'block/elasticgraph' && contains('["myronmarston", "BrianSigafoos-SQ"]', github.actor)
runs-on: ubuntu-latest

environment:
name: rubygems.org
url: https://rubygems.org/search?query=elasticgraph

permissions:
contents: write
id-token: write
pull-requests: write

steps:
# Set up
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
with:
egress-policy: audit

- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Ruby
uses: ruby/setup-ruby@cacc9f1c0b3f4eb8a16a6bb0ed10897b43b9de49 # v1.176.0
with:
working-directory: config/release
bundler-cache: true
ruby-version: ruby

- name: Setup Git Config
# https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- name: Target Release Rakefile
run: |
rm Rakefile
cp config/release/Rakefile .
git update-index --skip-worktree Rakefile
echo "BUNDLE_GEMFILE=config/release/Gemfile" >> "$GITHUB_ENV"
- name: Bump the ElasticGraph version
run: bundle exec rake bump_version[${{ inputs.version }}]

# Note: we put this after bumping the version because really bumping the version is safe to do in dry-run mode.
- name: Enable Dry Run Mode
if: ${{ inputs.dry-run }}
# As per docs[^1], this is the syntax for setting ENV vars for later steps.
# [^1]: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
run: echo "GEM_RELEASE_PRETEND=true" >> "$GITHUB_ENV"

# Release
- name: Release to rubygems.org
uses: rubygems/release-gem@612653d273a73bdae1df8453e090060bb4db5f31 # v1
with:
await-release: ${{ ! inputs.dry-run }}

# Note: this must come after we release the gem because it resets git back to the same SHA we started on
# (before bumping the version), but the RubyGems release depends on the version having been bumped.
- name: Create pull request for the version bump
uses: peter-evans/create-pull-request@v6
with:
branch: release-v${{ inputs.version }}
title: "Release v${{ inputs.version }}"
body: |
- [ ] Confirm the [push-gem action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) succeeded before merging
- [ ] Confirm this version bump should be merged into [${{ github.ref_name }}](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}) or change the base branch
- [ ] Review and edit the [GitHub Draft Release](https://github.com/${{ github.repository }}/releases) (can be done after this PR is merged)
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
draft: true
generateReleaseNotes: true
tag: v${{ inputs.version }}
73 changes: 73 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# We support running commands from the repository root or from a gem subdirectory.
# To support that, many/most of our ignores are duplicated at both levels.

# Ignore bundler and steep artifacts.
/bin/
/bundle/
/.bundle
Gemfile.lock
rbs_collection.lock.yaml
/*/bin/
/*/bundle/
/*/.bundle
/*/Gemfile.lock
/*/rbs_collection.lock.yaml

# Allows customization of the bundle for things like pry, debugger, etc.
Gemfile-custom

# Ignore log and temp files.
/log/*
/tmp/*
/*/log/*
/*/tmp/*

# Ignore artifacts from building the gems.
/pkg/
/*/pkg/

# Ignore Byebug command history file.
.byebug_history
/*/.byebug.history

# Ignore local rspec config
.rspec-local
/*/.rspec-local

# Ignore RBS collection directory--it can be regenerated from `rbs_collection.lockl.yaml`.
.gem_rbs_collection

# Mac OSX file.
.DS_Store
/*/.DS_Store

# This is git-ignored because we dynamically gnerate it from test.yaml.template on each test run
# based on which datastore backend is being used.
/config/settings/test.yaml

# We don't want to commit these artifacts to source control
/elasticgraph-apollo/apollo_tests_implementation/config/schema/artifacts/

# Allow specifying a Ruby version locally
.ruby-version

# Ignore Bundler artifacts for our `config/release/Gemfile` bundle.
/config/release/.bundle
/config/release/vendor/bundle

# Ignore YARD documentation artifacts
/**/.yardoc/
config/site/doc/

# Ignore Jekyll generated site artifacts
config/site/_site
config/site/src/docs
config/site/src/_data/*_queries.yaml
config/site/.jekyll-metadata
config/site/package-lock.json
config/site/examples/*/schema_artifacts
config/site/examples/*/queries/*/*.variables.yaml

# Ignore the generated CSS
config/site/src/assets/css/main.css
config/site/src/assets/css/highlight.css
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require ./spec_support/spec_helper
20 changes: 20 additions & 0 deletions .standard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ruby_version: 3.2
format: progress
ignore:
- adr/**/*
- bin/**/*
- bundle/**/*
- .bundle/**/*
- log/**/*
- tmp/**/*
- "*/vendor/**/*"
- "**/*.rb":
# This cop forces syntax that steep does not yet support. (e.g. `def foo(**); bar(**); end`)
# Once steep supports that, we can stop ignoring this one.
- Style/ArgumentsForwarding
# This cop forces syntax that steep does not yet support. (e.g. bare `super` which implicitly forwards args)
# Once steep supports that, we can stop ignoring this one.
- Style/SuperArguments

extend_config:
- config/linting/custom.yaml
Loading

0 comments on commit f1b0345

Please sign in to comment.