-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: CI/CD pipeline for TM grammar coverage badge
- Loading branch information
1 parent
6b2cf88
commit 38b9b94
Showing
5 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
name: "TextMate Grammar Coverage Badge" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: [ "src/**", "tests/**" ] | ||
pull_request: | ||
branches: [ main ] | ||
paths: [ "src/**", "tests/**" ] | ||
|
||
jobs: | ||
Compile: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Import GPG key | ||
id: import-gpg | ||
uses: crazy-max/[email protected] | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
|
||
- name: Get SVG | ||
run: make -B $(pwd)/images/coverage-badge.svg | ||
|
||
- name: GPG user | ||
run: | | ||
echo "fingerprint: ${{ steps.import-gpg.outputs.fingerprint }}" | ||
echo "username: ${{ steps.import-gpg.outputs.name }}" | ||
echo "email: ${{ steps.import-gpg.outputs.email }}" | ||
- name: Auto-commit changes | ||
id: auto-commit-action | ||
uses: stefanzweifel/[email protected] | ||
with: | ||
commit_message: auto-commit of updated coverage badge | ||
branch: main | ||
commit_options: '--no-verify --signoff -S' | ||
file_pattern: 'images/*' | ||
commit_user_name: "${{ steps.import-gpg.outputs.name }}" | ||
commit_user_email: "${{ steps.import-gpg.outputs.email }}" | ||
|
||
- name: Run if changes have been detected | ||
if: steps.auto-commit-action.outputs.changes_detected == 'true' | ||
run: echo "New code coverage was published" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
name: "Pre-commit" | ||
name: "Pre-Commit" | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# PARI/GP Programming Language | ||
|
||
A Textmate language grammar for programming language of PARI/GP computer algebra system. | ||
|
||
![Grammar Coverage](https://github.com/piotr-semenov/parigp-lang/blob/main/images/coverage-badge.svg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<xsl:stylesheet version="1.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:svg="http://www.w3.org/2000/svg"> | ||
|
||
<xsl:output method="xml" indent="yes" encoding="utf-8" /> | ||
<xsl:param name="coverage" select="50" as="xsl:integer" /> | ||
|
||
<xsl:template match="/"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="140px" height="20px" role="img"> | ||
<title>TextMate Grammar Coverage</title> | ||
<linearGradient id="a" x2="0" y2="100%"> | ||
<stop offset="0" stop-opacity=".1" stop-color="#EEE"/> | ||
<stop offset="1" stop-opacity=".1"/> | ||
</linearGradient> | ||
<mask id="m"><rect width="100%" height="100%" rx="3" fill="#FFF"/></mask> | ||
<g mask="url(#m)"> | ||
<rect x="0" y="0" width="69" height="20" fill="#444"/> | ||
<svg x="69" y="0" width="71" height="20"> | ||
<rect width="100%" height="100%" fill="#888888"/> | ||
<rect width="0%" height="100%" fill="#33CC11" transform=""> | ||
<animate attributeName="width" begin="0.5s" dur="600ms" from="0%" to="{$coverage}%" repeatCount="1" fill="freeze" calcMode="spline" keyTimes="0; 1" keySplines="0.3, 0.61, 0.355, 1"/> | ||
</rect> | ||
</svg> | ||
<rect width="140" height="20" fill="url(#a)"/> | ||
</g> | ||
<g aria-hidden="true" font-size="11" font-family="Verdana, DejaVu Sans, sans-serif" fill="#FFFFFF"> | ||
<text x="6" y="15" fill="#000" opacity="0.25">Coverage</text> | ||
<text x="5" y="14">Coverage</text> | ||
<text x="135" y="15" fill="#000" opacity="0.25" text-anchor="end"><xsl:value-of select="$coverage" />%</text> | ||
<text x="134" y="14" text-anchor="end"><xsl:value-of select="$coverage" />%</text> | ||
</g> | ||
</svg> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |