Skip to content

Support of is_net_port and is_host_port externs. #26

Support of is_net_port and is_host_port externs.

Support of is_net_port and is_host_port externs. #26

Workflow file for this run

name: Build Doxygen and deploy to GitHub Pages
permissions:
actions: read
contents: write
pages: write
issues: write
pull-requests: write
on:
push:
branches:
- main
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review, labeled]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
DOXYGEN_VERSION: 1.12.0
DOXYGEN_AWESOME_VERSION: 2.3.3
PR_PATH: pr-preview/${{ github.event.number }}
DOMAIN: p4lang.github.io
DEPLOYMENT: '<img src="https://github.com/user-attachments/assets/f94fada5-45ca-4271-9106-180728235ad2" alt="Rocket" width="25"/>'
CELEBRATION: '<img src="https://github.com/user-attachments/assets/86eb8470-c597-4f8b-a77d-a54036075271" alt="githubloading" width="25"/>'
FAILURE_ICON: '<img src="https://github.com/user-attachments/assets/af921ba9-953d-465e-b597-64ed0a2dc921" alt="failed" width="25"/>'
COMMENT_IDENTIFIER: '<!-- preview-comment -->'
concurrency: ci-${{ github.ref }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check PR Label
id: check-label
if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/github-script@v7
with:
script: |
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
const hasDocumentationLabel = labels.some(label => label.name === 'documentation');
return hasDocumentationLabel;
- name: Find Existing Comment
if: ${{ github.event_name == 'pull_request_target' && steps.check-label.outputs.result == 'true' }}
id: find-comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: ${{ env.COMMENT_IDENTIFIER }}
- name: Post Initial Comment
if: ${{ github.event_name == 'pull_request_target' && steps.check-label.outputs.result == 'true' && steps.find-comment.outputs.comment-id == '' }}
id: post-initial-comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
**Deployment of preview started...** ${{ env.DEPLOYMENT }}
${{ env.COMMENT_IDENTIFIER }}
- name: Update Comment to In-Progress
if: ${{ github.event_name == 'pull_request_target' && steps.check-label.outputs.result == 'true' && steps.find-comment.outputs.comment-id != '' }}
id: update-in-progress-comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
**Deployment in progress...** ${{ env.DEPLOYMENT }}
${{ env.COMMENT_IDENTIFIER }}
edit-mode: replace
- name: Track intial Comment
if: ${{ github.event_name == 'pull_request_target' && steps.check-label.outputs.result == 'true' }}
id: find-comment2
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: ${{ env.COMMENT_IDENTIFIER }}
- name: Install Clang
if: ${{ github.event_name == 'push' || steps.check-label.outputs.result == 'true' }}
run: |
sudo apt-get update
sudo apt-get install -y clang
- name: Install Doxygen
if: ${{ github.event_name == 'push' || steps.check-label.outputs.result == 'true'}}
run: |
wget https://github.com/doxygen/doxygen/releases/download/Release_${DOXYGEN_VERSION//./_}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz
tar xzvf doxygen-${{ env.DOXYGEN_VERSION }}.linux.bin.tar.gz
cd doxygen-${{ env.DOXYGEN_VERSION }}
sudo make install
cd ..
rm -rf doxygen-${{ env.DOXYGEN_VERSION }}*
- name: Install Graphviz
if: ${{ github.event_name == 'push' || steps.check-label.outputs.result == 'true' }}
run: sudo apt-get install graphviz -y
- name: Clone Doxygen Awesome CSS Themes
if: ${{ github.event_name == 'push' || steps.check-label.outputs.result == 'true'}}
working-directory: ./docs/doxygen
run: |
git clone --depth 1 -b v${{ env.DOXYGEN_AWESOME_VERSION }} https://github.com/jothepro/doxygen-awesome-css awesome_css
- name: Generate Doxygen Documentation
if: ${{ github.event_name == 'push' || steps.check-label.outputs.result == 'true'}}
run: |
cd docs/doxygen
doxygen doxygen.cfg
- name: Create .nojekyll
if: ${{ github.event_name == 'push' || steps.check-label.outputs.result == 'true'}}
run: |
cd docs/doxygen/build/html
touch .nojekyll
- name: Deploy to GitHub Pages (Main Branch)
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: docs/doxygen/build/html
clean: true
clean-exclude: |
pr-preview/
- name: Deploy to PR preview
if: ${{ github.event_name == 'pull_request_target' && steps.check-label.outputs.result == 'true' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: docs/doxygen/build/html
target-folder: ${{ env.PR_PATH }}
clean: false
- name: Update Comment with Preview Link
if: ${{ github.event_name == 'pull_request_target' && steps.check-label.outputs.result == 'true' }}
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find-comment2.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
| ${{ env.CELEBRATION }} **A preview of this PR is available at:** | [Preview Link](https://${{ env.DOMAIN }}/${{ github.event.repository.name }}/${{ env.PR_PATH }}/) |
| -- | -- |
| 📂 **View the source code here:** | [View Source Code](https://github.com/${{ github.repository }}/tree/gh-pages/pr-preview/${{ github.event.pull_request.number }}) |
| 🔧 **Commit used for deployment:** | [${{ github.event.pull_request.head.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}) |
**Note:** Changes may take a few seconds to appear on GitHub Pages. Please refresh the page if you do not see the updates immediately.
${{ env.COMMENT_IDENTIFIER }}
edit-mode: replace
- name: Update Comment with Failure Message
if: ${{ github.event_name == 'pull_request_target' && steps.check-label.outputs.result == 'true' && failure() }}
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find-comment2.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
${{ env.FAILURE_ICON }} **Deployment of this PR failed.** Please check the [Actions logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.
${{ env.COMMENT_IDENTIFIER }}
edit-mode: replace