Merge 7e27539529cdbb925e898fabad998ce95067097a into ddcc539076f3b78bd9c41afc55e45bcb51ba7bc0

This commit is contained in:
Palash Tyagi 2025-05-05 00:05:01 +00:00 committed by GitHub
commit 7a8215d358
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 55 additions and 21 deletions

View File

@ -11,9 +11,11 @@ inputs:
description: 'Comma-separated label list or single label for the fallback (e.g. "ubuntu-latest")' description: 'Comma-separated label list or single label for the fallback (e.g. "ubuntu-latest")'
required: true required: true
github-token: github-token:
description: "PAT or GITHUB_TOKEN with `repo` scope" description: 'GitHub token with repo admin read permissions'
required: true required: true
outputs: outputs:
use-runner: use-runner:
description: "JSON array of labels you can feed straight into runs-on" description: "JSON array of labels you can feed straight into runs-on"
@ -40,7 +42,17 @@ runs:
runners=$(curl -s -H "Authorization: Bearer $TOKEN" \ runners=$(curl -s -H "Authorization: Bearer $TOKEN" \
-H "Accept: application/vnd.github+json" \ -H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$repo/actions/runners?per_page=100") "https://api.github.com/repos/$repo/actions/runners?per_page=100")
# Split wanted labels
# Debug: Print runners content
echo "Runners response: $runners"
# Check if runners is null or empty
if [ -z "$runners" ] || [ "$runners" = "null" ]; then
echo "❌ Error: Unable to fetch runners or no runners found." >&2
exit 1
fi
# Process runners only if valid
IFS=',' read -ra WANT <<<"$PRIMARY" IFS=',' read -ra WANT <<<"$PRIMARY"
online_found=0 online_found=0
while read -r row; do while read -r row; do

View File

@ -6,9 +6,9 @@ concurrency:
on: on:
push: push:
branches: [main] branches: [main, update_docs_workflow]
# pull_request: # pull_request:
# branches: [main] # branches: [main]
workflow_dispatch: workflow_dispatch:
permissions: permissions:
@ -27,9 +27,9 @@ jobs:
- id: choose - id: choose
uses: ./.github/actions/runner-fallback uses: ./.github/actions/runner-fallback
with: with:
primary-runner: "self-hosted,ubuntu-latest" primary-runner: "self-hosted"
fallback-runner: "ubuntu-latest" fallback-runner: "ubuntu-latest"
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.CUSTOM_GH_TOKEN }}
docs-and-testcov: docs-and-testcov:
needs: pick-runner needs: pick-runner
@ -94,21 +94,25 @@ jobs:
- name: Copy files to output directory - name: Copy files to output directory
run: | run: |
# mkdir docs
mkdir -p target/doc/docs
cp -r target/doc/rustframe/* target/doc/docs/
mkdir output mkdir output
cp tarpaulin-report.html target/doc/rustframe/ cp tarpaulin-report.html target/doc/docs/
cp tarpaulin-report.json target/doc/rustframe/ cp tarpaulin-report.json target/doc/docs/
cp tarpaulin-badge.json target/doc/rustframe/ cp tarpaulin-badge.json target/doc/docs/
cp last-commit-date.json target/doc/rustframe/ cp last-commit-date.json target/doc/docs/
mkdir -p target/doc/rustframe/.github mkdir -p target/doc/docs/.github
cp .github/rustframe_logo.png target/doc/rustframe/.github/ cp .github/rustframe_logo.png target/doc/docs/.github/
echo "<meta http-equiv=\"refresh\" content=\"0; url=rustframe\">" > target/doc/index.html echo "<meta http-equiv=\"refresh\" content=\"0; url=docs\">" > target/doc/index.html
- name: Upload Pages artifact - name: Upload Pages artifact
if: github.event_name == 'push' # if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3
with: with:
path: target/doc/ path: target/doc/
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages
if: github.event_name == 'push' # if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/deploy-pages@v4 uses: actions/deploy-pages@v4

View File

@ -7,8 +7,22 @@ on:
# - main # - main
jobs: jobs:
run-benchmarks: pick-runner:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
runner: ${{ steps.choose.outputs.use-runner }}
steps:
- uses: actions/checkout@v4
- id: choose
uses: ./.github/actions/runner-fallback
with:
primary-runner: "self-hosted"
fallback-runner: "ubuntu-latest"
github-token: ${{ secrets.CUSTOM_GH_TOKEN }}
run-benchmarks:
needs: pick-runner
runs-on: ${{ fromJson(needs.pick-runner.outputs.runner) }}
steps: steps:
- name: Checkout code - name: Checkout code

View File

@ -12,18 +12,22 @@ concurrency:
jobs: jobs:
pick-runner: pick-runner:
if: github.event.pull_request.draft == false if: github.event.pull_request.draft == false
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
runner: ${{ steps.choose.outputs.use-runner }} runner: ${{ steps.choose.outputs.use-runner }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- id: choose - id: choose
uses: ./.github/actions/runner-fallback uses: ./.github/actions/runner-fallback
with: with:
primary-runner: "self-hosted,ubuntu-latest" primary-runner: "self-hosted"
fallback-runner: "ubuntu-latest" fallback-runner: "ubuntu-latest"
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.CUSTOM_GH_TOKEN }}
run-unit-tests: run-unit-tests:
needs: pick-runner needs: pick-runner

View File

@ -7,7 +7,7 @@
<!-- [![Last commit](https://img.shields.io/endpoint?url=https://magnus167.github.io/rustframe/rustframe/last-commit-date.json)](https://github.com/Magnus167/rustframe) --> <!-- [![Last commit](https://img.shields.io/endpoint?url=https://magnus167.github.io/rustframe/rustframe/last-commit-date.json)](https://github.com/Magnus167/rustframe) -->
[![codecov](https://codecov.io/gh/Magnus167/rustframe/graph/badge.svg?token=J7ULJEFTVI)](https://codecov.io/gh/Magnus167/rustframe) [![codecov](https://codecov.io/gh/Magnus167/rustframe/graph/badge.svg?token=J7ULJEFTVI)](https://codecov.io/gh/Magnus167/rustframe)
[![Coverage](https://img.shields.io/endpoint?url=https://magnus167.github.io/rustframe/rustframe/tarpaulin-badge.json)](https://magnus167.github.io/rustframe/rustframe/tarpaulin-report.html) [![Coverage](https://img.shields.io/endpoint?url=https://magnus167.github.io/rustframe/docs/tarpaulin-badge.json)](https://magnus167.github.io/rustframe/docs/tarpaulin-report.html)
--- ---