chore: Add build profiles that optimize for size #207
Workflow file for this run
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: Deploy preview for PR | |
on: | |
pull_request: | |
jobs: | |
add_label: | |
runs-on: ubuntu-latest | |
outputs: | |
has_label: ${{ steps.check-labels.outputs.result }} | |
steps: | |
- name: Check if label is present | |
id: check-labels | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const labels = context.payload.pull_request.labels.map(label => label.name); | |
if (labels.includes('documentation')) { | |
return true; | |
} | |
// Fetch the list of files changed in the PR | |
const { data: files } = await github.pulls.listFiles({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number | |
}); | |
// Check if any file is within the 'docs' folder | |
const docsChanged = files.some(file => file.filename.startsWith('docs/')); | |
return docsChanged; | |
- name: Add label if not present | |
if: steps.check-labels.outputs.result == 'true' | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const labels = context.payload.pull_request.labels.map(label => label.name); | |
if (!labels.includes('documentation')) { | |
github.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
labels: ['documentation'] | |
}) | |
} | |
build_and_deploy_preview: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
needs: add_label | |
if: needs.add_label.outputs.has_label == 'true' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Install wasm-bindgen-cli | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: wasm-bindgen-cli@0.2.86 | |
- name: Install wasm-opt | |
run: | | |
npm i wasm-opt -g | |
- name: Install dependencies | |
run: yarn | |
- name: Build acvm_js | |
run: yarn workspace @noir-lang/acvm_js build | |
- name: Build noirc_abi | |
run: yarn workspace @noir-lang/noirc_abi build | |
- name: Build noir_js_types | |
run: yarn workspace @noir-lang/types build | |
- name: Build barretenberg wrapper | |
run: yarn workspace @noir-lang/backend_barretenberg build | |
- name: Run noir_js | |
run: | | |
yarn workspace @noir-lang/noir_js build | |
- name: Remove pre-releases | |
working-directory: docs | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: yarn setStable | |
- name: Build docs | |
run: | |
yarn workspace docs build | |
- name: Deploy to Netlify | |
uses: nwtgck/actions-netlify@v2.1 | |
with: | |
publish-dir: './docs/build' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
enable-github-deployment: false | |
deploy-message: "Deploy from GitHub Actions for PR ${{ github.event.number }}" | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
timeout-minutes: 1 |