diff --git a/.gitattributes b/.gitattributes index 9519524e..8e9e6f56 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,8 @@ *.sh text eol=lf .github/workflows/broken_links_checker.yml linguist-generated=true +.github/workflows/ci-build.yml linguist-generated=true .github/workflows/dependencies_check.yml linguist-generated=true .github/workflows/dependencies_update.yml linguist-generated=true -.github/workflows/release_droid_print_quick_checksum.yml linguist-generated=true .github/workflows/release.yml linguist-generated=true .settings/org.eclipse.jdt.core.prefs linguist-generated=true .settings/org.eclipse.jdt.ui.prefs linguist-generated=true diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 8ab9549b..05866e36 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -1,68 +1,81 @@ +# This file was generated by Project Keeper. name: CI Build on: push: - branches: - - main - pull_request: - + branches: [ + main + ] + + pull_request: null jobs: matrix-build: runs-on: ubuntu-20.04 - concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.exasol_db_version }} + defaults: + run: { + shell: bash + } + permissions: { + contents: read, + checks: write + } + concurrency: { + group: '${{ github.workflow }}-${{ github.ref }}-${{ matrix.exasol_db_version }}', cancel-in-progress: true + } strategy: fail-fast: false matrix: - exasol_db_version: ["8.24.0", "7.1.25"] - env: - DEFAULT_EXASOL_DB_VERSION: "8.24.0" + exasol_db_version: [ + 8.24.0, + 7.1.26 + ] + + env: { + DEFAULT_EXASOL_DB_VERSION: 8.24.0 + } steps: - name: Free Disk Space + id: free-disk-space + if: ${{ true }} run: | sudo rm -rf /usr/local/lib/android sudo rm -rf /usr/share/dotnet - name: Checkout the repository + id: checkout uses: actions/checkout@v4 - with: + with: { fetch-depth: 0 + } - name: Set up JDKs + id: setup-java uses: actions/setup-java@v4 with: - distribution: "temurin" + distribution: temurin java-version: | 11 17 - cache: "maven" + cache: maven - name: Cache SonarCloud packages + id: cache-sonar uses: actions/cache@v4 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "1.22" - cache: false - - - name: Cache Go modules - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('pom.xml') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Enable testcontainer reuse + with: { + path: ~/.sonar/cache, + key: '${{ runner.os }}-sonar', + restore-keys: '${{ runner.os }}-sonar' + } + - { + name: Enable testcontainer reuse, + id: enable-testcontainer-reuse, run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties" - - name: Run scalafix linting - if: ${{ matrix.exasol_db_version == env.DEFAULT_EXASOL_DB_VERSION }} - run: mvn --batch-mode clean compile test-compile scalastyle:check scalafix:scalafix spotless:check + } + - { + name: Run scalafix linting, + id: run-scalafix-linting, + if: '${{ matrix.exasol_db_version == env.DEFAULT_EXASOL_DB_VERSION }}', + run: 'mvn --batch-mode clean compile test-compile scalastyle:check scalafix:scalafix spotless:check' + } - name: Build extension + id: build-extension run: | mvn --batch-mode package -DskipTests cd extension @@ -71,33 +84,97 @@ jobs: npm run test npm run lint - name: Run tests and build with Maven + id: build-pk-verify run: | mvn --batch-mode verify \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ -DtrimStackTrace=false \ -Dcom.exasol.dockerdb.image=${{ matrix.exasol_db_version }} - env: - # Set additional environment variable as in scala projects the scalatest plugin does not forward - # the system property -Dcom.exasol.dockerdb.image to the test's implementation. - EXASOL_DB_VERSION: ${{ matrix.exasol_db_version }} - - name: Publish Test Report for Exasol ${{ matrix.exasol_db_version }} - uses: scacap/action-surefire-report@v1 - if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + env: { + EXASOL_DB_VERSION: '${{ matrix.exasol_db_version }}' + } - name: Sonar analysis + id: sonar-analysis if: ${{ env.SONAR_TOKEN != null && matrix.exasol_db_version == env.DEFAULT_EXASOL_DB_VERSION }} run: | mvn --batch-mode org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ -DtrimStackTrace=false \ -Dsonar.token=$SONAR_TOKEN - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - + env: { + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}', + SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}' + } + - name: Verify Release Artifacts + id: verify-release-artifacts + run: "print_message() {\n local -r message=$1\n echo \"$message\"\n echo \"$message\" >> \"$GITHUB_STEP_SUMMARY\"\n}\n\nprint_message \"### Release Artifacts\"\n\nIFS=$'\\n' artifacts_array=($ARTIFACTS)\nmissing_files=()\nfor file in \"${artifacts_array[@]}\";\ndo \n echo \"Checking if file $file exists...\"\n if ! [[ -f \"$file\" ]]; then\n print_message \"* ⚠️ \\`$file\\` does not exist ⚠️\"\n echo \"Content of directory $(dirname \"$file\"):\"\n ls \"$(dirname \"$file\")\"\n missing_files+=(\"$file\")\n else\n print_message \"* \\`$file\\` ✅\" \n fi\ndone\nprint_message \"\"\nnumber_of_missing_files=${#missing_files[@]}\nif [[ $number_of_missing_files -gt 0 ]]; then\n print_message \"⚠️ $number_of_missing_files release artifact(s) missing ⚠️\"\n exit 1\nfi\n" + env: { + ARTIFACTS: '${{ steps.build-pk-verify.outputs.release-artifacts }}' + } + - name: Upload artifacts + id: upload-artifacts + uses: actions/upload-artifact@v4 + with: { + name: 'artifacts-exasol-${{ matrix.exasol_db_version }}', + path: '${{ steps.build-pk-verify.outputs.release-artifacts }}', + retention-days: 5 + } build: needs: matrix-build runs-on: ubuntu-latest + defaults: + run: { + shell: bash + } + permissions: { + contents: read, + issues: read + } + outputs: { + release-required: '${{ steps.check-release.outputs.release-required }}' + } steps: - - run: echo "Build successful" + - name: Checkout the repository + uses: actions/checkout@v4 + with: { + fetch-depth: 0 + } + - name: Set up JDKs + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: | + 11 + 17 + cache: maven + - name: Check if release is needed + id: check-release + run: | + if mvn --batch-mode com.exasol:project-keeper-maven-plugin:verify-release --projects .; then + echo "### ✅ Release preconditions met, start release" >> "$GITHUB_STEP_SUMMARY" + echo "release-required=true" >> "$GITHUB_OUTPUT" + else + echo "### 🛑 Not all release preconditions met, skipping release" >> "$GITHUB_STEP_SUMMARY" + echo "See log output for details." >> "$GITHUB_STEP_SUMMARY" + echo "release-required=false" >> "$GITHUB_OUTPUT" + fi + env: { + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + } + start_release: + needs: build + if: ${{ github.ref == 'refs/heads/main' && needs.build.outputs.release-required == 'true' }} + concurrency: { + cancel-in-progress: false, + group: release + } + secrets: inherit + permissions: { + contents: write, + actions: read, + issues: read + } + uses: ./.github/workflows/release.yml + with: { + started-from-ci: true + } diff --git a/.project-keeper.yml b/.project-keeper.yml index b513b8ed..6c0822db 100644 --- a/.project-keeper.yml +++ b/.project-keeper.yml @@ -6,19 +6,53 @@ sources: - integration_tests - type: npm path: extension/package.json + artifacts: + - dist/cloud-storage-extension.js version: fromSource: pom.xml linkReplacements: excludes: - # Customization needed to build and release extension - - "W-PK-CORE-153: Project-keeper version 4.1.0 is outdated. Please update project-keeper to latest version 4.2.0." - - "E-PK-CORE-18: Outdated content: '.github/workflows/ci-build.yml'" - "E-PK-CORE-18: Outdated content: '.github/workflows/ci-build-next-java.yml'" - - "E-PK-CORE-18: Outdated content: '.github/workflows/release_droid_upload_github_release_assets.yml'" - - "E-PK-CORE-18: Outdated content: '.github/workflows/release_droid_prepare_original_checksum.yml'" + - "E-PK-CORE-17: Missing required file: 'release_config.yml'" build: runnerOs: ubuntu-20.04 - freeDiskSpace: false + freeDiskSpace: true exasolDbVersions: - "8.24.0" - - "7.1.25" + - "7.1.26" + workflows: + - name: ci-build.yml + stepCustomizations: + - action: INSERT_AFTER + stepId: enable-testcontainer-reuse + content: + name: Run scalafix linting + id: run-scalafix-linting + if: ${{ matrix.exasol_db_version == env.DEFAULT_EXASOL_DB_VERSION }} + run: mvn --batch-mode clean compile test-compile scalastyle:check scalafix:scalafix spotless:check + - action: INSERT_AFTER + stepId: run-scalafix-linting + content: + name: Build extension + id: build-extension + run: | + mvn --batch-mode package -DskipTests + cd extension + npm ci + npm run build + npm run test + npm run lint + - action: REPLACE + stepId: build-pk-verify + content: + name: Run tests and build with Maven + id: build-pk-verify + run: | + mvn --batch-mode verify \ + -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ + -DtrimStackTrace=false \ + -Dcom.exasol.dockerdb.image=${{ matrix.exasol_db_version }} + env: + # Set additional environment variable as in scala projects the scalatest plugin does not forward + # the system property -Dcom.exasol.dockerdb.image to the test's implementation. + EXASOL_DB_VERSION: ${{ matrix.exasol_db_version }} diff --git a/release_config.yml b/release_config.yml deleted file mode 100644 index 45f75e82..00000000 --- a/release_config.yml +++ /dev/null @@ -1,3 +0,0 @@ -release-platforms: - - GitHub -language: Java