Skip to content

Commit

Permalink
Move workflows in-repo instead of separately
Browse files Browse the repository at this point in the history
  • Loading branch information
SamWilsn committed Feb 14, 2025
1 parent b7ed51a commit 9755a3d
Show file tree
Hide file tree
Showing 6 changed files with 268 additions and 16 deletions.
50 changes: 50 additions & 0 deletions .github/actions/build-eips/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'build-eips'

description: 'Run the build-eips tool'

inputs:
args:
description: 'Command-line arguments to pass to build-eips'
required: true

outputs:
stdout:
description: 'Standard output from build-eips'
value: ${{ steps.run-build-eips.outputs.stdout }}

runs:
using: "composite"
steps:
- name: Rust Cache
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3

- name: Install build-eips
id: install-build-eips
shell: bash
run: |
WHERE="$(mktemp -d)"
(
cd "$WHERE";
wget https://github.com/eips-wg/preprocessor/releases/latest/download/build-eips-ubuntu.tar.xz;
tar xvf build-eips-ubuntu.tar.xz;
)
echo "bin=$WHERE/build-eips" >> "$GITHUB_OUTPUT"
- name: Install Zola
shell: bash
run: cargo install --locked --git https://github.com/getzola/zola.git --rev bcbcd1e7edfc4e011b0760aaaba965878144a7d3

- name: Run build-eips
id: run-build-eips
shell: bash
env:
BUILD_EIPS_ARGS: ${{ inputs.args }}
BUILD_EIPS: ${{ steps.install-build-eips.outputs.bin }}
run: |
set -euf -o pipefail
write_eof() {
echo -e "\nEOF" >> "$GITHUB_OUTPUT"
}
echo "stdout<<EOF" >> "$GITHUB_OUTPUT"
trap write_eof EXIT
"$BUILD_EIPS" $BUILD_EIPS_ARGS | awk '{ print; if ($0 == "EOF") exit 1 }' | tee -a "$GITHUB_OUTPUT"
76 changes: 73 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,78 @@ on:
- ready_for_review
- edited

