-
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.
Run functional tests on different OS (#633)
### What's done: * Split different diktat runners in functional_tests.yml * Specify ubuntu version explicitly * matrix.os in functional_tests.yml * Removed explicit env vars from functional_tests.yml * Use cmd on windows
- Loading branch information
Showing
3 changed files
with
88 additions
and
27 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 |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
|
||
jobs: | ||
diktat_check: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ env: | |
|
||
jobs: | ||
diktat_snapshot_check: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
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 |
---|---|---|
|
@@ -7,74 +7,135 @@ on: | |
branches: [ master ] | ||
|
||
env: | ||
DIKTAT_VERSION: 0.1.7 | ||
KTLINT_VERSION: 0.39.0 | ||
GRADLE_OPTS: -Dorg.gradle.daemon=false # to speed up gradle run | ||
|
||
jobs: | ||
run-functional-tests: | ||
runs-on: ubuntu-latest | ||
run_diktat_from_CLI: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Setup environment | ||
- name: Setup environment variables | ||
run: | | ||
cat pom.xml | grep "<diktat-check.version>.*</diktat-check.version>" | head -1 |awk -F'[><]' '{ENVIRON[DIKTAT_VERSION]=$3 ; print ENVIRON[DIKTAT_VERSION]}' | ||
cat pom.xml | grep "<ktlint.version>.*</ktlint.version>" | head -1 |awk -F'[><]' '{ENVIRON[KTLINT_VERSION]=$3 ; print ENVIRON[KTLINT_VERSION]}' | ||
curl -sSLO https://github.com/pinterest/ktlint/releases/download/$KTLINT_VERSION/ktlint && chmod a+x ktlint | ||
curl -sSLO https://github.com/cqfn/diKTat/releases/download/v$DIKTAT_VERSION/diktat-$DIKTAT_VERSION.jar | ||
cat pom.xml | grep "<diktat-check.version>.*</diktat-check.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 | ||
curl -sSLO https://github.com/cqfn/diKTat/releases/download/v${{ env.DIKTAT_VERSION }}/diktat-${{ env.DIKTAT_VERSION }}.jar | ||
shell: bash | ||
|
||
- name: Copy diktat-analysis.yml from release | ||
run: | | ||
unzip -q -d tmp diktat-$DIKTAT_VERSION.jar | ||
unzip -q -d tmp diktat-${{ env.DIKTAT_VERSION }}.jar | ||
DIKTAT_CONFIG=diktat-analysis.yml | ||
md5sum $DIKTAT_CONFIG | ||
find tmp -name $DIKTAT_CONFIG -exec cp "{}" . \; | ||
md5sum $DIKTAT_CONFIG | ||
shell: bash | ||
|
||
- 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: | | ||
./ktlint -R diktat-$DIKTAT_VERSION.jar "examples/maven/src/main/kotlin/Test.kt" &> out | ||
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 | ||
|
||
- name: Run diKTat from gradle kotlin DSL | ||
continue-on-error: true | ||
working-directory: ./examples/gradle-kotlin-dsl | ||
run_diktat_from_gradle: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
dir: [ ./examples/gradle-kotlin-dsl, ./examples/gradle-groovy-dsl ] | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Setup environment variables | ||
run: | | ||
gradle diktatCheck &> out | ||
cat pom.xml | grep "<diktat-check.version>.*</diktat-check.version>" | head -1 | awk -F'[><]' '{ printf "DIKTAT_VERSION=%s\n",$3 }' >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Check gradle from kotlin DSL | ||
working-directory: ./examples/gradle-kotlin-dsl | ||
- name: Setup environment | ||
run: | | ||
cat out | ||
grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out | ||
curl -sSLO https://github.com/cqfn/diKTat/releases/download/v${{ env.DIKTAT_VERSION }}/diktat-${{ env.DIKTAT_VERSION }}.jar | ||
unzip -q -d tmp diktat-${{ env.DIKTAT_VERSION }}.jar | ||
DIKTAT_CONFIG=diktat-analysis.yml | ||
find tmp -name $DIKTAT_CONFIG -exec cp "{}" . \; | ||
shell: bash | ||
|
||
- name: Run diKTat from gradle groovy DSL | ||
- name: Run diKTat from gradle | ||
continue-on-error: true | ||
working-directory: ./examples/gradle-groovy-dsl | ||
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} | ||
working-directory: ${{ matrix.dir }} | ||
run: | | ||
gradle diktatCheck &> out | ||
shell: bash | ||
|
||
- name: Run diKTat from gradle on windows | ||
continue-on-error: true | ||
if: runner.os == 'Windows' | ||
working-directory: ${{ matrix.dir }} | ||
run: | | ||
gradle.exe diktatCheck > out.txt 2>&1 | ||
shell: cmd | ||
|
||
- name: Check gradle from groovy DSL | ||
working-directory: ./examples/gradle-groovy-dsl | ||
- name: Check gradle | ||
working-directory: ${{ matrix.dir }} | ||
run: | | ||
if [ -f out.txt ]; then mv out.txt out; fi | ||
cat out | ||
grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out | ||
shell: bash | ||
|
||
run_diktat_from_maven: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Setup environment variables | ||
run: | | ||
cat pom.xml | grep "<diktat-check.version>.*</diktat-check.version>" | head -1 | awk -F'[><]' '{ printf "DIKTAT_VERSION=%s\n",$3 }' >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Setup environment | ||
run: | | ||
curl -sSLO https://github.com/cqfn/diKTat/releases/download/v${{ env.DIKTAT_VERSION }}/diktat-${{ env.DIKTAT_VERSION }}.jar | ||
unzip -q -d tmp diktat-${{ env.DIKTAT_VERSION }}.jar | ||
DIKTAT_CONFIG=diktat-analysis.yml | ||
find tmp -name $DIKTAT_CONFIG -exec cp "{}" . \; | ||
shell: bash | ||
|
||
- name: Run diKTat from maven | ||
working-directory: ./examples/maven | ||
continue-on-error: true | ||
run: mvn -B diktat:check &> out | ||
shell: bash | ||
|
||
- name: Check maven | ||
working-directory: ./examples/maven | ||
run: | | ||
cat out | ||
grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out | ||
shell: bash |
cf7e9de
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to retrieve PDD puzzles from the code base and submit them to GitHub. If you think that it's a bug on our side, please submit it to yegor256/0pdd:
Please, copy and paste this stack trace to GitHub: