Skip to content

Commit

Permalink
Migrate all Actions workflows to the maintenance/v1.x branch
Browse files Browse the repository at this point in the history
  • Loading branch information
steveluscher committed Dec 14, 2024
1 parent 52e144a commit ae2c091
Show file tree
Hide file tree
Showing 10 changed files with 309 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/0_bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Report a Bug
about: Help us reproduce a bug you've found so that we can fix it
title: ''
labels: ['bug']
assignees: ''
---

<!-- Please fill in each section completely. Thank you! -->

## Overview

<!-- Say a few words about how you came to discover this bug -->

## Steps to reproduce

<!--
List the steps that someone unfamiliar with your problem would
have to take to observe this bug.
Ideally, include a code snippet or link to a repository that
someone can run locally to reproduce the problem.
-->

## Description of bug

<!--
Describe what happened that you did not expect, or what did not
happen the way you had hoped.
Include the full text of error messages and logs, if any.
Do not upload screenshots of error messages.
-->
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/1_feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Suggest a Feature
about: Propose an idea for how to make this library better.
title: ''
labels: ['enhancement']
assignees: ''
---

<!-- Please fill in each section completely. Thank you! -->

## Motivation

<!--
Say a few words about what motivated you to propose this enhancement.
-->

## Example use case

<!--
Demonstrate how someone might use this new feature.
If applicable, write code or pseudocode that would produce the
desired result if this feature existed.
-->

## Details

<!--
Go into detail about how this new feature must behave. If you have
ideas on how to implement it, go into them here.
-->
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
contact_links:
- about: 'Have a question about using this software, or about Solana in general? Post it on the Solana Stack Exchange.'
name: Ask a Question
url: 'https://solana.stackexchange.com/questions/ask'
- about: 'Start or join a discussion on the Solana Tech Discord.'
name: Start a Discussion
url: 'https://solana.com/discord'
5 changes: 5 additions & 0 deletions .github/workflows/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### Problem

#### Summary of Changes

Fixes #
5 changes: 5 additions & 0 deletions .github/workflows/actions/compile-gh-pages/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ runs:
run: pnpm compile:docs

