Skip to content

Commit

Permalink
possibly fix something
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasdewally committed Nov 4, 2023
1 parent 6dc659a commit b41c943
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 76 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/code-coverage-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: coverage-deploy
on:
workflow_run:
workflows: [code-coverage]
types:
- completed


# see https://github.com/JamesIves/github-pages-deploy-action/tree/dev
permissions:
contents: write

jobs:
deploy-coverage:
name: "Info: Code Coverage"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
name: code-coverage-${{ github.event.workflow_run.head_sha }}
workflow: code-coverage.yml
path: ./deploy

- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./deploy
target-folder: "coverage/${{ github.event.workflow_run.head_sha }}"
branch: gh-pages
commit-message: "Actions: Code Coverage for ${{ github.event.workflow_run.head_sha }}"

- name: If on main branch, copy coverage report to /latest.
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./deploy
target-folder: "coverage/latest"
branch: gh-pages
commit-message: "Actions: Update latest code coverage for main (${{ github.event.workflow_run.head_sha }})"

- name: Format summary
run : |
CONJURE_OXIDE_URL="https://conjure-cp.github.io/conjure-oxide/coverage/${{ github.event.workflow_run.head_sha }}/conjure-oxide"
MINION_URL="https://conjure-cp.github.io/conjure-oxide/coverage/${{ github.event.workflow_run.head_sha }}/minion"
CHUFFED_URL="https://conjure-cp.github.io/conjure-oxide/coverage/${{ github.event.workflow_run.head_sha }}/chuffed"
CONJURE_OXIDE_LATEST="https://conjure-cp.github.io/conjure-oxide/coverage/latest/conjure-oxide"
MINION_LATEST="https://conjure-cp.github.io/conjure-oxide/coverage/latest/minion"
CHUFFED_LATEST="https://conjure-cp.github.io/conjure-oxide/coverage/latest/chuffed"
echo '# Code Coverage' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## This commit" >> $GITHUB_STEP_SUMMARY
echo "| Crate | | | " >> $GITHUB_STEP_SUMMARY
echo "| ----- | ----- | ----- |" >> $GITHUB_STEP_SUMMARY
echo "| Conjure-Oxide | ![](${CONJURE_OXIDE_URL}/badges/flat.svg) | [Full Report](${CONJURE_OXIDE_URL}) | " >> $GITHUB_STEP_SUMMARY
echo "| Minion | ![](${MINION_URL}/badges/flat.svg) | [Full Report](${MINION_URL}) | " >> $GITHUB_STEP_SUMMARY
echo "| Chuffed | ![](${CHUFFED_URL}/badges/flat.svg) | [Full Report](${CHUFFED_URL}) | " >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Main" >> $GITHUB_STEP_SUMMARY
echo "| Crate | | | " >> $GITHUB_STEP_SUMMARY
echo "| ----- | ----- | ----- |" >> $GITHUB_STEP_SUMMARY
echo "| Conjure-Oxide | ![](${CONJURE_OXIDE_LATEST}/badges/flat.svg) | [Full Report](${CONJURE_OXIDE_LATEST}) | " >> $GITHUB_STEP_SUMMARY
echo "| Minion | ![](${MINION_LATEST}/badges/flat.svg) | [Full Report](${MINION_LATEST}) | " >> $GITHUB_STEP_SUMMARY
echo "| Chuffed | ![](${CHUFFED_LATEST}/badges/flat.svg) | [Full Report](${CHUFFED_LATEST}) | " >> $GITHUB_STEP_SUMMARY
indexes:
needs: deploy-coverage
name: "Regenerate indexes for coverage"
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2

- name: Checkout the pages repository
uses: actions/checkout@v2
with:
ref: "gh-pages"
path: "pages"

- name: "Generate indexes"
run: |
./etc/ci/genindex.py pages/coverage/${{ github.event.workflow_run.head_sha }}
./etc/ci/genindex.py pages/coverage/latest
./etc/ci/genindex.py pages/coverage/
- uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./pages/coverage/
target-folder: ./coverage/
branch: gh-pages
commit-message: "Actions: Update coverage indexes"
83 changes: 7 additions & 76 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
name: 'Code Coverage'
name: code-coverage
on:
push:
pull_request:
workflow_dispatch:

