summaryrefslogtreecommitdiffstats
path: root/src/doc/rustc-dev-guide/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/rustc-dev-guide/.github/workflows')
-rw-r--r--src/doc/rustc-dev-guide/.github/workflows/ci.yml80
-rw-r--r--src/doc/rustc-dev-guide/.github/workflows/date-check.yml49
2 files changed, 129 insertions, 0 deletions
diff --git a/src/doc/rustc-dev-guide/.github/workflows/ci.yml b/src/doc/rustc-dev-guide/.github/workflows/ci.yml
new file mode 100644
index 000000000..c571d408d
--- /dev/null
+++ b/src/doc/rustc-dev-guide/.github/workflows/ci.yml
@@ -0,0 +1,80 @@
+name: CI
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ schedule:
+ # Run at 18:00 UTC every day
+ - cron: '0 18 * * *'
+
+jobs:
+ ci:
+ if: github.repository == 'rust-lang/rustc-dev-guide'
+ runs-on: ubuntu-latest
+ env:
+ MDBOOK_VERSION: 0.4.12
+ MDBOOK_LINKCHECK_VERSION: 0.7.2
+ MDBOOK_MERMAID_VERSION: 0.10.0
+ MDBOOK_TOC_VERSION: 0.6.1
+ DEPLOY_DIR: book/html
+ BASE_SHA: ${{ github.event.pull_request.base.sha }}
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ # linkcheck needs the base commit.
+ fetch-depth: 0
+
+ - name: Cache binaries
+ id: mdbook-cache
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.cargo/bin
+ key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }}
+
+ - name: Cache linkcheck
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/book/linkcheck
+ key: ${{ runner.os }}-${{ hashFiles('./book/linkcheck') }}
+
+ - name: Check line lengths
+ if: github.event_name != 'push'
+ run: |
+ shopt -s globstar
+ MAX_LINE_LENGTH=100 bash ci/check_line_lengths.sh src/**/*.md
+
+ - name: Install latest nightly Rust toolchain
+ if: steps.mdbook-cache.outputs.cache-hit != 'true'
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: nightly
+ override: true
+
+ - name: Install Dependencies
+ if: steps.mdbook-cache.outputs.cache-hit != 'true'
+ run: |
+ cargo install mdbook --version ${{ env.MDBOOK_VERSION }}
+ cargo install mdbook-linkcheck --version ${{ env.MDBOOK_LINKCHECK_VERSION }}
+ cargo install mdbook-toc --version ${{ env.MDBOOK_TOC_VERSION }}
+ cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }}
+
+ - name: Check build
+ run: mdbook build
+
+ - name: Deploy to gh-pages
+ if: github.event_name == 'push'
+ run: |
+ touch "${{ env.DEPLOY_DIR }}/.nojekyll"
+ cp CNAME "${{ env.DEPLOY_DIR }}"
+ cd "${{ env.DEPLOY_DIR }}"
+ rm -rf .git
+ git init
+ git config user.name "Deploy from CI"
+ git config user.email ""
+ git add .
+ git commit -m "Deploy ${GITHUB_SHA} to gh-pages"
+ git push --quiet -f "https://x-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}" HEAD:gh-pages
diff --git a/src/doc/rustc-dev-guide/.github/workflows/date-check.yml b/src/doc/rustc-dev-guide/.github/workflows/date-check.yml
new file mode 100644
index 000000000..b808876a4
--- /dev/null
+++ b/src/doc/rustc-dev-guide/.github/workflows/date-check.yml
@@ -0,0 +1,49 @@
+name: Date-Check
+
+on:
+ schedule:
+ # Run at noon UTC every 1st of the month
+ - cron: '00 12 01 * *'
+
+ # Allow manually starting the workflow
+ workflow_dispatch:
+
+jobs:
+ date-check:
+ if: github.repository == 'rust-lang/rustc-dev-guide'
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v2
+
+ - name: Ensure Rust is up-to-date
+ run: |
+ rustup update stable
+
+ - name: Run `date-check`
+ working-directory: ci/date-check
+ run: |
+ cargo run -- ../../src/ > ../../date-check-output.txt
+
+ - name: Open issue
+ uses: actions/github-script@v3
+ with:
+ github-token: ${{secrets.GITHUB_TOKEN}}
+ script: |
+ const fs = require('fs');
+
+ const rawText = fs.readFileSync('date-check-output.txt', { encoding: 'utf8' });
+ const title = rawText.split('\n')[0];
+ if (title != 'empty') {
+ const body = rawText.split('\n').slice(1).join('\n');
+ github.issues.create({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ title,
+ body,
+ });
+ console.log('Opened issue.');
+ } else {
+ console.log('No dates to triage.');
+ }