diff --git a/.github/archive/pr-checks.yml b/.github/.archive/pr-checks.yml similarity index 100% rename from .github/archive/pr-checks.yml rename to .github/.archive/pr-checks.yml diff --git a/.github/actions/runner-fallback/action.yml b/.github/actions/runner-fallback/action.yml index 9b320f2..c8e6d33 100644 --- a/.github/actions/runner-fallback/action.yml +++ b/.github/actions/runner-fallback/action.yml @@ -11,9 +11,11 @@ inputs: description: 'Comma-separated label list or single label for the fallback (e.g. "ubuntu-latest")' required: true github-token: - description: "PAT or GITHUB_TOKEN with `repo` scope" + description: 'GitHub token with repo admin read permissions' required: true + + outputs: use-runner: description: "JSON array of labels you can feed straight into runs-on" @@ -40,7 +42,17 @@ runs: runners=$(curl -s -H "Authorization: Bearer $TOKEN" \ -H "Accept: application/vnd.github+json" \ "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" online_found=0 while read -r row; do diff --git a/.github/runners/runner-x64/Dockerfile b/.github/runners/runner-x64/Dockerfile index efcba95..79ee4e3 100644 --- a/.github/runners/runner-x64/Dockerfile +++ b/.github/runners/runner-x64/Dockerfile @@ -7,11 +7,20 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt update -y && apt upgrade -y && useradd -m docker RUN apt install -y --no-install-recommends \ - curl jq build-essential libssl-dev libffi-dev python3 python3-venv python3-dev python3-pip \ + curl jq git \ + # dev dependencies + build-essential libssl-dev libffi-dev python3 python3-venv python3-dev python3-pip \ # dot net core dependencies - libicu74 libssl3 libkrb5-3 zlib1g libcurl4 + libicu74 libssl3 libkrb5-3 zlib1g libcurl4 \ + # Rust and Cargo dependencies + gcc cmake +# Install Rust and Cargo +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/home/docker/.cargo/bin:${PATH}" +ENV HOME="/home/docker" + RUN cd /home/docker && mkdir actions-runner && cd actions-runner \ && curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \ && tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz diff --git a/.github/workflows/docs-and-testcov.yml b/.github/workflows/docs-and-testcov.yml index 94eab46..346335f 100644 --- a/.github/workflows/docs-and-testcov.yml +++ b/.github/workflows/docs-and-testcov.yml @@ -6,9 +6,9 @@ concurrency: on: push: - branches: [main] -# pull_request: -# branches: [main] + branches: [main, update_docs_workflow] + # pull_request: + # branches: [main] workflow_dispatch: permissions: @@ -27,9 +27,9 @@ jobs: - id: choose uses: ./.github/actions/runner-fallback with: - primary-runner: "self-hosted,ubuntu-latest" + primary-runner: "self-hosted" fallback-runner: "ubuntu-latest" - github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.CUSTOM_GH_TOKEN }} docs-and-testcov: needs: pick-runner @@ -94,21 +94,25 @@ jobs: - name: Copy files to output directory run: | + # mkdir docs + mkdir -p target/doc/docs + cp -r target/doc/rustframe/* target/doc/docs/ + mkdir output - cp tarpaulin-report.html target/doc/rustframe/ - cp tarpaulin-report.json target/doc/rustframe/ - cp tarpaulin-badge.json target/doc/rustframe/ - cp last-commit-date.json target/doc/rustframe/ - mkdir -p target/doc/rustframe/.github - cp .github/rustframe_logo.png target/doc/rustframe/.github/ - echo "" > target/doc/index.html + cp tarpaulin-report.html target/doc/docs/ + cp tarpaulin-report.json target/doc/docs/ + cp tarpaulin-badge.json target/doc/docs/ + cp last-commit-date.json target/doc/docs/ + mkdir -p target/doc/docs/.github + cp .github/rustframe_logo.png target/doc/docs/.github/ + echo "" > target/doc/index.html - 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 with: path: target/doc/ - name: Deploy to GitHub Pages - if: github.event_name == 'push' - uses: actions/deploy-pages@v4 + # if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.github/workflows/run-benchmarks.yml b/.github/workflows/run-benchmarks.yml index b05029e..a7c3044 100644 --- a/.github/workflows/run-benchmarks.yml +++ b/.github/workflows/run-benchmarks.yml @@ -7,8 +7,22 @@ on: # - main jobs: - run-benchmarks: + pick-runner: 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: - name: Checkout code diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index 2b8cd8f..1aa68c5 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -12,18 +12,22 @@ concurrency: jobs: pick-runner: + if: github.event.pull_request.draft == false + 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,ubuntu-latest" + primary-runner: "self-hosted" fallback-runner: "ubuntu-latest" - github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.CUSTOM_GH_TOKEN }} + run-unit-tests: needs: pick-runner diff --git a/README.md b/README.md index 931b463..490deea 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![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) ---