Skip to content

Add xk6-proxy to support dynamic proxy settings #2567

Add xk6-proxy to support dynamic proxy settings

Add xk6-proxy to support dynamic proxy settings #2567

Workflow file for this run

name: Pull Request CI
env:
PATH_PREFIX: /docs/${{ github.ref }}
GATSBY_DEFAULT_MAIN_URL: https://staging.k6.io
GATSBY_DEFAULT_DOC_URL: https://mdr-ci.staging.k6.io/docs/${{ github.ref }}
GATSBY_DEFAULT_BLOG_URL: https://k6.io/blog
GATSBY_DEFAULT_APP_URL: https://app.staging.k6.io
GATSBY_NEWSLETTER_FORM_URL: https://go2.grafana.com
GATSBY_NEWSLETTER_FORM_MUNCHKIN_ID: 356-YFG-389
GATSBY_NEWSLETTER_FORM_ID: 1420
on:
pull_request:
branches: main
jobs:
update-dependencies:
name: Update node module dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Use Node.js 16.xs
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
lint:
name: Lint code
needs: [update-dependencies]
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Use Node.js 16.xs
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Check formatting
run: |
npm run format
- name: Lint code
run: |
npm run lint
- name: Lint code examples
run: |
npm run lint:examples
lint-prose:
name: Lint prose
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: errata-ai/vale-action@reviewdog
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
files: ./src/data/markdown
version: 2.17.0
fail_on_error: true
vale_flags: '--glob=**/{docs,translated-guides/en}/**/*.md'
build:
name: Build pull request
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v2
- name: Print build settings
run: |
echo "PATH_PREFIX: $PATH_PREFIX"
echo "GATSBY_DEFAULT_MAIN_URL: $GATSBY_DEFAULT_MAIN_URL"
echo "GATSBY_DEFAULT_DOC_URL: $GATSBY_DEFAULT_DOC_URL"
echo "GATSBY_DEFAULT_BLOG_URL: $GATSBY_DEFAULT_BLOG_URL"
echo "GATSBY_DEFAULT_APP_URL: $GATSBY_DEFAULT_APP_URL"
- name: Use Node.js 16.xs
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Install
run: npm install
- name: Build
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: k6-docs
path: public/
retention-days: 1
deploy:
name: Deploy pull request
runs-on: ubuntu-latest
needs: [build]
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.PR_CI_AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PR_CI_AWS_SECRET_KEY }}
AWS_REGION: 'eu-west-1'
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: k6-docs
path: public/
- name: Sync to S3
uses: jakejarvis/s3-sync-action@v0.5.1
with:
args: --delete
env:
AWS_S3_BUCKET: ${{ secrets.PR_CI_AWS_S3_BUCKET }}
SOURCE_DIR: public/
DEST_DIR: docs/${{ github.ref }}
- name: Invalidate Cloudfront
uses: chetan/invalidate-cloudfront-action@v1.2
env:
DISTRIBUTION: ${{ secrets.PR_CI_CLOUDFRONT_DISTRIBUTION_ID }}
PATHS: '/docs/*'
- name: Post published URL to PR
if: github.event.action == 'opened'
uses: actions/github-script@0.8.0
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.payload.number,
owner: context.repo.owner,
repo: context.repo.repo,
body:
"There's a version of the docs published here:\n\n" +
`${process.env.GATSBY_DEFAULT_DOC_URL}\n\n` +
'It will be deleted automatically in 30 days.',
})