Skip to content

Commit

Permalink
Make GitHub actions robust for branch names master and main.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Dec 12, 2022
1 parent ab9b3c4 commit 7141bf9
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 2 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/autograding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: 'Build and autograde'

on:
push:
branches:
- master
- main
pull_request:

jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
check-latest: true
cache: 'maven'
- name: Compile, Test and Analysis
run: mvn -V --color always -ntp clean verify -Dmaven.test.failure.ignore=true | tee maven.log
- name: Mutation Coverage
run: mvn -V --color always -ntp org.pitest:pitest-maven:mutationCoverage
- name: Autograding
uses: uhafner/autograding-github-action@v1.7.0
with:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_SHA: ${{github.event.pull_request.head.sha}}
CONFIG: >
{
"analysis": {
"tools": [
{
"id": "error-prone",
"pattern": "**/*.log"
},
{
"id": "java",
"pattern": "**/*.log"
},
{
"id": "javadoc-warnings",
"pattern": "**/*.log"
},
{
"id": "checkstyle",
"pattern": "**/checkstyle-result.xml"
},
{
"id": "pmd",
"pattern": "**/pmd.xml"
},
{
"id": "spotbugs",
"pattern": "**/spotbugsXml.xml"
}
],
"maxScore": 100,
"errorImpact": -5,
"highImpact": -2,
"normalImpact": -1,
"lowImpact": -1
},
"tests": {
"maxScore": 100,
"passedImpact": 0,
"failureImpact": -5,
"skippedImpact": -1
},
"coverage": {
"maxScore": 100,
"coveredPercentageImpact": 0,
"missedPercentageImpact": -1
},
"pit": {
"maxScore": 100,
"detectedImpact": 0,
"undetectedImpact": -1,
"detectedPercentageImpact": 0,
"undetectedPercentageImpact": 0
}
}
12 changes: 12 additions & 0 deletions .github/workflows/check-md-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Check Markdown links

on: push

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
check-modified-files-only: 'no'
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
name: on ${{ matrix.platform }} with JDK ${{ matrix.jdk }}

steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v3
with:
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "CodeQL"

on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
schedule:
- cron: "32 3 * * 0"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ java ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
30 changes: 30 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Generate coverage report'

on:
push:
branches:
- master
- main
pull_request:

jobs:
coverage:

runs-on: ubuntu-latest
name: Coverage on Ubuntu

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
check-latest: true
- name: Generate coverage with JaCoCo
run: mvn -V --color always -ntp clean verify --file pom.xml '-Dgpg.skip'
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: 'target/site/jacoco/jacoco.xml'
token: ${{secrets.CODECOV_TOKEN}}
14 changes: 14 additions & 0 deletions .github/workflows/enforce-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Enforce PR labels

on:
pull_request:
types: [unlabeled]
jobs:
enforce-label:
runs-on: ubuntu-latest
steps:
- uses: yogevbd/enforce-label-action@2.1.0
with:
REQUIRED_LABELS_ANY: "bug,feature,enhancement,deprecated,removed,tests,documentation,internal,dependencies"
REQUIRED_LABELS_ANY_DESCRIPTION: "Maintainer needs to assign at least one label before merge"
BANNED_LABELS: "banned"
4 changes: 3 additions & 1 deletion .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ on:
push:
branches:
- master
- main
paths:
- .github/labels.yml
- .github/workflows/sync-labels.yml

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v3
- uses: micnncim/action-label-syncer@v1.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 7141bf9

Please sign in to comment.