-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use snapshot build in functional tests (#643)
### What's done: * Use snapshot build in CLI run * Removed functional tests workflow * Do not use github packages * Run all tests on different platforms
- Loading branch information
Showing
4 changed files
with
102 additions
and
144 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,12 @@ on: | |
pull_request | ||
|
||
jobs: | ||
test: | ||
name: Unit Test | ||
build_and_test_with_code_coverage: | ||
name: Build, test and upload code coverage | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
# actions/checkout v1.* is needed for correct codecov upload, see github issues for details | ||
- uses: actions/checkout@v1 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
|
@@ -31,3 +32,91 @@ jobs: | |
file: ./*/target/site/jacoco/jacoco.xml | ||
flags: unittests | ||
fail_ci_if_error: true # optional (default = false) | ||
- name: Upload diktat jar | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: diktat-ruleset | ||
path: diktat-ruleset/target/diktat-*.jar | ||
# no need to store artifact longer, it is used only by dependant jobs | ||
retention-days: 1 | ||
|
||
run_diktat_from_CLI: | ||
name: Run diktat via CLI | ||
runs-on: ${{ matrix.os }} | ||
needs: build_and_test_with_code_coverage | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Setup environment variables | ||
run: | | ||
cat pom.xml | grep "<version>.*</version>" | head -1 | awk -F'[><]' '{ printf "DIKTAT_VERSION=%s\n",$3 }' >> $GITHUB_ENV | ||
cat pom.xml | grep "<ktlint.version>.*</ktlint.version>" | head -1 | awk -F'[><]' '{ printf "KTLINT_VERSION=%s\n",$3 }' >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Setup environment | ||
run: | | ||
curl -sSLO https://github.com/pinterest/ktlint/releases/download/${{ env.KTLINT_VERSION }}/ktlint && chmod a+x ktlint | ||
shell: bash | ||
|
||
- name: Download diktat jar | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: diktat-ruleset | ||
|
||
- name: Run diKTat from cli | ||
continue-on-error: true | ||
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} | ||
run: | | ||
./ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar "examples/maven/src/main/kotlin/Test.kt" &> out | ||
shell: bash | ||
|
||
- name: Run diKTat from cli on windows | ||
continue-on-error: true | ||
if: runner.os == 'Windows' | ||
run: | | ||
java.exe -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar "examples/maven/src/main/kotlin/Test.kt" > out.txt 2>&1 | ||
shell: cmd | ||
|
||
- name: Check output | ||
id: cli-check | ||
run: | | ||
if [ -f out.txt ]; then mv out.txt out; fi | ||
cat out | ||
grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out | ||
shell: bash | ||
|
||
build_and_test: | ||
name: Build and test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.11 | ||
- name: Cache local Maven repository | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-build-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven-build- | ||
- name: Maven Install | ||
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} | ||
run: | | ||
mvn -B clean install | ||
shell: bash | ||
|
||
- name: Maven Install on windows | ||
if: runner.os == 'Windows' | ||
run: | | ||
mvn -B clean install | ||
shell: cmd |
This file was deleted.
Oops, something went wrong.
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