Skip to content

Commit 3e2dc2c

Browse files
committed
Make GitHub actions robust for branch names master and main.
1 parent 7372f16 commit 3e2dc2c

File tree

6 files changed

+157
-11
lines changed

6 files changed

+157
-11
lines changed

.github/workflows/autograding.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: 'Build and autograde'
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
pull_request:
9+
10+
jobs:
11+
Build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v3
17+
with:
18+
distribution: 'temurin'
19+
java-version: '11'
20+
check-latest: true
21+
cache: 'maven'
22+
- name: Compile, Test and Analysis
23+
run: mvn -V --color always -ntp clean verify -Dmaven.test.failure.ignore=true | tee maven.log
24+
- name: Mutation Coverage
25+
run: mvn -V --color always -ntp org.pitest:pitest-maven:mutationCoverage
26+
- name: Autograding
27+
uses: uhafner/[email protected]
28+
with:
29+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
HEAD_SHA: ${{github.event.pull_request.head.sha}}
31+
CONFIG: >
32+
{
33+
"analysis": {
34+
"tools": [
35+
{
36+
"id": "error-prone",
37+
"pattern": "**/*.log"
38+
},
39+
{
40+
"id": "java",
41+
"pattern": "**/*.log"
42+
},
43+
{
44+
"id": "javadoc-warnings",
45+
"pattern": "**/*.log"
46+
},
47+
{
48+
"id": "checkstyle",
49+
"pattern": "**/checkstyle-result.xml"
50+
},
51+
{
52+
"id": "pmd",
53+
"pattern": "**/pmd.xml"
54+
},
55+
{
56+
"id": "spotbugs",
57+
"pattern": "**/spotbugsXml.xml"
58+
}
59+
],
60+
"maxScore": 100,
61+
"errorImpact": -5,
62+
"highImpact": -2,
63+
"normalImpact": -1,
64+
"lowImpact": -1
65+
},
66+
"tests": {
67+
"maxScore": 100,
68+
"passedImpact": 0,
69+
"failureImpact": -5,
70+
"skippedImpact": -1
71+
},
72+
"coverage": {
73+
"maxScore": 100,
74+
"coveredPercentageImpact": 0,
75+
"missedPercentageImpact": -1
76+
},
77+
"pit": {
78+
"maxScore": 100,
79+
"detectedImpact": 0,
80+
"undetectedImpact": -1,
81+
"detectedPercentageImpact": 0,
82+
"undetectedPercentageImpact": 0
83+
}
84+
}

.github/workflows/check-md-links.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v3
10-
- name: fix permission issue
11-
run: git config --global --add safe.directory /github/workspace
1210
- uses: gaurav-nelson/github-action-markdown-link-check@v1
1311
with:
14-
check-modified-files-only: 'yes'
12+
check-modified-files-only: 'no'

.github/workflows/codeql.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
pull_request:
9+
branches:
10+
- master
11+
- main
12+
schedule:
13+
- cron: "32 3 * * 0"
14+
15+
jobs:
16+
analyze:
17+
name: Analyze
18+
runs-on: ubuntu-latest
19+
permissions:
20+
actions: read
21+
contents: read
22+
security-events: write
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
language: [ java ]
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
33+
- name: Setup Java
34+
uses: actions/setup-java@v3
35+
with:
36+
distribution: temurin
37+
java-version: 11
38+
39+
- name: Initialize CodeQL
40+
uses: github/codeql-action/init@v2
41+
with:
42+
languages: ${{ matrix.language }}
43+
queries: +security-and-quality
44+
45+
- name: Autobuild
46+
uses: github/codeql-action/autobuild@v2
47+
48+
- name: Perform CodeQL Analysis
49+
uses: github/codeql-action/analyze@v2
50+
with:
51+
category: "/language:${{ matrix.language }}"

.github/workflows/coverage.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ on:
44
push:
55
branches:
66
- master
7+
- main
78
pull_request:
89

910
jobs:
1011
coverage:
1112

12-
runs-on: [ubuntu-latest]
13+
runs-on: ubuntu-latest
1314
name: Coverage on Ubuntu
1415

1516
steps:
@@ -20,14 +21,10 @@ jobs:
2021
distribution: 'temurin'
2122
java-version: '11'
2223
check-latest: true
23-
cache: 'maven'
2424
- name: Generate coverage with JaCoCo
25-
env:
26-
BROWSER: firefox-container
27-
run: mvn -V --color always -ntp clean verify jacoco:prepare-agent test integration-test jacoco:report --file plugin/pom.xml '-Dgpg.skip'
28-
25+
run: mvn -V --color always -ntp clean verify --file pom.xml '-Dgpg.skip'
2926
- name: Upload coverage to Codecov
30-
uses: codecov/codecov-action@v3.1.1
27+
uses: codecov/codecov-action@v3
3128
with:
29+
files: 'target/site/jacoco/jacoco.xml'
3230
token: ${{secrets.CODECOV_TOKEN}}
33-
file: ./plugin/target/site/jacoco/jacoco.xml
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Enforce PR labels
2+
3+
on:
4+
pull_request:
5+
types: [unlabeled]
6+
jobs:
7+
enforce-label:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: yogevbd/[email protected]
11+
with:
12+
REQUIRED_LABELS_ANY: "bug,feature,enhancement,deprecated,removed,tests,documentation,internal,dependencies"
13+
REQUIRED_LABELS_ANY_DESCRIPTION: "Maintainer needs to assign at least one label before merge"
14+
BANNED_LABELS: "banned"

.github/workflows/sync-labels.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ on:
33
push:
44
branches:
55
- master
6+
- main
67
paths:
78
- .github/labels.yml
9+
- .github/workflows/sync-labels.yml
810

911
jobs:
1012
build:

0 commit comments

Comments
 (0)