Skip to content

Commit

Permalink
Add autobuild workind-directory test
Browse files Browse the repository at this point in the history
  • Loading branch information
cklin committed Apr 8, 2022
1 parent b0c570e commit 9541eae
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/__test-autobuild-working-dir.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions pr-checks/checks/test-autobuild-working-dir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Autobuild working directory"
description: "Tests working-directory input of autobuild action"
versions: ["latest"]
os: ["ubuntu-latest"]
steps:
- name: Test setup
shell: bash
run: |
# Make sure that Gradle build succeeds in autobuild-dir ...
cp -a ../action/tests/java-repo autobuild-dir
# ... and fails if attempted in the current directory
echo > build.gradle
- uses: ./../action/init
with:
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild
with:
working-directory: autobuild-dir
- uses: ./../action/analyze
env:
TEST_MODE: true
- name: Check database
shell: bash
run: |
cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d java ]]; then
ls -l
echo "Did not find a Java database"
exit 1
fi
12 changes: 12 additions & 0 deletions tests/java-repo/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id 'application'
}

repositories {
mavenCentral()
}

application {
mainClass = 'Main'
}

8 changes: 8 additions & 0 deletions tests/java-repo/src/main/java/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Main {
public static void main(String args[]) {
if (true) {
System.out.println("Hello, World!");
}
}
}

0 comments on commit 9541eae

Please sign in to comment.