# see https://github.com/JamesIves/github-pages-deploy-action/tree/dev
permissions:
contents: write

jobs:
coverage:
name: "Info: Code Coverage Reports"
name: "Generate Code Coverage Reports"
# only do coverage for ready PRs
if: ${{ github.event != 'pull_request' || ( github.event == 'pull_request' && (! github.event.pull_request.draft)) }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -46,7 +42,7 @@ jobs:
working-directory: .
run: |
./etc/scripts/gen_coverage_all.sh
- name: Move all html to correct folders for deployment
run: |
# put things both in the sha directory, and in latest/
Expand All @@ -58,76 +54,11 @@ jobs:
cp -r solvers/minion/coverage/html/* deploy/minion
cp -r solvers/chuffed/coverage/html/* deploy/chuffed
- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./deploy
target-folder: "coverage/${{ github.sha }}"
branch: gh-pages
commit-message: "Actions: Code Coverage for ${{ github.sha }}"

- name: If on main branch, copy coverage report to /latest.
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
folder: ./deploy
target-folder: "coverage/latest"
branch: gh-pages
commit-message: "Actions: Update latest code coverage for main (${{ github.sha }})"

- name: Format summary
run : |
CONJURE_OXIDE_URL="https://conjure-cp.github.io/conjure-oxide/coverage/${{ github.sha }}/conjure-oxide"
MINION_URL="https://conjure-cp.github.io/conjure-oxide/coverage/${{ github.sha }}/minion"
CHUFFED_URL="https://conjure-cp.github.io/conjure-oxide/coverage/${{ github.sha }}/chuffed"
CONJURE_OXIDE_LATEST="https://conjure-cp.github.io/conjure-oxide/coverage/latest/conjure-oxide"
MINION_LATEST="https://conjure-cp.github.io/conjure-oxide/coverage/latest/minion"
CHUFFED_LATEST="https://conjure-cp.github.io/conjure-oxide/coverage/latest/chuffed"
echo '# Code Coverage' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## This commit" >> $GITHUB_STEP_SUMMARY
echo "| Crate | | | " >> $GITHUB_STEP_SUMMARY
echo "| ----- | ----- | ----- |" >> $GITHUB_STEP_SUMMARY
echo "| Conjure-Oxide | ![](${CONJURE_OXIDE_URL}/badges/flat.svg) | [Full Report](${CONJURE_OXIDE_URL}) | " >> $GITHUB_STEP_SUMMARY
echo "| Minion | ![](${MINION_URL}/badges/flat.svg) | [Full Report](${MINION_URL}) | " >> $GITHUB_STEP_SUMMARY
echo "| Chuffed | ![](${CHUFFED_URL}/badges/flat.svg) | [Full Report](${CHUFFED_URL}) | " >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Main" >> $GITHUB_STEP_SUMMARY
echo "| Crate | | | " >> $GITHUB_STEP_SUMMARY
echo "| ----- | ----- | ----- |" >> $GITHUB_STEP_SUMMARY
echo "| Conjure-Oxide | ![](${CONJURE_OXIDE_LATEST}/badges/flat.svg) | [Full Report](${CONJURE_OXIDE_LATEST}) | " >> $GITHUB_STEP_SUMMARY
echo "| Minion | ![](${MINION_LATEST}/badges/flat.svg) | [Full Report](${MINION_LATEST}) | " >> $GITHUB_STEP_SUMMARY
echo "| Chuffed | ![](${CHUFFED_LATEST}/badges/flat.svg) | [Full Report](${CHUFFED_LATEST}) | " >> $GITHUB_STEP_SUMMARY
indexes:
needs: coverage
name: "Regenerate indexes for coverage"
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2

- name: Checkout the pages repository
uses: actions/checkout@v2
with:
ref: "gh-pages"
path: "pages"

- name: "Generate indexes"
run: |
./etc/ci/genindex.py pages/coverage/${{ github.sha }}
./etc/ci/genindex.py pages/coverage/latest
./etc/ci/genindex.py pages/coverage/
- uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./pages/coverage/
target-folder: ./coverage/
branch: gh-pages
commit-message: "Actions: Update coverage indexes"


name: code-coverage-${{ github.sha }}
path: deploy/**



0 comments on commit b41c943

Please sign in to comment.