Skip to content

Commit

Permalink
Merge branch 'master' into phated/lsp-wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Oct 18, 2023
2 parents b7997e3 + 3bb250e commit 43ec9dc
Show file tree
Hide file tree
Showing 1,013 changed files with 52,295 additions and 10,259 deletions.
22 changes: 22 additions & 0 deletions .github/actions/docs/build-status/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Get build status'
description: 'Gets the build status of a Netlify site'
inputs:
branch-name:
description: 'Branch name'
required: true
site-id:
description: Netlify site id
required: true
outputs:
deploy_status:
description: "The deploy status"
value: ${{ steps.check_deploy_status.outputs.deploy_status }}
runs:
using: "composite"
steps:
- run: ${{ github.action_path }}/script.sh
shell: bash
id: check_deploy_status
env:
BRANCH_NAME: ${{ inputs.branch-name }}
SITE_ID: ${{ inputs.site-id }}
28 changes: 28 additions & 0 deletions .github/actions/docs/build-status/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

BRANCH_NAME=$(echo "$BRANCH_NAME" | sed -e "s#refs/[^/]*/##")
DEPLOY_STATUS=$(curl -X GET "https://api.netlify.com/api/v1/sites/$SITE_ID/deploys?branch=$BRANCH_NAME" | jq -r '.[] | select(.created_at != null) | .state' | head -1)

echo "$SITE_ID"
MAX_RETRIES=10
COUNT=0
while [[ "$DEPLOY_STATUS" != "ready" && $COUNT -lt $MAX_RETRIES ]]; do
sleep 20
DEPLOY_STATUS=$(curl -X GET "https://api.netlify.com/api/v1/sites/$SITE_ID/deploys?branch=$BRANCH_NAME" | jq -r '.[] | select(.created_at != null) | .state' | head -1)
COUNT=$((COUNT+1))

echo "Deploy status: $DEPLOY_STATUS"
# If deploy status is ready, set the output and exit successfully
if [[ "$DEPLOY_STATUS" == "ready" ]]; then
echo "deploy_status=success" >> $GITHUB_OUTPUT
exit 0
elif [[ "$DEPLOY_STATUS" == "error" ]]; then
echo "deploy_status=failure" >> $GITHUB_OUTPUT
exit 0
fi

echo "Deploy still running. Retrying..."
done

echo "deploy_status=failure" >> $GITHUB_OUTPUT
exit 0
27 changes: 27 additions & 0 deletions .github/actions/nix/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Setup Nix
description: Installs and setups Nix components

inputs:
github-token:
description: 'Github Access Token'
required: true
nix-cache-name:
description: 'Name of the Cachix cache to use'
required: true
cachix-auth-token:
description: 'Cachix Auth Token'
required: true


runs:
using: composite
steps:
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-23.05
github_access_token: ${{ inputs.github-token }}

- uses: cachix/cachix-action@v12
with:
name: ${{ inputs.nix-cache-name }}
authToken: ${{ inputs.cachix-auth-token }}
3 changes: 0 additions & 3 deletions .github/labeler.yml

This file was deleted.

89 changes: 89 additions & 0 deletions .github/workflows/auto-pr-rebuild-script.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Rebuild ACIR artifacts

on:
push:
branches:
- master

jobs:
build-nargo:
runs-on: ubuntu-22.04
strategy:
matrix:
target: [x86_64-unknown-linux-gnu]

steps:
- name: Checkout Noir repo
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.66.0

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Build Nargo
run: cargo build --package nargo_cli --release

