Skip to content

Commit 753243b

Browse files
authored
Merge pull request #1 from MontiCore/add-ci
Add CI
2 parents b1632b9 + 34fb71a commit 753243b

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# (c) https://github.com/MontiCore/monticore
2+
name: Deploy Snapshot
3+
4+
5+
concurrency: # run this test workflow only once per "branch"
6+
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
on:
10+
push: # run this pipeline on every push
11+
paths-ignore:
12+
- "*.md" # do not run this pipeline if the only change was to markdown files
13+
branches: [ "dev" ] # Only run on the default branch
14+
repository_dispatch: # and on request of upstream projects
15+
types: [ trigger_after_upstream_deploy ]
16+
17+
env:
18+
GRADLE_VERSION: 7.4 # Gradle version used
19+
GRADLE_CLI_OPTS: "-Pci --build-cache" # CLI options passed to Gradle
20+
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: "test-cache-${{ github.head_ref }}.${{ github.sha }}"
21+
22+
permissions:
23+
contents: read
24+
25+
26+
jobs:
27+
build:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout project sources
31+
uses: actions/checkout@v3
32+
- name: Gradle build
33+
uses: gradle/actions/setup-gradle@v3
34+
with:
35+
gradle-version: ${{env.GRADLE_VERSION}}
36+
arguments: build ${{env.GRADLE_CLI_OPTS}}
37+
38+
deploy:
39+
permissions:
40+
packages: write
41+
runs-on: ubuntu-latest
42+
needs: build
43+
if: github.ref == 'refs/heads/dev'
44+
steps:
45+
- name: Checkout project sources
46+
uses: actions/checkout@v3
47+
- name: Gradle publish
48+
uses: gradle/actions/setup-gradle@v3
49+
with:
50+
gradle-version: ${{env.GRADLE_VERSION}}
51+
arguments: publish ${{env.GRADLE_CLI_OPTS}} -PmavenPassword=${{ secrets.SE_NEXUS_PASSWORD }} -PmavenUser=${{ secrets.SE_NEXUS_USER }}
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# (c) https://github.com/MontiCore/monticore
2+
name: Report Proposed Changes Test Results
3+
on:
4+
workflow_run:
5+
workflows: [ Test Proposed Changes ]
6+
types: [ completed ]
7+
8+
# Note: This is a separate workflow (file) to constrain the write permissions
9+
permissions:
10+
checks: write
11+
12+
jobs:
13+
checks:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Download Test Report
17+
uses: dawidd6/action-download-artifact@20319c5641d495c8a52e688b7dc5fada6c3a9fbc
18+
with:
19+
name: junit-test-results
20+
workflow: ${{ github.event.workflow.id }}
21+
run_id: ${{ github.event.workflow_run.id }}
22+
- name: Publish Test Report
23+
uses: mikepenz/action-junit-report@a451de5ac1ff45e46508b6150cb4f51a287d0309
24+
with:
25+
commit: ${{github.event.workflow_run.head_sha}}
26+
report_paths: '**/target/test-results/test/TEST-*.xml'

.github/workflows/test_branch.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# (c) https://github.com/MontiCore/monticore
2+
name: Test Proposed Changes
3+
4+
concurrency: # run this test workflow only once per "branch"
5+
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
8+
on:
9+
push: # run this pipeline on every push
10+
paths-ignore:
11+
- "*.md" # do not run this pipeline if the only change was to markdown files
12+
branches-ignore: [ "dev" ] # Do not run this on the default branch
13+
14+
env:
15+
GRADLE_VERSION: 7.4 # Gradle version used
16+
GRADLE_CLI_OPTS: "-Pci --build-cache" # CLI options passed to Gradle
17+
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: "test-cache-${{ github.head_ref }}.${{ github.sha }}"
18+
19+
permissions:
20+
contents: read
21+
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout project sources
28+
uses: actions/checkout@v3
29+
- name: Gradle build
30+
uses: gradle/actions/setup-gradle@v3
31+
with:
32+
gradle-version: ${{env.GRADLE_VERSION}}
33+
arguments: build ${{env.GRADLE_CLI_OPTS}}
34+
- name: Upload Test Report
35+
uses: actions/upload-artifact@v3
36+
if: always() # always run even if the previous step fails
37+
with:
38+
name: junit-test-results
39+
path: '**/target/test-results/test/TEST-*.xml'
40+
retention-days: 1
41+
42+
43+
# Not a part of the MontiVerse

0 commit comments

Comments
 (0)