-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run functional tests on different OS #633
Merged
Merged
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
533e553
Improvements for CI workflows
petertrr 1934b98
Improvements for CI workflows
petertrr c56da04
Improvements for CI workflows
petertrr d772235
Update functional_tests.yml
petertrr 0ef6318
Update functional_tests.yml
petertrr 08f3ea6
Update functional_tests.yml
petertrr 4524f1a
Update functional_tests.yml
petertrr a8a4ddd
CI improvements
petertrr c0aa74e
CI improvements
petertrr b538e1c
Merge branch 'master' into infra/ci-refactoring#626
petertrr afe3524
CI improvements
petertrr 8d5d4c1
CI improvements
petertrr b8607ac
CI improvements
petertrr 2da4f0c
CI improvements
petertrr 44cccd4
CI improvements
petertrr dadfd72
CI improvements
petertrr 2d35864
CI improvements
petertrr d2bfd51
CI improvements
petertrr b34e3f1
CI improvements
petertrr 47825b0
CI improvements
petertrr fb80511
Merge branch 'master' into infra/ci-refactoring#626
petertrr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do we use ubuntu-latest, but previously we were using ubuntu-20.04?
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.
It shouldn't matter much, currently
ubuntu-latest
is 18.04, but github has already announced it will be changed to 20.04 soon. I thought that since I introduce other OS here, it will be easier to just uselatest
tag and not manage specific versions for all environments. And since diktat is a JVM application, it should run on all recent distros.