forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DSpace#3060 from tdonohue/github_ci
Add CI to GitHub via Actions (based on Travis CI config)
- Loading branch information
Showing
3 changed files
with
76 additions
and
55 deletions.
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
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,69 @@ | ||
# DSpace Continuous Integration/Build via GitHub Actions | ||
# Concepts borrowed from | ||
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-java-with-maven | ||
name: Build | ||
|
||
# Run this Build only for pushes / PRs to main branch | ||
on: | ||
push: | ||
branches: main | ||
pull_request: | ||
branches: main | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
env: | ||
# Give Maven 1GB of memory to work with | ||
# Suppress all Maven "downloading" messages in Travis logs (see https://stackoverflow.com/a/35653426) | ||
# This also slightly speeds builds, as there is less logging | ||
MAVEN_OPTS: "-Xmx1024M -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" | ||
strategy: | ||
# Create a matrix of two separate configurations for Unit vs Integration Tests | ||
# This will ensure those tasks are run in parallel | ||
matrix: | ||
include: | ||
# NOTE: Unit Tests include deprecated REST API v6 (as it has unit tests) | ||
- type: "Unit Tests" | ||
mvnflags: "-DskipUnitTests=false -Pdspace-rest" | ||
# NOTE: ITs skip all code validation checks, as they are already done by Unit Test job. | ||
# - enforcer.skip => Skip maven-enforcer-plugin rules | ||
# - checkstyle.skip => Skip all checkstyle checks by maven-checkstyle-plugin | ||
# - license.skip => Skip all license header checks by license-maven-plugin | ||
# - xml.skip => Skip all XML/XSLT validation by xml-maven-plugin | ||
- type: "Integration Tests" | ||
mvnflags: "-DskipIntegrationTests=false -Denforcer.skip=true -Dcheckstyle.skip=true -Dlicense.skip=true -Dxml.skip=true" | ||
# Do NOT exit immediately if one matrix job fails | ||
# This ensures ITs continue running even if Unit Tests fail, or visa versa | ||
fail-fast: false | ||
# These are the actual CI steps to perform per job | ||
steps: | ||
# https://github.com/actions/checkout | ||
- name: Checkout codebase | ||
uses: actions/checkout@v1 | ||
|
||
# https://github.com/actions/setup-java | ||
- name: Install JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
|
||
# https://github.com/actions/cache | ||
- name: Cache Maven dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
# Cache entire ~/.m2/repository | ||
path: ~/.m2/repository | ||
# Cache key is hash of all pom.xml files. Therefore any changes to POMs will invalidate cache | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-maven- | ||
|
||
# Run parallel Maven builds based on the above 'strategy.matrix' | ||
- name: Run Maven ${{ matrix.type }} | ||
env: | ||
TEST_FLAGS: ${{ matrix.mvnflags }} | ||
run: mvn install -B -V -P-assembly -Pcoverage-report $TEST_FLAGS | ||
|
||
# https://github.com/codecov/codecov-action | ||
- name: Upload coverage to Codecov.io | ||
uses: codecov/codecov-action@v1 |
This file was deleted.
Oops, something went wrong.