Skip to content

ci(pre-commit): use upstream buildifier #563

ci(pre-commit): use upstream buildifier

ci(pre-commit): use upstream buildifier #563

Workflow file for this run

# Copyright (c) 2024 RapidStream Design Automation, Inc. and contributors.
# All rights reserved. The contributor(s) of this file has/have agreed to the
# RapidStream Contributor License Agreement.
name: Development Branches
on:
push:
branches-ignore:
- main
- release
- release/*
permissions:
actions: write
contents: write
jobs:
pre-commit:
name: Pre-Commit
runs-on: self-hosted
steps:
- name: Checkout myself
uses: actions/checkout@v4
- name: Run pre-commit
uses: ./.github/actions/run-command
with:
run: pre-commit run --all-files
env:
UBUNTU_PRO_TOKEN: ${{ secrets.UBUNTU_PRO_TOKEN }}
MAC_ADDRESS: ${{ secrets.MAC_ADDRESS }}
test:
name: Bazel Test
runs-on: self-hosted
steps:
- name: Checkout myself
uses: actions/checkout@v4
- name: Run bazel
uses: ./.github/actions/run-command
with:
run: bazel test //...
env:
UBUNTU_PRO_TOKEN: ${{ secrets.UBUNTU_PRO_TOKEN }}
MAC_ADDRESS: ${{ secrets.MAC_ADDRESS }}
# TODO: integrate into bazel
docs:
name: Bulid Documentations
runs-on: ubuntu-latest
steps:
- name: Checkout myself
uses: actions/checkout@v4
- name: Install dependencies
run: |
set -e
sudo apt-get update
sudo apt-get install -y doxygen
python3 -m pip install --user -r tapa/requirements_lock.txt
python3 -m pip install --user -r docs/requirements.txt
- name: Build docs
run: |
set -e
python3 -m sphinx \
--fail-on-warning \
--keep-going \
--show-traceback \
--define language=en \
. ../build/docs/html
working-directory: docs
env:
READTHEDOCS: "True"
all-required-branch-checks:
name: All Required Branch Checks
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- pre-commit
- test
- docs
steps:
- name: Checkout myself
uses: actions/checkout@v4
- name: Check if all required jobs are green
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
auto-merge-if-checks-pass:
name: Auto-Merge Branch if Checks Pass
runs-on: ubuntu-latest
needs:
- all-required-branch-checks
if: >
!github.event.act &&
startsWith(github.ref, 'refs/heads/') &&
endsWith(github.ref, '/next') &&
needs.All-Required-Branch-Checks.result == 'success'
steps:
- name: Checkout myself
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Try to merge into main
id: merge
run: >
git checkout main &&
git merge --ff-only ${{ github.ref_name }} &&
git push &&
echo "is-successful=true" >>"${GITHUB_OUTPUT}" ||
echo "is-successful=false" >>"${GITHUB_OUTPUT}"
shell: bash
- name: Trigger staging build
uses: benc-uk/workflow-dispatch@v1
if: ${{ steps.merge.outputs.is-successful == 'true' }}
with:
workflow: Staging Build
ref: refs/heads/main