diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..9836e50 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,54 @@ +name: CI Build + +permissions: + contents: write +on: + push: + branches: + - master + +jobs: + build: + name: Building java-curl on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + steps: + - uses: graalvm/setup-graalvm@v1 + with: + version: "latest" + java-version: "17" + components: "native-image" + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: checkout + uses: actions/checkout@v2 + - name: create the native image + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: mvn -ntp -DskipTests -Pnative package + - name: rename + if: matrix.os == 'ubuntu-latest' + run: mv target/java-curl java-curl-${{ matrix.os }} + - name: rename + if: matrix.os == 'macos-latest' + run: mv target/java-curl java-curl-${{ matrix.os }} + - name: rename + if: matrix.os == 'windows-latest' + run: mv target/java-curl.exe java-curl-${{ matrix.os }}.exe + + - name: Upload binary + uses: actions/upload-artifact@v2 + with: + name: java-curl-${{ matrix.os }} + path: target/java-curl + + - name: Release with Notes + uses: softprops/action-gh-release@v1 + with: +# draft: true + tag_name: ${{ github.run_number }}.${{ github.run_id }} + target_commitish: ${{ github.sha }} + files: | + java-curl* + diff --git a/.gitignore b/.gitignore index adb5daa..3c84eb8 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ hs_err_pid* java-curl.iml .idea target +.vscode \ No newline at end of file diff --git a/README.md b/README.md index 4d5eecc..7fe7bbe 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ java-curl is a pure-java HTTP utility implemented based on HttpURLConnection in the standard JRE, while the usage references to the commonly-used CURL command line tool under Linux. # Features -* Based on the standard JRE, the source compatibility level is 1.6, can be used on Java server-side, Android and other Java environments. +* Based on the standard JRE, the source compatibility level is 11, can be used on Java server-side, Android and other Java environments. * The code is super compact (one java file with less than 2000 lines), without any external dependencies, can be easily reused at source level. * Easy to use, fully compatible with the most common switches of CURL tool, can be directly used as a command line tool. * Support all HTTP methods; Support multi-part file uploads; Support simple HTTP authentication. diff --git a/pom.xml b/pom.xml index 78cf573..69ab35e 100644 --- a/pom.xml +++ b/pom.xml @@ -55,8 +55,8 @@ maven-compiler-plugin 3.1 - 8 - 8 + 17 + 17 @@ -168,4 +168,49 @@ + + + graalvm-native-build-tools-snapshots + GraalVM native-build-tools Snapshots + https://raw.githubusercontent.com/graalvm/native-build-tools/snapshots + + false + + + true + + + + + + + native + + + + org.graalvm.buildtools + native-maven-plugin + 0.10.1 + true + + + build-native + + build + + package + + + + com.roxstudio.utils.CUrl + + --no-fallback + + + + + + + +