mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
ci: move all old workflow
This commit is contained in:
70
.github/oldWorkflows/benchmark.yml
vendored
Normal file
70
.github/oldWorkflows/benchmark.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
name: Benchmark
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
benchmark:
|
||||
name: Benchmark
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: denoland/setup-deno@main
|
||||
with:
|
||||
deno-version: v1.x
|
||||
|
||||
# this is the performance benchmark
|
||||
- name: Cache deps
|
||||
run: deno cache performance/mod.ts
|
||||
- name: Download sysbench
|
||||
run: sudo apt-get install -y sysbench
|
||||
- name: Run Benchmark
|
||||
run: NO_COLOR=true deno bench --unstable -A performance/mod.ts | tee output.txt
|
||||
- name: Format Benchmark Output
|
||||
run: deno run --unstable -A performance/tranformOutput.ts
|
||||
|
||||
# this is the memory benchmark
|
||||
- name: Download db from benchmark repo
|
||||
run: wget https://github.com/discordeno/benchmarks/raw/main/db.tar.gz
|
||||
- name: Decompress db
|
||||
run: tar -xzvf db.tar.gz
|
||||
- name: Run memory benchmark
|
||||
run: deno run --v8-flags="--expose-gc" -A performance/memory.ts
|
||||
|
||||
- name: Download previous benchmark data
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ./benchmarksResult
|
||||
key: ${{ github.ref }}-benchmark
|
||||
- name: Store benchmark result to cache
|
||||
uses: benchmark-action/github-action-benchmark@v1
|
||||
with:
|
||||
tool: "customSmallerIsBetter"
|
||||
output-file-path: output.txt
|
||||
external-data-json-path: benchmarksResult/data.json
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: benchmarkResults
|
||||
path: benchmarksResult/data.json
|
||||
|
||||
- name: Store benchmark result (Main)
|
||||
uses: benchmark-action/github-action-benchmark@v1
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
with:
|
||||
tool: "customSmallerIsBetter"
|
||||
output-file-path: output.txt
|
||||
gh-pages-branch: "benchies"
|
||||
benchmark-data-dir-path: benchmarksResult
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
auto-push: true
|
||||
|
||||
- name: Save Commmit SHA
|
||||
run: |
|
||||
mkdir -p ./commitData
|
||||
echo ${{ github.event.pull_request.head.sha }} > ./commitData/sha
|
||||
echo ${{ github.event.pull_request.head.repo.full_name }} > ./commitData/repo
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: commitData
|
||||
path: commitData/
|
||||
96
.github/oldWorkflows/commentBenchResult.yml
vendored
Normal file
96
.github/oldWorkflows/commentBenchResult.yml
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
name: Comment Benchmark Result
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [Benchmark]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
comment-benchmark-result:
|
||||
name: Comment Benchmark Result
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: denoland/setup-deno@main
|
||||
with:
|
||||
deno-version: v1.x
|
||||
- name: Download Commit Data Artifact
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: context.payload.workflow_run.id,
|
||||
});
|
||||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
|
||||
return artifact.name == "commitData"
|
||||
})[0];
|
||||
let download = await github.rest.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: matchArtifact.id,
|
||||
archive_format: 'zip',
|
||||
});
|
||||
let fs = require('fs');
|
||||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/commitData.zip`, Buffer.from(download.data));
|
||||
|
||||
- name: Unzip Commit Data Artifact
|
||||
run: unzip commitData.zip
|
||||
|
||||
- name: Download Result Artifact
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: context.payload.workflow_run.id,
|
||||
});
|
||||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
|
||||
return artifact.name == "benchmarkResults"
|
||||
})[0];
|
||||
let download = await github.rest.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: matchArtifact.id,
|
||||
archive_format: 'zip',
|
||||
});
|
||||
let fs = require('fs');
|
||||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/benchmarkResults.zip`, Buffer.from(download.data));
|
||||
|
||||
- name: Unzip Result Artifact
|
||||
run: unzip benchmarkResults.zip
|
||||
|
||||
- name: Generate Message
|
||||
id: genMessage
|
||||
run: |
|
||||
MESSAGE=$(deno run -A performance/generateMessage.ts)
|
||||
echo "MESSAGE<<EOF" >> $GITHUB_ENV
|
||||
echo "$MESSAGE" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: "Comment on PR"
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const commit_sha = fs.readFileSync('./sha', 'utf-8');
|
||||
const repo = fs.readFileSync('./repo', 'utf-8');
|
||||
if (repo.split('/')[1] === undefined) process.exit(0)
|
||||
const pr = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
||||
commit_sha: commit_sha.slice(0,-1),
|
||||
owner: repo.split('/')[0],
|
||||
repo: repo.split('/')[1].slice(0,-1),
|
||||
});
|
||||
if (pr.data[0]) {
|
||||
github.rest.issues.createComment({
|
||||
issue_number: pr.data[0].number,
|
||||
owner: "discordeno",
|
||||
repo: "discordeno",
|
||||
body: `${{ env.MESSAGE }}`
|
||||
})
|
||||
}
|
||||
32
.github/oldWorkflows/fmt.yml
vendored
Normal file
32
.github/oldWorkflows/fmt.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
name: Automatically format the code when requested
|
||||
|
||||
on: issue_comment
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
deno: ["v1.x"]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git submodule update --init --recursive
|
||||
- uses: denoland/setup-deno@main
|
||||
with:
|
||||
deno-version: ${{ matrix.deno }}
|
||||
- name: Cache dependencies
|
||||
run: deno cache mod.ts
|
||||
- name: Cache Templates
|
||||
run: deno cache template/beginner/mod.ts template/minimal/mod.ts
|
||||
- name: Format code
|
||||
if: ${{ github.event.issue.pull_request && github.event.comment.body == 'run-fmt' && (github.actor == 'Skillz4Killz' || github.actor == 'itohatweb') }}
|
||||
run: deno fmt
|
||||
- name: Push changes
|
||||
if: ${{ github.event.issue.pull_request && github.event.comment.body == 'run-fmt' && (github.actor == 'Skillz4Killz' || github.actor == 'itohatweb') }}
|
||||
continue-on-error: true # if code is unchanged it will error
|
||||
run: |
|
||||
git config user.name Github Actions
|
||||
git config user.email github-actions@github.com
|
||||
git add .
|
||||
git commit -m "chore: Format code"
|
||||
git push
|
||||
33
.github/oldWorkflows/pr_tests.yml
vendored
Normal file
33
.github/oldWorkflows/pr_tests.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Test Contributor Pull Requests
|
||||
|
||||
on: issue_comment
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
deno: ["v1.x"]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git submodule update --init --recursive
|
||||
- uses: denoland/setup-deno@main
|
||||
with:
|
||||
deno-version: ${{ matrix.deno }}
|
||||
- name: Cache dependencies
|
||||
run: deno cache mod.ts
|
||||
- name: Run tests if requested by maintainers
|
||||
if: ${{ github.event.issue.pull_request && github.event.comment.body == 'run-tests' && (github.actor == 'Skillz4Killz' || github.actor == 'itohatweb') }}
|
||||
run: DISCORD_TOKEN=${{ env.DISCORD_TOKEN }} deno test --coverage=coverage -A tests/ --parallel
|
||||
env:
|
||||
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
||||
- name: Create coverage report
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: deno coverage --exclude=tests ./coverage --lcov > coverage.lcov
|
||||
- name: Collect and upload the coverage report
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: codecov/codecov-action@v1.0.10
|
||||
with:
|
||||
file: ./coverage.lcov
|
||||
env:
|
||||
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
||||
37
.github/oldWorkflows/release.yml
vendored
Normal file
37
.github/oldWorkflows/release.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
deno: ["v1.x"]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: denoland/setup-deno@main
|
||||
with:
|
||||
deno-version: ${{ matrix.deno }}
|
||||
- name: Get last tag version
|
||||
run: |
|
||||
echo "DISCORDENO_VERSION_OLD=$(wget -O- -q https://deno.land/x/discordeno/util/constants.ts | grep 'export const DISCORDENO_VERSION' | awk -F'= ' '{print $2}' | tr -d '"|;')" >> $GITHUB_ENV
|
||||
- name: Get new tag version
|
||||
run: echo "DISCORDENO_VERSION=$(cat util/constants.ts | grep 'export const DISCORDENO_VERSION' | awk -F'= ' '{print $2}' | tr -d '"|;')" >> $GITHUB_ENV
|
||||
- name: Create tag
|
||||
if: ${{ env.DISCORDENO_VERSION != env.DISCORDENO_VERSION_OLD }}
|
||||
run: git tag ${{ env.DISCORDENO_VERSION }} && git push --tags
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "16.x"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
- name: build npm
|
||||
run: deno run -A ./dnt.ts ${{ env.DISCORDENO_VERSION }}
|
||||
- name: npm publish
|
||||
if: ${{ env.DISCORDENO_VERSION != env.DISCORDENO_VERSION_OLD }}
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: cd npm && npm publish
|
||||
23
.github/oldWorkflows/site_tests.yml
vendored
Normal file
23
.github/oldWorkflows/site_tests.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: Test Docusaurus build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "site/**"
|
||||
|
||||
jobs:
|
||||
test-deploy:
|
||||
name: Test deployment
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.x
|
||||
cache: npm
|
||||
cache-dependency-path: site/package-lock.json
|
||||
- name: Test build
|
||||
working-directory: site
|
||||
run: |
|
||||
npm ci
|
||||
npm run build
|
||||
24
.github/oldWorkflows/sync_repos.yml
vendored
Normal file
24
.github/oldWorkflows/sync_repos.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Sync Repos
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "site/**"
|
||||
- "template/**"
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@master
|
||||
- name: Run GitHub File Sync
|
||||
uses: BetaHuhn/repo-file-sync-action@v1
|
||||
with:
|
||||
GH_PAT: ${{ secrets.REPO_SYNC }}
|
||||
GIT_EMAIL: to@itoh.at
|
||||
GIT_USERNAME: itohatweb
|
||||
SKIP_PR: true
|
||||
COMMIT_EACH_FILE: false
|
||||
27
.github/oldWorkflows/validateCache.yml
vendored
Normal file
27
.github/oldWorkflows/validateCache.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Validate Cache
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
validate-cache:
|
||||
name: Validate Cache
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: "benchies"
|
||||
- uses: denoland/setup-deno@main
|
||||
with:
|
||||
deno-version: "v1.x"
|
||||
- name: Check And Update Objects
|
||||
run: deno run -A cache/checkAndUpdateObjects.ts
|
||||
env:
|
||||
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
||||
- name: Commit and push
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
add: cache/cachedObject
|
||||
message: "[Scheduled] Auto patch objects"
|
||||
Reference in New Issue
Block a user