- name: Package artifacts
run: |
mkdir dist
cp ./target/release/nargo ./dist/nargo
7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: nargo
path: ./dist/*
retention-days: 3

auto-pr-rebuild-script:
needs: [build-nargo]
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Download nargo binary
uses: actions/download-artifact@v3
with:
name: nargo
path: ./nargo

- name: Add Nargo to $PATH
run: |
chmod +x ${{ github.workspace }}/nargo/nargo
echo "${{ github.workspace }}/nargo" >> $GITHUB_PATH
- name: Set up Git user (Github Action)
run: |
git config --local user.name kevaundray
git config --local user.email kevtheappdev@gmail.com
- name: Run rebuild script
working-directory: tooling/nargo_cli/tests
run: |
chmod +x ./rebuild.sh
./rebuild.sh
- name: Check for changes in acir_artifacts directory
id: check_changes
run: |
git diff --quiet tooling/nargo_cli/tests/acir_artifacts/ || echo "::set-output name=changes::true"
- name: Create or Update PR
if: steps.check_changes.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.NOIR_REPO_TOKEN }}
commit-message: "chore: update acir artifacts"
title: "chore: Update ACIR artifacts"
body: "Automatic PR to update acir artifacts"
add-paths: tooling/nargo_cli/tests/acir_artifacts/*.gz
labels: "auto-pr"
branch: "auto-pr-rebuild-script-branch"
96 changes: 96 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Build docs

on:
pull_request:
paths:
- 'docs/**'
types:
- opened
- synchronize
- labeled
push:
paths:
- 'docs/**'

jobs:

build_and_deploy:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: contains(github.event.pull_request.labels.*.name, 'documentation')
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Netlify deploy
run: |
BRANCH_NAME=$(echo "${{ github.head_ref || github.ref }}" | sed -e "s#refs/[^/]*/##")
curl -X POST -d {} "https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_BUILD_HOOK }}?trigger_branch=$BRANCH_NAME"
- name: Get deploy preview
id: get_deploy_preview
run: |
BRANCH_NAME=$(echo "${{ github.head_ref || github.ref }}" | sed -e "s#refs/[^/]*/##")
curl -X GET "https://api.netlify.com/api/v1/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys?branch=$BRANCH_NAME" > deploy.json
echo "::set-output name=deploy_url::$(cat deploy.json | jq -r '.[0].deploy_ssl_url')"
- name: Add PR Comment
uses: mshick/add-pr-comment@v2
with:
message: |
Hey @${{ github.event.pull_request.user.login }}! 🙌
I'm the deployment bot for Noir Docs, and I've got some updates for you:
## Deployment Status
Your latest changes are being deployed for preview! 🚀
Click the badge to see logs 🧐
[![Netlify Status](https://api.netlify.com/api/v1/badges/${{ secrets.NETLIFY_SITE_ID }}/deploy-status?branch=${{ github.head_ref || github.ref }})](https://app.netlify.com/sites/noir-docs-v2/deploys)
If you have any questions about this process, refer to our contribution guide or feel free to ask around.
- name: Check on deploy status
uses: ./.github/actions/docs/build-status
id: check_deploy_status
with:
branch-name: ${{ github.head_ref || github.ref }}
site-id: ${{ secrets.NETLIFY_SITE_ID }}
continue-on-error: true

- name: Debugging - print deploy_status
run: echo "${{ steps.check_deploy_status.outputs.deploy_status }}"

- name: Change PR Comment for Successful Deployment
if: steps.check_deploy_status.outputs.deploy_status == 'success'
uses: mshick/add-pr-comment@v2
with:
message-success: |
![It's Alive!](https://i.imgflip.com/82hw5n.jpg)
I'm a bot, beep boop 🤖
## Deployment Status: Success!
[![Netlify Status](https://api.netlify.com/api/v1/badges/${{ secrets.NETLIFY_SITE_ID }}/deploy-status?branch=${{ github.head_ref || github.ref }})](https://app.netlify.com/sites/noir-docs-v2/deploys)
## Preview
🌐 [View Deployment Preview](${{ steps.get_deploy_preview.outputs.deploy_url }})
- name: Change PR Comment for Failed Deployment
if: steps.check_deploy_status.outputs.deploy_status == 'failure'
uses: mshick/add-pr-comment@v2
with:
message: |
![docs CI troll](https://i.imgflip.com/82ht8f.jpg)
I'm a bot, beep boop 🤖
## Deployment Status: Failed ❌
Deployment didn't succeed. Please check logs below and resolve the issue 🧐
[![Netlify Status](https://api.netlify.com/api/v1/badges/${{ secrets.NETLIFY_SITE_ID }}/deploy-status?branch=${{ github.head_ref || github.ref }})](https://app.netlify.com/sites/noir-docs-v2/deploys)
45 changes: 0 additions & 45 deletions .github/workflows/labeler.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/lockfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lockfile check

on:
pull_request:

# This will cancel previous runs when a branch or PR is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true

jobs:
yarn-lock:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Checkout
uses: actions/checkout@v4

# Errors if installation would result in modifications to yarn.lock
- name: Install
run: yarn --immutable
shell: bash
51 changes: 0 additions & 51 deletions .github/workflows/publish-abi_wasm.yml

This file was deleted.

Loading

0 comments on commit 43ec9dc

Please sign in to comment.