Skip to content
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

Feature/general update #86

Merged
merged 35 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ad1da28
Added handling of 429 error code("Rate limit exceeded")
Mar 6, 2019
27a9ade
Merge pull request #34 from deynekalex/handle_429_error
stritti Mar 7, 2019
28f60a4
bump versions of used libs
stritti Jul 4, 2019
16596bd
upgrade to gradle wrapper to v5.5.1
stritti Jul 11, 2019
27eccac
Merge remote-tracking branch 'origin/develop' into develop
stritti Jul 11, 2019
cf23d17
use openjdk 11 on travis build
stritti Jul 11, 2019
6119122
update codacy-coverage-reporter to v. 6.0.0
stritti Jul 11, 2019
9443a12
update gradle task for codacy
stritti Jul 11, 2019
f7152aa
fix: dependencies updated
stritti Apr 29, 2024
eb4caa8
chore: changes for new version
stritti May 21, 2024
9c1e148
chore(CI): GitLab Actions added
stritti May 21, 2024
942c779
chore(CI): GitLab Actions refactored
stritti May 21, 2024
0dee800
Merge branch 'master' into feature/general-update
stritti May 21, 2024
d6b2098
chore(CI): GitLab Actions refactored
stritti May 21, 2024
b529108
chore(CI): GitLab Actions versions updated
stritti May 21, 2024
8860f62
chore(CI): GitLab Action gradle run updated
stritti May 21, 2024
9ff30dd
chore(CI): GitLab Action gradle run updated
stritti May 21, 2024
2efd427
chore(CI): GitLab Action gradle run updated
stritti May 21, 2024
1467e53
chore(CI): GitLab Action gradle run updated
stritti May 21, 2024
bf4b2b1
chore(CI): GitLab Action gradle run updated
stritti May 21, 2024
81e0dcd
chore(CI): GitLab Action gradle run updated
stritti May 21, 2024
5e76254
chore(CI): split actions
stritti May 21, 2024
d2aae7d
chore(CI): split actions
stritti May 21, 2024
6247d15
chore(docs): missing comments added
stritti May 21, 2024
ece2dcd
fix(CI): invocation fix
stritti May 21, 2024
50c1c1a
fix(api): refactored
stritti May 21, 2024
f26d3d4
fix(itest): pass vars
stritti May 21, 2024
b17fbdd
fix(itest): pass vars
stritti May 21, 2024
4cc8455
chore(ci): scan added
stritti May 21, 2024
696e960
chore(ci): publish only releases
stritti May 21, 2024
419f739
chore(ci): publish only releases
stritti May 21, 2024
441c21a
fix(codacy): issues solved
stritti May 21, 2024
9951ddc
fix(codacy): issues solved
stritti May 21, 2024
ec9f199
chore: updated for personal access token
stritti May 21, 2024
0e532bb
fix: updated for personal access token
stritti May 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 32 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,48 @@ on:
pull_request:
branches: [master]

permissions:
checks: write
pull-requests: write

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 18
uses: actions/setup-java@v2
- uses: actions/checkout@v4
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '18'
distribution: 'temurin'
cache: gradle
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: -Pversion=${{ github.event.release.tag_name || '1.0-SNAPSHOT' }} build
- name: Run Tests
uses: gradle/gradle-build-action@v2
with:
arguments: test integrationTest
- name: Build
run: ./gradlew -Pversion=${{ github.event.release.tag_name || '1.0-SNAPSHOT' }} build -x check
- name: Unit Tests
run: ./gradlew -Pversion=${{ github.event.release.tag_name || '1.0-SNAPSHOT' }} test
- name: Integration Tests
run: ./gradlew -Pversion=${{ github.event.release.tag_name || '1.0-SNAPSHOT' }} integrationTest
env:
AIRTABLE_TOKEN: ${{ vars.AIRTABLE_TOKEN }}
AIRTABLE_BASE: ${{ vars.AIRTABLE_BASE }}
- name: Archive test report
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Test report
path: build/reports/tests/test
- name: Publish with Gradle
uses: gradle/gradle-build-action@v2
path: build/reports/tests
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
arguments: -Pversion=${{ github.event.release.tag_name || '1.0-SNAPSHOT' }} publish
files: |
build/test-results/**/*.xml
- name: Publish with Gradle
run: ./gradlew -Pversion=${{ github.event.release.tag_name || '1.0-SNAPSHOT' }} publish
if: github.event_name == 'release'
env:
ACTION_DEPLOY_USER: ${{ secrets.ACTION_DEPLOY_USER }}
ACTION_DEPLOY_TOKEN: ${{ secrets.ACTION_DEPLOY_TOKEN }}
ACTION_DEPLOY_USER: ${{ secrets.ACTION_DEPLOY_USER }}
ACTION_DEPLOY_TOKEN: ${{ secrets.ACTION_DEPLOY_TOKEN }}
4 changes: 0 additions & 4 deletions .nb-gradle-properties

This file was deleted.

Binary file not shown.
29 changes: 0 additions & 29 deletions .nb-gradle/profiles/private/aux-config

This file was deleted.

