diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 39cb80c..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,121 +0,0 @@ -version: 2.1 - -orbs: - win: circleci/windows@1.0.0 - -workflows: - test: - jobs: - - build-linux - - test-linux: - name: Java 8 - Linux - OpenJDK - docker-image: cimg/openjdk:8.0 - requires: - - build-linux - - test-linux: - name: Java 11 - Linux - OpenJDK - docker-image: cimg/openjdk:11.0 - requires: - - build-linux - - test-linux: - name: Java 17 - Linux - OpenJDK - docker-image: cimg/openjdk:17.0 - requires: - - build-linux - - test-linux: - name: Java 19 - Linux - OpenJDK - docker-image: cimg/openjdk:19.0 - requires: - - build-linux - - build-test-windows: - name: Java 11 - Windows - OpenJDK - openjdk-version: 11.0.2.01 - - build-test-windows: - name: Java 17 - Windows - OpenJDK - openjdk-version: 17.0.1 - -jobs: - build-linux: - docker: - - image: cimg/openjdk:8.0 - steps: - - checkout - - run: cp gradle.properties.example gradle.properties - - run: java -version - - run: ./gradlew dependencies - - run: ./gradlew jar - - run: ./gradlew javadoc - - run: ./gradlew checkstyleMain - - persist_to_workspace: - root: build - paths: - - classes - - test-linux: - parameters: - docker-image: - type: string - docker: - - image: <> - - image: amazon/dynamodb-local - steps: - - checkout - - run: cp gradle.properties.example gradle.properties - - attach_workspace: - at: build - - run: java -version - - run: ./gradlew test - - run: - name: Save test results - command: | - mkdir -p ~/junit/; - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \; - when: always - - store_test_results: - path: ~/junit - - store_artifacts: - path: ~/junit - - build-test-windows: - parameters: - openjdk-version: - type: string - executor: - name: win/vs2019 - shell: powershell.exe - steps: - - checkout - - run: - name: uninstall previous openjdk - command: choco uninstall openjdk - - run: - name: install OpenJDK - command: choco install openjdk --version <> - - run: java -version - - run: - name: set up DynamoDB - command: | - $ProgressPreference = "SilentlyContinue" - iwr -outf dynamo.zip https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip - mkdir dynamo - Expand-Archive -Path dynamo.zip -DestinationPath dynamo - - run: - name: run DynamoDB - command: | - cd dynamo - javaw -D"java.library.path=./DynamoDBLocal_lib" -jar DynamoDBLocal.jar - background: true - - run: - name: build and test - command: | - cp gradle.properties.example gradle.properties - .\gradlew.bat --no-daemon test # must use --no-daemon because CircleCI in Windows will hang if there's a daemon running - - run: - name: save test results - command: | - mkdir .\junit - cp build/test-results/test/*.xml junit - - store_test_results: - path: .\junit - - store_artifacts: - path: .\junit diff --git a/.github/actions/ci/action.yml b/.github/actions/ci/action.yml new file mode 100644 index 0000000..4e742c3 --- /dev/null +++ b/.github/actions/ci/action.yml @@ -0,0 +1,70 @@ +name: Shared CI Workflow + +inputs: + java_version: + description: 'The Java version to use.' + required: true + java_distribution: + description: 'The Java distribution to use.' + required: false + default: temurin + os_type: + description: 'The OS type to use.' + required: false + default: ubuntu + options: + - ubuntu + - windows + +runs: + using: composite + steps: + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: ${{ inputs.java_distribution }} + java-version: ${{ inputs.java_version }} + + - name: Copy gradle.properties + shell: bash + run: | + cp gradle.properties.example gradle.properties + + - name: Setup DynamoDB Service + if: inputs.os_type == 'ubuntu' + shell: bash + run: | + sudo docker run -d -p 8000:8000 amazon/dynamodb-local + + - name: Setup DynamoDB Service + if: inputs.os_type == 'windows' + shell: pwsh + run: | + $ProgressPreference = "SilentlyContinue" + iwr -outf dynamo.zip https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip + mkdir dynamo + Expand-Archive -Path dynamo.zip -DestinationPath dynamo + cd dynamo + Start-Process -FilePath "java" -ArgumentList "-D`"java.library.path=./DynamoDBLocal_lib`"","-jar","DynamoDBLocal.jar" + + - name: Restore Dependencies + shell: bash + run: ./gradlew dependencies + + - name: Build Jar + shell: bash + id: buildjar + run: ./gradlew jar + + - name: Build Documentation + shell: bash + run: ./gradlew javadoc + + - name: Check Style + shell: bash + run: ./gradlew checkstyleMain + + - name: Run Tests + if: steps.buildjar.outcome == 'success' + shell: bash + run: ./gradlew test diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..163ca90 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,42 @@ +name: Build and Test + +on: + push: + branches: [main, feat/**] + paths-ignore: + - '**.md' #Do not need to run CI for markdown changes. + pull_request: + branches: [main, feat/**] + paths-ignore: + - '**.md' + +jobs: + build-test-linux: + strategy: + matrix: + os: [ubuntu-latest] + javaversion: [8, 11, 17, 19] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - name: Shared CI Steps + uses: ./.github/actions/ci + with: + os_type: ubuntu + java_version: ${{ matrix.javaversion }} + + build-test-windows: + strategy: + matrix: + os: [windows-latest] + javaversion: [11, 17] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - name: Shared CI Steps + uses: ./.github/actions/ci + with: + os_type: windows + java_version: ${{ matrix.javaversion }}