- name: Assemble Deploy Directory
shell: bash
run: |
mv ./doc/* .ghpages-deploy
- name: Assemble Deploy Versioned Subdirectory
shell: bash
run: |
mkdir -p .ghpages-deploy/v1.x
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/autolock-inactive-threads.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Lock inactive threads'

on:
# Chosen to be just before London wakes up and way past San Francisco's bedtime.
schedule:
- cron: '0 8 * * 1-5' # This is in UTC.
workflow_dispatch:

permissions:
issues: write
pull-requests: write

concurrency:
group: lock

jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v4
with:
github-token: ${{ github.token }}
issue-inactive-days: '7'
issue-lock-reason: 'resolved'
issue-comment: >
Because there has been no activity on this issue for 7 days since it was closed, it has
been automatically locked. Please open a new issue if it requires a follow up.
pr-inactive-days: '14'
pr-lock-reason: 'resolved'
pr-comment: >
Because there has been no activity on this PR for 14 days since it was merged, it has
been automatically locked. Please open a new issue if it requires a follow up.
15 changes: 15 additions & 0 deletions .github/workflows/label-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'Issue Label Actions'

on:
issues:
types: [labeled, unlabeled]

permissions:
contents: read
issues: write

jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/label-actions@v2
39 changes: 39 additions & 0 deletions .github/workflows/manage-stale-threads.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: 'Manage stale issues and PRs'
on:
# Chosen to be just before London wakes up and way past San Francisco's bedtime.
schedule:
- cron: '0 8 * * 1-5' # This is in UTC.
# Do a dry-run (debug-only: true) whenever this workflow itself is changed.
pull_request:
paths:
- .github/workflows/manage-stale-threads.yml
types:
- opened
- synchronize

permissions:
issues: write
pull-requests: write

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v6
with:
ascending: true # Spend API operations budget on older, more-likely-to-get-closed issues first
close-issue-message: '' # Leave no comment when closing
close-pr-message: '' # Leave no comment when closing
days-before-issue-stale: 365
days-before-pr-stale: 14
days-before-close: 7
debug-only: ${{ github.event_name == 'pull_request' }} # Dry-run when true.
exempt-all-milestones: true # Milestones can sometimes last a month, so exempt issues attached to a milestone.
exempt-issue-labels: blocked,do-not-close,feature-gate,security
exempt-pr-labels: blocked,do-not-close,feature-gate,security
# No actual changes get made in debug-only mode, so we can raise the operations ceiling.
operations-per-run: ${{ github.event_name == 'pull_request' && 1000 || 900}}
stale-issue-label: stale
stale-issue-message: '' # Leave no comment when marking as stale
stale-pr-label: stale
stale-pr-message: '' # Leave no comment when marking as stale
84 changes: 84 additions & 0 deletions .github/workflows/preview-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Preview GitHub Pages

on:
pull_request:
types: [synchronize, opened, reopened]

env:
# Among other things, opts out of Turborepo telemetry
# See https://consoledonottrack.com/
DO_NOT_TRACK: '1'
# Some tasks slow down considerably on GitHub Actions runners when concurrency is high
TURBO_CONCURRENCY: 1
# Enables Turborepo Remote Caching.
TURBO_REMOTE_CACHE_SIGNATURE_KEY: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

jobs:
compile-gh-pages:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: maintenance/v1.x

- name: Install Dependencies
uses: ./.github/workflows/actions/install-dependencies

- name: Compile and Upload Artifacts
uses: ./.github/workflows/actions/compile-gh-pages

preview:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
needs: [compile-gh-pages]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Dependencies
uses: ./.github/workflows/actions/install-dependencies

- name: Download Deploy Directory from Artifact Cache
uses: actions/download-artifact@v4
with:
path: .ghpages-deploy
pattern: ghpages-deploy-artifacts*
merge-multiple: true

- name: Deploy to Preview Github Pages
uses: peaceiris/actions-gh-pages@v4
with:
destination_dir: ${{ format('{0}/', github.event.pull_request.number) }}
external_repository: solana-labs/solana-web3.js-pr-preview
personal_token: ${{ secrets.PR_PREVIEW_REPO_CONTENTS_TOKEN }}
publish_dir: .ghpages-deploy

- name: Find Existing Preview Link Comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: <!-- GH_PAGES_PREVIEW_BOT_COMMENT -->

- name: Create Preview Link Comment
uses: actions/github-script@v7
if: steps.find-comment.outputs.comment-id == ''
with:
script: >
const prNumber = context.issue.number;
github.rest.issues.createComment({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: [
'<!-- GH_PAGES_PREVIEW_BOT_COMMENT -->',
'A preview of the GitHub Pages site based on this PR is now available here:',
'',
`<a href="https://solana-labs.github.io/solana-web3.js-pr-preview/${prNumber}/" rel="noopener noreferrer" target="_blank">solana-labs.github.io/solana-web3.js-pr-preview/${prNumber}/</a>`,
].join('\n'),
});
58 changes: 58 additions & 0 deletions .github/workflows/publish-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish GitHub Pages

on:
workflow_dispatch:
branches:
- maintenance/*
push:
branches:
- maintenance/*

env:
# Among other things, opts out of Turborepo telemetry
# See https://consoledonottrack.com/
DO_NOT_TRACK: '1'
# Some tasks slow down considerably on GitHub Actions runners when concurrency is high
TURBO_CONCURRENCY: 1
# Enables Turborepo Remote Caching.
TURBO_REMOTE_CACHE_SIGNATURE_KEY: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

jobs:
compile-gh-pages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: maintenance/v1.x

- name: Install Dependencies
uses: ./.github/workflows/actions/install-dependencies

- name: Compile and Upload Artifacts
uses: ./.github/workflows/actions/compile-gh-pages

publish:
runs-on: ubuntu-latest
needs: [compile-gh-pages]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Dependencies
uses: ./.github/workflows/actions/install-dependencies

- name: Download Deploy Directory from Artifact Cache
uses: actions/download-artifact@v4
with:
path: .ghpages-deploy
pattern: ghpages-deploy-artifacts*
merge-multiple: true

- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .ghpages-deploy

0 comments on commit ae2c091

Please sign in to comment.