16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ access to Airtable:
Airtable airtable = new Airtable().configure();
```

### API-Key
### Personal Access Token

The API key could be passed to the app in different ways:
The personal access token could be passed to the app in different ways:

* Defining Java property `AIRTABLE_API_KEY` (e.g. `-DAIRTABLE_API_KEY=foo`).
* Defining OS environment variable `AIRTABLE_API_KEY` (e.g. `export AIRTABLE_API_KEY=foo`).
* Defining property file `credentials.properties` in root classpath containing key/value `AIRTABLE_API_KEY=foo`.
* On the other hand the API-key could also be added by using the method `Airtable.configure(String apiKey)`.
* Defining Java property `AIRTABLE_TOKEN` (e.g. `-DAIRTABLE_TOKEN=foo`).
* Defining OS environment variable `AIRTABLE_TOKEN` (e.g. `export AIRTABLE_TOKEN=foo`).
* Defining property file `credentials.properties` in root classpath containing key/value `AIRTABLE_TOKEN=foo`.
* On the other hand the token could also be added by using the method `Airtable.configure(String token)`.

#### How to get API-Key
#### How to get Personal Access Token

See: <https://support.airtable.com/hc/en-us/articles/219046777-How-do-I-get-my-API-key>-
See: <https://support.airtable.com//docs/creating-personal-access-tokens>-

### Proxy Support

Expand Down
136 changes: 64 additions & 72 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
* Permission is hereby granted, free of charge, to any person obtaining a copy
*/


plugins {
id "maven-publish"
id "jacoco"
id 'java-library'
id 'jacoco'
id 'idea'
id 'maven-publish'
id 'com.github.jk1.dependency-license-report' version '2.1'
}

apply plugin: 'java'

/*
* Gets the version name from the latest Git tag
*/
def getVersionName = { ->
try {
def stdout = new ByteArrayOutputStream()
Expand All @@ -28,101 +30,91 @@ def getVersionName = { ->
}
} as Object

group = 'com.sybit.airtable'
//version = getVersionName()
description = """API to access Airtable"""

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
group = 'com.sybit'
version = getVersionName()
description = "Java API for Airtable"

tasks.named("processTestResources") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.deprecation = true
options.compilerArgs += ['-Xlint:deprecation']
// options.compilerArgs += ['-Xlint:unchecked']
sourceCompatibility = 18
}

sourceSets {
integrationTest {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
// You can add other directories to the classpath like this:
//runtimeClasspath += files('src/itest/resources/com/buransky')
// Use "java" if you don't use Scala as a programming language
java.srcDir file('src/itest/java')

java {
srcDir file('src/itest/java')
}
resources {
srcDir file('src/itest/resources')
}
}
// This is just to trick IntelliJ IDEA to add integration test
// resources to classpath when running integration tests from
// the IDE. It's is not a good solution but I don't know about
// a better one.
test {
resources.srcDir file('src/itest/resources')
}

idea {
module {
testSources.from(sourceSets.integrationTest.java.srcDirs)
}
}

repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://dl.bintray.com/typesafe/maven-releases" }
}

configurations {
codacy
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
integrationTestImplementation.extendsFrom implementation, testImplementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly, testRuntimeOnly
}

dependencies {
implementation group: 'com.konghq', name: 'unirest-java', version: '3.14.5'
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.14'
implementation group: 'org.json', name: 'json', version: '20230227'
implementation group: 'com.google.code.gson', name: 'gson', version:'2.9.1'
implementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
implementation group: 'org.slf4j', name: 'slf4j-api', version:'2.0.7'

testImplementation group: 'junit', name: 'junit', version:'4.13.2'
testImplementation group: 'com.github.tomakehurst', name: 'wiremock', version:'2.23.2'
testImplementation group: 'org.slf4j', name: 'slf4j-jdk14', version:'2.0.6'

codacy 'com.github.codacy:codacy-coverage-reporter:-SNAPSHOT'
implementation 'com.konghq:unirest-java:3.14.5'
implementation 'org.apache.httpcomponents.client5:httpclient5:5.3.1'
implementation 'org.json:json:20240303'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'commons-beanutils:commons-beanutils:1.9.4'
implementation 'commons-io:commons-io:2.16.1'
implementation 'org.slf4j:slf4j-api:2.0.7'

testImplementation 'junit:junit:4.13.2'
testImplementation 'com.github.tomakehurst:wiremock:3.0.1'
testImplementation 'org.slf4j:slf4j-jdk14:2.0.6'

testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.8.2'
}


test {
useJUnit()
java {
withSourcesJar()
withJavadocJar()
}

// custom tasks for creating source jar
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
// custom tasks for creating javadoc jar
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
tasks.named('test') {
useJUnitPlatform()
finalizedBy jacocoTestReport
}

// add javadoc/source jar tasks as artifacts
artifacts {
archives sourcesJar, javadocJar
tasks.named('jacocoTestReport') {
reports {
xml.required = true
}
}

//task to send coverage data to Codacy
task sendCoverageToCodacy(type: JavaExec, dependsOn: jacocoTestReport) {
mainClass = "com.codacy.CodacyCoverageReporter"
classpath = configurations.codacy
args = [
"report",
"-l",
"Java",
"-r",
"${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
]
}
tasks.register('integrationTest', Test) {
description = 'Runs integration tests.'
group = 'verification'

testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath

shouldRunAfter test
useJUnitPlatform()

task integrationTest(type: Test) {
// This is not needed, but I like to see which tests have run
testLogging {
events "passed", "skipped", "failed"
}
Expand Down Expand Up @@ -196,4 +188,4 @@ publishing {
}
}

integrationTest.mustRunAfter test
check.dependsOn integrationTest
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Thu Apr 13 17:03:46 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading