Skip to content

Commit

Permalink
Get actions running
Browse files Browse the repository at this point in the history
  • Loading branch information
reubeno committed May 11, 2024
1 parent ba93393 commit dcf63c7
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 24 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci-reports.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "PR Reports"
on:
workflow_run:
workflows: ["CI"]
types:
- completed

jobs:
report:
name: "Report"
runs-on: ubuntu-latest
steps:
- name: Get PR issue number
id: get-pr
uses: octokit/[email protected]
with:
route: GET /repos/{owner}/actions/runs/${{ github.event.workflow_run.id }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract PR number
run: |
echo '${{ steps.get-pr.outputs.data }}'
# Extract the PR number from the 'head_branch' field
pr_number=$(echo '${{ steps.get-pr.outputs.data }}' | jq -r '.head_branch' | grep -oP 'pull/\K\d+')
# Check if the workflow run was for a PR
if [ -z "$pr_number" ]; then
echo "This workflow run was not for a PR."
else
echo "This workflow run was for PR #$pr_number."
fi
64 changes: 42 additions & 22 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ jobs:
exit ${result}
- name: "Publish test results"
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
test-results-*.xml
# - name: "Publish test results"
# uses: EnricoMi/publish-unit-test-result-action@v2
# if: always()
# with:
# files: |
# test-results-*.xml

- name: "Generate code coverage report"
uses: clearlyip/code-coverage-report-action@v4
Expand All @@ -108,12 +108,24 @@ jobs:
artifact_download_workflow_names: "CI"
filename: "codecov.xml"

- name: "Publish code coverage data to PR"
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ github.actor != 'dependabot[bot]' && steps.code_coverage_report.outputs.file != '' && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }}
- name: "Upload code coverage report"
uses: actions/upload-artifact@v4
with:
name: pr-reports
path: code-coverage-results.md

- name: "Upload event file"
uses: actions/upload-artifact@v4
with:
name: event-file
path: ${{ github.event_path }}

# - name: "Publish code coverage data to PR"
# uses: marocchino/sticky-pull-request-comment@v2
# if: ${{ github.actor != 'dependabot[bot]' && steps.code_coverage_report.outputs.file != '' && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }}
# with:
# path: code-coverage-results.md

check:
name: "Source code checks"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -189,17 +201,25 @@ jobs:
run: cargo bench --workspace -- --output-format bencher | tee benchmarks.txt
working-directory: main

- name: Compare benchmark results
uses: openpgpjs/github-action-pull-request-benchmark@v1
if: ${{ github.actor != 'dependabot[bot]' }}
- name: Upload performance results
uses: actions/upload-artifact@v4
with:
name: "Time benchmark"
tool: "cargo"
pr-benchmark-file-path: pr/benchmarks.txt
base-benchmark-file-path: main/benchmarks.txt
comment-always: true
alert-threshold: "130%"
fail-on-alert: false
fail-threshold: "150%"
# A token is needed to leave commit comments
github-token: ${{ secrets.GITHUB_TOKEN }}
name: pr-reports
path: |
pr/benchmarks.txt
main/benchmarks.txt
# - name: Compare benchmark results
# uses: openpgpjs/github-action-pull-request-benchmark@v1
# if: ${{ github.actor != 'dependabot[bot]' }}
# with:
# name: "Time benchmark"
# tool: "cargo"
# pr-benchmark-file-path: pr/benchmarks.txt
# base-benchmark-file-path: main/benchmarks.txt
# comment-always: true
# alert-threshold: "130%"
# fail-on-alert: false
# fail-threshold: "150%"
# # A token is needed to leave commit comments
# github-token: ${{ secrets.GITHUB_TOKEN }}
32 changes: 30 additions & 2 deletions .github/workflows/devcontainer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,40 @@ on:
- main
pull_request:
paths:
- '.devcontainer/**'
- ".devcontainer/**"

jobs:
build:
name: "Build and publish"
name: "Build devcontainer"
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-build dev container image
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/reubeno/brush/devcontainer
imageTag: latest
cacheFrom: ghcr.io/reubeno/brush/devcontainer
push: never

build_and_publish:
name: "Build and publish devcontainer"
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down

0 comments on commit dcf63c7

Please sign in to comment.