Skip to content

Commit

Permalink
Try stub files
Browse files Browse the repository at this point in the history
  • Loading branch information
tregismoreira committed Jul 22, 2024
1 parent e932268 commit abe9735
Show file tree
Hide file tree
Showing 14 changed files with 941 additions and 762 deletions.
974 changes: 487 additions & 487 deletions .github/workflows/behat.yml

Large diffs are not rendered by default.

138 changes: 69 additions & 69 deletions .github/workflows/bestPractices.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
# This file contains custom lints that are not common to PHP/Drupal projects but
# are specific to how we want to build products at Open Social. These only run
# on pull requests since they are input for reviewer conversations and not hard
# rules such as our quality checks.
name: Best practices

# Contrary to the other jobs we only perform these checks on pull requests and accept that if a PR is merged despite
# checks failing we can ignore the addition on the main branch. There might be good reasons for developers to deviate
# from best practices (but if you're reading this, we do expect a good motivation written in the PR).
on:
pull_request: { }

defaults:
run:
shell: bash

jobs:
config_overrides:
name: No config overrides added
runs-on: ubuntu-latest
continue-on-error: true
outputs:
outcome: ${{ steps.test.outcome }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# We're only interested in config overrides being added.
# grep exits with 0 if it has matches, which we consider to be a fail
# so we invert.
- id: test
run: "! git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- '**/*.services.yml' | grep -e '^+' | grep config.factory.override"

helper_classes:
name: No helper objects introduced
runs-on: ubuntu-latest
continue-on-error: true
outputs:
outcome: ${{ steps.test.outcome }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# We're only interested in Helper classes being added.
# grep exits with 0 if it has matches, which we consider to be a fail, so we invert.
- id: test
run: "! git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} --name-only --diff-filter=A | grep Helper"

post_helper_message:
if: always()
needs: [config_overrides, helper_classes]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v7
env:
CONFIG_OVERRIDES_RESULT: ${{ needs.config_overrides.outputs.outcome }}
HELPERS_ADDED_RESULT: ${{ needs.helper_classes.outputs.outcome }}
with:
script: |
const errors = {
hasConfigOverrides: process.env.CONFIG_OVERRIDES_RESULT === "failure",
hasHelpersAdded: process.env.HELPERS_ADDED_RESULT === "failure",
};
const script = require('./.github/workflows/bestPracticesFeedback.js')
await script({github, context}, errors);
## This file contains custom lints that are not common to PHP/Drupal projects but
## are specific to how we want to build products at Open Social. These only run
## on pull requests since they are input for reviewer conversations and not hard
## rules such as our quality checks.
#name: Best practices
#
## Contrary to the other jobs we only perform these checks on pull requests and accept that if a PR is merged despite
## checks failing we can ignore the addition on the main branch. There might be good reasons for developers to deviate
## from best practices (but if you're reading this, we do expect a good motivation written in the PR).
#on:
# pull_request: { }
#
#defaults:
# run:
# shell: bash
#
#jobs:
# config_overrides:
# name: No config overrides added
# runs-on: ubuntu-latest
# continue-on-error: true
# outputs:
# outcome: ${{ steps.test.outcome }}
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
#
# # We're only interested in config overrides being added.
# # grep exits with 0 if it has matches, which we consider to be a fail
# # so we invert.
# - id: test
# run: "! git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- '**/*.services.yml' | grep -e '^+' | grep config.factory.override"
#
# helper_classes:
# name: No helper objects introduced
# runs-on: ubuntu-latest
# continue-on-error: true
# outputs:
# outcome: ${{ steps.test.outcome }}
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
#
# # We're only interested in Helper classes being added.
# # grep exits with 0 if it has matches, which we consider to be a fail, so we invert.
# - id: test
# run: "! git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} --name-only --diff-filter=A | grep Helper"
#
# post_helper_message:
# if: always()
# needs: [config_overrides, helper_classes]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/github-script@v7
# env:
# CONFIG_OVERRIDES_RESULT: ${{ needs.config_overrides.outputs.outcome }}
# HELPERS_ADDED_RESULT: ${{ needs.helper_classes.outputs.outcome }}
# with:
# script: |
# const errors = {
# hasConfigOverrides: process.env.CONFIG_OVERRIDES_RESULT === "failure",
# hasHelpersAdded: process.env.HELPERS_ADDED_RESULT === "failure",
# };
#
# const script = require('./.github/workflows/bestPracticesFeedback.js')
# await script({github, context}, errors);
116 changes: 58 additions & 58 deletions .github/workflows/prManager.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
# This file runs our script that helps us manage pull requests.
name: PR Manager

# This script runs on a lot of cases because it helps us automated labelling and
# other feedback based on the actions people take with
on:
pull_request:
types:
- assigned
- unassigned
- labeled
- unlabeled
- opened
- edited
- closed
- reopened
- synchronize
- converted_to_draft
- locked
- unlocked
- enqueued
- dequeued
- milestoned
- demilestoned
- ready_for_review
- review_requested
- review_request_removed
- auto_merge_enabled
- auto_merge_disabled

# We use the default concurrency grouping of allowing a single workflow per branch/PR/tag to run at the same time.
# In case of PRs we only care about the results for the last workflow run, so we cancel workflows already in progress
# when new code is pushed, in all other cases (branches/tags) we want to have a history for commits so it's easier to
# find breakages when they occur (head_ref is non-empty only when the workflow is triggered from a PR).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.head_ref != '' }}

defaults:
run:
shell: bash

jobs:
manage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
working-directory: ./.github/prManager

- uses: actions/github-script@v7
with:
script: |
const { default: script } = await import('${{ github.workspace }}/.github/prManager/src/main.js')
await script({github, context});
## This file runs our script that helps us manage pull requests.
#name: PR Manager
#
## This script runs on a lot of cases because it helps us automated labelling and
## other feedback based on the actions people take with
#on:
# pull_request:
# types:
# - assigned
# - unassigned
# - labeled
# - unlabeled
# - opened
# - edited
# - closed
# - reopened
# - synchronize
# - converted_to_draft
# - locked
# - unlocked
# - enqueued
# - dequeued
# - milestoned
# - demilestoned
# - ready_for_review
# - review_requested
# - review_request_removed
# - auto_merge_enabled
# - auto_merge_disabled
#
## We use the default concurrency grouping of allowing a single workflow per branch/PR/tag to run at the same time.
## In case of PRs we only care about the results for the last workflow run, so we cancel workflows already in progress
## when new code is pushed, in all other cases (branches/tags) we want to have a history for commits so it's easier to
## find breakages when they occur (head_ref is non-empty only when the workflow is triggered from a PR).
#concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: ${{ github.head_ref != '' }}
#
#defaults:
# run:
# shell: bash
#
#jobs:
# manage:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# - run: npm ci
# working-directory: ./.github/prManager
#
# - uses: actions/github-script@v7
# with:
# script: |
# const { default: script } = await import('${{ github.workspace }}/.github/prManager/src/main.js')
# await script({github, context});
68 changes: 34 additions & 34 deletions .github/workflows/prManagerTest.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# Run the automated test suite for the PR manager in case it changes.
name: PR Manager Test

on:
pull_request:
paths:
# Only run in case the PR Manager code or workflow changes.
- '.github/prManager/**'

# We use the default concurrency grouping of allowing a single workflow per branch/PR/tag to run at the same time.
# In case of PRs we only care about the results for the last workflow run, so we cancel workflows already in progress
# when new code is pushed, in all other cases (branches/tags) we want to have a history for commits so it's easier to
# find breakages when they occur (head_ref is non-empty only when the workflow is triggered from a PR).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.head_ref != '' }}

defaults:
run:
shell: bash

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
working-directory: ./.github/prManager

- run: npm run test
working-directory: ./.github/prManager
## Run the automated test suite for the PR manager in case it changes.
#name: PR Manager Test
#
#on:
# pull_request:
# paths:
# # Only run in case the PR Manager code or workflow changes.
# - '.github/prManager/**'
#
## We use the default concurrency grouping of allowing a single workflow per branch/PR/tag to run at the same time.
## In case of PRs we only care about the results for the last workflow run, so we cancel workflows already in progress
## when new code is pushed, in all other cases (branches/tags) we want to have a history for commits so it's easier to
## find breakages when they occur (head_ref is non-empty only when the workflow is triggered from a PR).
#concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: ${{ github.head_ref != '' }}
#
#defaults:
# run:
# shell: bash
#
#jobs:
# test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# - run: npm ci
# working-directory: ./.github/prManager
#
# - run: npm run test
# working-directory: ./.github/prManager
Loading

0 comments on commit abe9735

Please sign in to comment.