[audio] Time measurements should all be in seconds (#33320) #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docs Website PR | |
defaults: | |
run: | |
shell: bash | |
working-directory: docs | |
on: | |
workflow_dispatch: {} | |
push: | |
paths: | |
- '.github/workflows/docs-pr.yml' | |
- '.github/workflows/docs-pr-destroy.yml' | |
pull_request: | |
paths: | |
- 'docs/**' | |
- '.github/workflows/docs-pr.yml' | |
- '.github/workflows/docs-pr-destroy.yml' | |
types: | |
- opened | |
- labeled | |
- synchronize | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
docs-pr: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: 👀 Checkout | |
uses: actions/checkout@v4 | |
- name: ⬢ Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: ♻️ Restore caches | |
uses: ./.github/actions/expo-caches | |
id: expo-caches | |
with: | |
yarn-docs: 'true' | |
- name: ➕ Add `bin` to GITHUB_PATH | |
run: echo "$(pwd)/bin" >> $GITHUB_PATH | |
- name: 🧶 Yarn install | |
if: steps.expo-caches.outputs.yarn-docs-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: 🧪 Run Docs tests | |
run: yarn test | |
- name: 🚨 Lint Docs website code | |
env: | |
NODE_ENV: production | |
run: yarn lint --max-warnings 0 | |
- name: 💬 Lint Docs website content | |
uses: errata-ai/vale-action@reviewdog | |
with: | |
reporter: github-pr-check | |
files: 'docs/pages' | |
vale_flags: '--config=./docs/.vale.ini' | |
fail_on_error: true | |
- name: 🏗️ Build Docs website | |
run: yarn export-preview | |
timeout-minutes: 20 | |
env: | |
AWS_BUCKET: 'docs.expo.dev-pr-${{ github.event.pull_request.number }}' | |
- name: 🔗 Lint pages links | |
working-directory: docs | |
run: yarn lint-links --quiet | |
- name: 🪣 Set up docs preview bucket | |
if: contains(github.event.pull_request.labels.*.name, 'preview') | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: 'us-east-1' | |
run: | | |
# Create bucket | |
aws s3api create-bucket --bucket docs.expo.dev-pr-${{ github.event.pull_request.number }} | |
# Set "block public access" to off | |
aws s3api put-public-access-block --bucket docs.expo.dev-pr-${{ github.event.pull_request.number }} --public-access-block-configuration "BlockPublicAcls=false,IgnorePublicAcls=false,BlockPublicPolicy=false,RestrictPublicBuckets=false" | |
# Set bucket policy to public | |
aws s3api put-bucket-policy --bucket docs.expo.dev-pr-${{ github.event.pull_request.number }} --policy "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::docs.expo.dev-pr-${{ github.event.pull_request.number }}/*\"}]}" | |
# Tag bucket to tell compliance monitoring that it is intended to be public | |
aws s3api put-bucket-tagging --bucket docs.expo.dev-pr-${{ github.event.pull_request.number }} --tagging "{\"TagSet\":[{\"Key\":\"DrataExclude\",\"Value\":\"This is a test instance of our public docs page and is intended to be public.\"}]}" | |
# Set up static website hosting | |
aws s3 website s3://docs.expo.dev-pr-${{ github.event.pull_request.number }}/ --index-document index.html | |
- name: 🚀 Deploy Docs website | |
if: contains(github.event.pull_request.labels.*.name, 'preview') | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: 'us-east-1' | |
AWS_BUCKET: docs.expo.dev-pr-${{ github.event.pull_request.number }} | |
run: ./deploy.sh | |
- name: 🔍 Find old comment if it exists | |
if: contains(github.event.pull_request.labels.*.name, 'preview') | |
uses: peter-evans/find-comment@v3 | |
id: old_comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'expo-bot' | |
body-includes: 📘 Your docs | |
- name: 💬 Add comment with preview URL | |
if: contains(github.event.pull_request.labels.*.name, 'preview') && steps.old_comment.outputs.comment-id == '' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '📘 Your docs [preview website](http://docs.expo.dev-pr-${{ github.event.pull_request.number }}.s3-website-us-east-1.amazonaws.com/) is ready!' | |
}); | |
- name: 💬 Update comment with preview URL | |
if: contains(github.event.pull_request.labels.*.name, 'preview') && steps.old_comment.outputs.comment-id != '' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.EXPO_BOT_GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.updateComment({ | |
issue_number: context.issue.number, | |
comment_id: '${{ steps.old_comment.outputs.comment-id }}', | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '📘 Your docs [preview website](http://docs.expo.dev-pr-${{ github.event.pull_request.number }}.s3-website-us-east-1.amazonaws.com/) is ready!' | |
}); |