concurrency:
group: ${{ github.workflow }}-${{ github.repository }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
ci:
# Stores metadata about the pull request so that `post-ci.yml` can leave a
# useful comment on the pull request.
save-pr:
if: github.event.pull_request.base.repo.owner.login == 'eips-wg'
name: Save Pull Request Metadata
runs-on: ubuntu-latest

steps:
- name: Build Artifact
env:
PR_NUMBER: ${{ github.event.number }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
MERGE_SHA: ${{ github.sha }}
run: |
mkdir -p ./pr
echo $PR_NUMBER > ./pr/pr_number
echo $PR_SHA > ./pr/pr_sha
echo $MERGE_SHA > ./pr/merge_sha
- name: Upload Artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
with:
name: pr_number
path: pr/

check:
if: github.event.pull_request.base.repo.owner.login == 'eips-wg'
name: Check
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
with:
fetch-depth: 0

- name: EIPs Build (Check)
uses: ./.github/actions/build-eips
with:
args: check

markdownlint:
if: github.event.pull_request.base.repo.owner.login == 'eips-wg'
uses: eips-wg/build/.github/workflows/ci.yml@master
secrets: inherit
name: Markdown Linter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
with:
fetch-depth: 0

- name: Get Changed Files
id: changed-files
uses: ./.github/actions/build-eips
with:
args: changed

- name: Checkout (Config)
if: steps.changed-files.outputs.stdout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
with:
repository: eips-wg/theme
path: theme

- name: Markdown Lint
if: steps.changed-files.outputs.stdout
uses: DavidAnson/markdownlint-cli2-action@05f32210e84442804257b2a6f20b273450ec8265 # 19.1.0
with:
config: ./theme/config/config.markdownlint.yaml
globs: ${{ steps.changed-files.outputs.stdout }}
51 changes: 46 additions & 5 deletions .github/workflows/post-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,54 @@ on:
types:
- completed

# This is adapted from https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run (2022-07-17)

name: Post Continuous Integration

jobs:
ci:
if: github.event.workflow_run.repository.owner.login == 'eips-wg'
uses: eips-wg/build/.github/workflows/post-ci.yml@master
secrets: inherit
permissions:
issues: write
pull-requests: write
steps:
- name: Fetch PR Number
uses: dawidd6/action-download-artifact@20319c5641d495c8a52e688b7dc5fada6c3a9fbc # v8
with:
name: pr_number
workflow: ci.yml
run_id: ${{ github.event.workflow_run.id }}

- name: Save PR Data
id: save-pr-data
run: |
echo "pr_number=$(cat pr_number)" >> $GITHUB_OUTPUT
echo "pr_sha=$(cat pr_sha)" >> $GITHUB_OUTPUT
echo "merge_sha=$(cat merge_sha)" >> $GITHUB_OUTPUT
- name: Add Comment
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # 2.9.1
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
with:
number: ${{ steps.save-pr-data.outputs.pr_number }}
recreate: true
message: |
The commit ${{ steps.save-pr-data.outputs.pr_sha }} (as a parent of ${{ steps.save-pr-data.outputs.merge_sha }}) contains errors.
Please inspect the [Run Summary](${{ github.event.workflow_run.html_url }}) for details.
- name: Add Waiting Label
uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # 1.1.3
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
with:
labels: w-ci
number: ${{ steps.save-pr-data.outputs.pr_number }}
repo: ${{ github.repository }}
github_token: ${{ github.token }}

- name: Remove Waiting Label
uses: actions-ecosystem/action-remove-labels@d05162525702062b6bdef750ed8594fc024b3ed7
if: ${{ github.event.workflow_run.conclusion != 'failure' }}
with:
labels: w-ci
number: ${{ steps.save-pr-data.outputs.pr_number }}
repo: ${{ github.repository }}
github_token: ${{ github.token }}


35 changes: 32 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,40 @@ on:
- master

jobs:
build:
if: github.repository_owner == 'eips-wg'
name: Build Pages
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
with:
fetch-depth: 0

- name: EIPs Build (Build)
uses: ./.github/actions/build-eips
with:
args: build

- name: Upload Artifact
id: artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # 3.0.1
with:
path: build/output

publish:
if: github.repository_owner == 'eips-wg'
uses: eips-wg/build/.github/workflows/publish.yml@master
secrets: inherit
name: Publish Pages
runs-on: ubuntu-latest
needs: build
permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Publish Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # 4.0.5
50 changes: 47 additions & 3 deletions .github/workflows/review-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,52 @@ on:
types:
- created

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
review-trigger:
trigger:
if: github.event.repository.owner.login == 'eips-wg'
uses: eips-wg/build/.github/workflows/review-trigger.yml@master
secrets: inherit
runs-on: ubuntu-latest
name: Trigger Review
steps:
- name: Write PR Number - PR Target
run: echo $PR_NUMBER > pr-number.txt
env:
PR_NUMBER: ${{ github.event.number }}
if: |
github.event_name == 'pull_request_target' &&
!endsWith(github.event.sender.login, '-bot') &&
!endsWith(github.event.sender.login, '[bot]')
- name: Write PR Number - PR Review
run: echo $PR_NUMBER > pr-number.txt
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
if: |
github.event_name == 'pull_request_review' &&
!endsWith(github.event.sender.login, '-bot') &&
!endsWith(github.event.sender.login, '[bot]')
- name: Write PR Number - Workflow Dispatch
run: echo $PR_NUMBER > pr-number.txt
if: github.event_name == 'workflow_dispatch'
env:
PR_NUMBER: ${{ inputs.pr_number }}

- name: Write PR Number - Comment Retrigger
run: echo $PR_NUMBER > pr-number.txt
env:
PR_NUMBER: ${{ github.event.issue.number }}
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '@eth-bot rerun')
- name: Save PR Number
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
with:
name: pr-number
path: pr-number.txt
if-no-files-found: ignore
22 changes: 20 additions & 2 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ on:
jobs:
review:
if: github.event.repository.owner.login == 'eips-wg'
uses: eips-wg/build/.github/workflows/review.yml@master
secrets: inherit
runs-on: ubuntu-latest
name: Review
steps:
- name: Fetch PR Number
uses: dawidd6/action-download-artifact@20319c5641d495c8a52e688b7dc5fada6c3a9fbc # v8
with:
name: pr-number
workflow: review-trigger.yml
run_id: ${{ github.event.workflow_run.id }}

- name: Save PR Number
id: save-pr-number
run: echo "pr=$(cat pr-number.txt)" >> $GITHUB_OUTPUT

- name: Auto Review Bot
id: auto-review-bot
uses: ethereum/eip-review-bot@eips-wg-dist
continue-on-error: true
with:
token: ${{ secrets.TOKEN }}
pr_number: ${{ steps.save-pr-number.outputs.pr }}

0 comments on commit 9755a3d

Please sign in to comment.