-
Notifications
You must be signed in to change notification settings - Fork 40
Add a dedicated CI workflow for data loader CLI #2761
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
Changes from 5 commits
1a8a8c7
a0ba5e3
98d6f49
640623e
dd7d87f
fe4761c
0b40a16
6aa5a34
6def419
b0549f6
30da066
be8e0e2
1a64df6
0859ca6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,45 @@ | ||||||||||||||||||||||||
| name: CI for CLI | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||
| data_loader_ci: | ||||||||||||||||||||||||
| name: Build Data Loader CLI | ||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - uses: actions/checkout@v2 | ||||||||||||||||||||||||
ypeckstadt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Set version | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| id: version | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| VERSION=$(echo "${GITHUB_REF}" | sed -e "s#refs/tags/v##g") | ||||||||||||||||||||||||
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||
| - name: Set up JDK 8 and 11 (default 8) | ||||||||||||||||||||||||
| uses: actions/setup-java@v4 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| distribution: 'temurin' | ||||||||||||||||||||||||
| java-version: | | ||||||||||||||||||||||||
| 11 | ||||||||||||||||||||||||
| 8 | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| - name: Cache Gradle packages | ||||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| path: | | ||||||||||||||||||||||||
| ~/.gradle/caches | ||||||||||||||||||||||||
| ~/.gradle/wrapper | ||||||||||||||||||||||||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||||
| ${{ runner.os }}-gradle- | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 |
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.
Updated
Outdated
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.
Can you add a newline?
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.
Added
Outdated
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.
If you follow my suggestion of using gradle/actions/setup-gradle@v4, this is not necessary.
| - name: Cleanup Gradle cache | |
| run: | | |
| rm -f ~/.gradle/caches/modules-2/modules-2.lock | |
| rm -f ~/.gradle/caches/modules-2/gc.properties |
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.
Updated
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ javadoc { | |
|
|
||
| // Build a fat jar | ||
| shadowJar { | ||
| mustRunAfter distZip, distTar | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is added via other PR so can be ignored here. |
||
| archiveClassifier.set("") | ||
| manifest { | ||
| attributes 'Main-Class': 'com.scalar.db.dataloader.DataLoaderCli' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,12 @@ | |
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.nio.file.Paths; | ||
| import java.nio.file.attribute.PosixFilePermission; | ||
| import java.util.HashSet; | ||
| import java.util.Set; | ||
| import java.util.stream.Stream; | ||
| import org.junit.jupiter.api.AfterEach; | ||
| import org.junit.jupiter.api.Assumptions; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.io.TempDir; | ||
| import org.slf4j.Logger; | ||
|
|
@@ -44,13 +48,25 @@ void validateOrCreateTargetDirectory_DirectoryDoesNotExist_CreatesDirectory() | |
| @Test | ||
| void validateOrCreateTargetDirectory_DirectoryNotWritable_ThrowsException() throws IOException { | ||
| Path readOnlyDirectory = Files.createDirectory(Paths.get(tempDir.toString(), "readOnlyDir")); | ||
| readOnlyDirectory.toFile().setWritable(false); | ||
|
|
||
| // Try to make it read-only using POSIX if supported | ||
|
||
| try { | ||
| Set<PosixFilePermission> perms = new HashSet<>(); | ||
| perms.add(PosixFilePermission.OWNER_READ); | ||
| perms.add(PosixFilePermission.OWNER_EXECUTE); | ||
| Files.setPosixFilePermissions(readOnlyDirectory, perms); | ||
| } catch (UnsupportedOperationException | IOException e) { | ||
| // Fall back for systems without POSIX support | ||
| readOnlyDirectory.toFile().setWritable(false); | ||
| } | ||
| // Verify it is actually non-writable | ||
| boolean isWritable = Files.isWritable(readOnlyDirectory); | ||
| Assumptions.assumeFalse(isWritable, "Directory is still writable; skipping test."); | ||
|
|
||
| // Test | ||
| assertThrows( | ||
| DirectoryValidationException.class, | ||
| () -> { | ||
| DirectoryUtils.validateOrCreateTargetDirectory(readOnlyDirectory.toString()); | ||
| }); | ||
| () -> DirectoryUtils.validateOrCreateTargetDirectory(readOnlyDirectory.toString())); | ||
| } | ||
|
|
||
| @Test | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.