From 50ff68fb894172bc85e2e4a941cd90db7a1e4708 Mon Sep 17 00:00:00 2001 From: Peter Adams <63288215+PeterAdams-A@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:22:23 +0000 Subject: [PATCH] Set up Github Actions (#37) Motivation: CI is moving to Github Actions Modifications: Create Github Actions workflows Result: GHA used for CI --- .flake8 | 12 ++ .github/workflows/main.yml | 18 +++ .github/workflows/pull_request.yml | 31 +++++ .github/workflows/pull_request_label.yml | 18 +++ .github/workflows/scheduled.yml | 14 +++ .licenseignore | 52 +++++++++ .yamllint.yml | 25 ++++ CONTRIBUTING.md | 27 +---- docker/Dockerfile | 27 ----- docker/docker-compose-dev.yaml | 68 ----------- docker/docker-compose.2004.54.yaml | 22 ---- docker/docker-compose.2004.55.yaml | 22 ---- docker/docker-compose.2004.56.yaml | 22 ---- docker/docker-compose.2004.57.yaml | 22 ---- docker/docker-compose.2004.58.yaml | 22 ---- docker/docker-compose.2204.510.yaml | 21 ---- docker/docker-compose.2204.59.yaml | 22 ---- docker/docker-compose.2204.main.yaml | 21 ---- docker/docker-compose.yaml | 77 ------------ scripts/generate_contributors_list.sh | 53 --------- scripts/gha_run_unit_tests.sh | 40 +++++++ scripts/preview_docc.sh | 30 ----- scripts/soundness.sh | 143 ----------------------- 23 files changed, 213 insertions(+), 596 deletions(-) create mode 100644 .flake8 create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/pull_request.yml create mode 100644 .github/workflows/pull_request_label.yml create mode 100644 .github/workflows/scheduled.yml create mode 100644 .licenseignore create mode 100644 .yamllint.yml delete mode 100644 docker/Dockerfile delete mode 100644 docker/docker-compose-dev.yaml delete mode 100644 docker/docker-compose.2004.54.yaml delete mode 100644 docker/docker-compose.2004.55.yaml delete mode 100644 docker/docker-compose.2004.56.yaml delete mode 100644 docker/docker-compose.2004.57.yaml delete mode 100644 docker/docker-compose.2004.58.yaml delete mode 100644 docker/docker-compose.2204.510.yaml delete mode 100644 docker/docker-compose.2204.59.yaml delete mode 100644 docker/docker-compose.2204.main.yaml delete mode 100644 docker/docker-compose.yaml delete mode 100755 scripts/generate_contributors_list.sh create mode 100755 scripts/gha_run_unit_tests.sh delete mode 100755 scripts/preview_docc.sh delete mode 100755 scripts/soundness.sh diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..40fef02 --- /dev/null +++ b/.flake8 @@ -0,0 +1,12 @@ +[flake8] + +ignore = + # These are needed to make our license headers pass the linting + E265, + E266, + +# 10% larger than the standard 80 character limit. Conforms to the black +# standard and Bugbear's B950. +max-line-length = 88 +exclude = + Sources/Clibuv/libuv diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..6cb3eee --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,18 @@ +name: Main + +on: + push: + branches: [main] + +jobs: + unit-tests: + name: Unit Tests + # Workaround https://github.com/nektos/act/issues/1875 + uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main + with: + name: "Unit tests" + matrix_linux_command: "I_AM_RUNNING_IN_CI=true ./scripts/gha_run_unit_tests.sh" + + cxx-interop: + name: Cxx interop + uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..00c0baf --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,31 @@ +name: PR + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + soundness: + name: Soundness + uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main + with: + license_header_check_project_name: "Swift Cassandra Client" + api_breakage_check_enabled: false + format_check_enabled: false + + unit-tests: + name: Unit Tests + # Workaround https://github.com/nektos/act/issues/1875 + uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main + with: + name: "Unit tests" + matrix_linux_command: "I_AM_RUNNING_IN_CI=true ./scripts/gha_run_unit_tests.sh" + + cxx-interop: + name: Cxx interop + uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main + + swift-6-language-mode: + name: Swift 6 Language Mode + uses: apple/swift-nio/.github/workflows/swift_6_language_mode.yml@main + if: false # Disabled for now. diff --git a/.github/workflows/pull_request_label.yml b/.github/workflows/pull_request_label.yml new file mode 100644 index 0000000..86f199f --- /dev/null +++ b/.github/workflows/pull_request_label.yml @@ -0,0 +1,18 @@ +name: PR label + +on: + pull_request: + types: [labeled, unlabeled, opened, reopened, synchronize] + +jobs: + semver-label-check: + name: Semantic Version label check + runs-on: ubuntu-latest + timeout-minutes: 1 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Check for Semantic Version label + uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml new file mode 100644 index 0000000..a96196d --- /dev/null +++ b/.github/workflows/scheduled.yml @@ -0,0 +1,14 @@ +name: Scheduled + +on: + schedule: + - cron: "0 8,20 * * *" + +jobs: + unit-tests: + name: Unit Tests + # Workaround https://github.com/nektos/act/issues/1875 + uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main + with: + name: "Unit tests" + matrix_linux_command: "I_AM_RUNNING_IN_CI=true ./scripts/gha_run_unit_tests.sh" diff --git a/.licenseignore b/.licenseignore new file mode 100644 index 0000000..9e6fc96 --- /dev/null +++ b/.licenseignore @@ -0,0 +1,52 @@ +.gitignore +**/.gitignore +.licenseignore +.unacceptablelanguageignore +.gitattributes +.git-blame-ignore-revs +.mailfilter +.mailmap +.spi.yml +.swift-format +.editorconfig +.github/* +*.md +*.txt +*.yml +*.yaml +*.json +Package.swift +**/Package.swift +Package@-*.swift +Package@*.swift +**/Package@-*.swift +Package.resolved +**/Package.resolved +Makefile +*.modulemap +**/*.modulemap +**/*.docc/* +*.xcprivacy +**/*.xcprivacy +*.symlink +**/*.symlink +Dockerfile +**/Dockerfile +Snippets/* +dev/git.commit.template +dev/update-benchmark-thresholds +*.crt +**/*.crt +*.pem +**/*.pem +*.der +**/*.der +.swiftformat +.gitmodules +.flake8 +Sources/CDataStaxDriver/datastax-cpp-driver +Sources/Clibuv/libuv +Sources/Clibuv/include/uv +Sources/Clibuv/include/uv.h +Sources/CDataStaxDriver/custom/src/ssl/ssl_openssl_impl.cpp +Sources/CDataStaxDriver/extras/driver_config.hpp diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..9628aaa --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,25 @@ +## ===----------------------------------------------------------------------===## +## +## This source file is part of the SwiftNIO open source project +## +## Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.txt for the list of SwiftNIO project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +## ===----------------------------------------------------------------------===## + +ignore: | + Sources/Clibuv/libuv/ + Sources/CDataStaxDriver/datastax-cpp-driver + +extends: default + +rules: + line-length: false + document-start: false + truthy: + check-keys: false # Otherwise we get a false positive on GitHub action's `on` key diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5067a64..b062d6d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -60,31 +60,10 @@ We require that your commit messages match our template. The easiest way to do t git config commit.template dev/git.commit.template -### Run `./scripts/soundness.sh` +### Run CI checks locally -The scripts directory contains a [soundness.sh script](https://github.com/apple/swift-cassandra-client/blob/main/scripts/soundness.sh) -that enforces additional checks, like license headers and formatting style. - -Please make sure to `./scripts/soundness.sh` before pushing a change upstream, otherwise it is likely the PR validation will fail -on minor changes such as a missing `self.` or similar formatting issues. - -> The script also executes the above mentioned `generate_linux_tests.rb`. - -For frequent contributors, we recommend adding the script as a [git pre-push hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks), which you can do via executing the following command in the project root directory: - -```bash -cat << EOF > .git/hooks/pre-push -#!/bin/bash - -if [[ -f "scripts/soundness.sh" ]]; then - scripts/soundness.sh -fi -EOF -``` - -Which makes the script execute, and only allow the `git push` to complete if the check has passed. - -In the case of formatting issues, you can then `git add` the formatting changes, and attempt the push again. +You can run the Github Actions workflows locally using +[act](https://github.com/nektos/act). For detailed steps on how to do this please see [https://github.com/swiftlang/github-workflows?tab=readme-ov-file#running-workflows-locally](https://github.com/swiftlang/github-workflows?tab=readme-ov-file#running-workflows-locally). ## How to contribute your work diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 895bb6b..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -ARG swift_version=5.4 -ARG ubuntu_version=focal -ARG base_image=swift:$swift_version-$ubuntu_version -FROM $base_image -# needed to do again after FROM due to docker limitation -ARG swift_version -ARG ubuntu_version - -# set as UTF-8 -RUN apt-get update && apt-get install -y locales locales-all -ENV LC_ALL en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US.UTF-8 - -# Dependencies -RUN apt-get update && apt-get install -y libbsd-dev netcat - -# tools -RUN mkdir -p $HOME/.tools -RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile - -# swiftformat (until part of the toolchain) - -ARG swiftformat_version=0.49.14 -RUN git clone --branch $swiftformat_version --depth 1 https://github.com/nicklockwood/SwiftFormat $HOME/.tools/swift-format -RUN cd $HOME/.tools/swift-format && swift build -c release -RUN ln -s $HOME/.tools/swift-format/.build/release/swiftformat $HOME/.tools/swiftformat diff --git a/docker/docker-compose-dev.yaml b/docker/docker-compose-dev.yaml deleted file mode 100644 index b3f1287..0000000 --- a/docker/docker-compose-dev.yaml +++ /dev/null @@ -1,68 +0,0 @@ -# this file is not designed to be run directly -# instead, use the docker-compose.. files -# eg docker-compose -f docker/docker-compose-dev.yaml -f docker/docker-compose.2004.56.yaml run test -version: "3" - -services: - cassandra: - image: cassandra:3.11 - environment: - CASSANDRA_CQL_PORT: 9042 - CASSANDRA_USER: cassandra - CASSANDRA_PASSWORD: cassandra - CASSANDRA_KEYSPACE: cassandra - ports: - - 9042:9043 - - runtime-setup: - image: swift-cassandra-client:default - build: - context: . - dockerfile: Dockerfile - - common: &common - image: swift-cassandra-client:default - depends_on: [runtime-setup] - volumes: - - ~/.ssh:/root/.ssh - - ..:/code:z - working_dir: /code - cap_drop: - - CAP_NET_RAW - - CAP_NET_BIND_SERVICE - - soundness: - <<: *common - command: /bin/bash -xcl "./scripts/soundness.sh" - - build: - <<: *common - environment: [] - command: /bin/bash -cl "swift build" - - test: - <<: *common - depends_on: [cassandra, runtime-setup] - environment: - CASSANDRA_HOST: cassandra - CASSANDRA_CQL_PORT: 9042 - CASSANDRA_USER: cassandra - CASSANDRA_PASSWORD: cassandra - CASSANDRA_KEYSPACE: cassandra - command: > - /bin/bash -xcl " - swift build --build-tests $${SANITIZER_ARG-} && \ - - while ! nc -z cassandra 9042; do - echo Waiting for Cassandra...; - sleep 3; - done; - - swift test $${SANITIZER_ARG-} - " - - # util - - shell: - <<: *common - entrypoint: /bin/bash diff --git a/docker/docker-compose.2004.54.yaml b/docker/docker-compose.2004.54.yaml deleted file mode 100644 index bd7647a..0000000 --- a/docker/docker-compose.2004.54.yaml +++ /dev/null @@ -1,22 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-cassandra-client:20.04-5.4 - build: - args: - ubuntu_version: "focal" - swift_version: "5.4" - - build: - image: swift-cassandra-client:20.04-5.4 - - test: - image: swift-cassandra-client:20.04-5.4 - environment: [] - #- SANITIZER_ARG: "--sanitize=thread" - #- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt" - - shell: - image: swift-cassandra-client:20.04-5.4 diff --git a/docker/docker-compose.2004.55.yaml b/docker/docker-compose.2004.55.yaml deleted file mode 100644 index 376578a..0000000 --- a/docker/docker-compose.2004.55.yaml +++ /dev/null @@ -1,22 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-cassandra-client:20.04-5.5 - build: - args: - ubuntu_version: "focal" - swift_version: "5.5" - - build: - image: swift-cassandra-client:20.04-5.5 - - test: - image: swift-cassandra-client:20.04-5.5 - environment: [] - #- SANITIZER_ARG: "--sanitize=thread" - #- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt" - - shell: - image: swift-cassandra-client:20.04-5.5 diff --git a/docker/docker-compose.2004.56.yaml b/docker/docker-compose.2004.56.yaml deleted file mode 100644 index 864fc31..0000000 --- a/docker/docker-compose.2004.56.yaml +++ /dev/null @@ -1,22 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-cassandra-client:20.04-5.6 - build: - args: - ubuntu_version: "focal" - swift_version: "5.6" - - build: - image: swift-cassandra-client:20.04-5.6 - - test: - image: swift-cassandra-client:20.04-5.6 - environment: [] - #- SANITIZER_ARG: "--sanitize=thread" - #- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt" - - shell: - image: swift-cassandra-client:20.04-5.6 diff --git a/docker/docker-compose.2004.57.yaml b/docker/docker-compose.2004.57.yaml deleted file mode 100644 index fb6740a..0000000 --- a/docker/docker-compose.2004.57.yaml +++ /dev/null @@ -1,22 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-cassandra-client:20.04-5.7 - build: - args: - ubuntu_version: "focal" - swift_version: "5.7" - - build: - image: swift-cassandra-client:20.04-5.7 - - test: - image: swift-cassandra-client:20.04-5.7 - environment: [] - #- SANITIZER_ARG: "--sanitize=thread" - #- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt" - - shell: - image: swift-cassandra-client:20.04-5.7 diff --git a/docker/docker-compose.2004.58.yaml b/docker/docker-compose.2004.58.yaml deleted file mode 100644 index 97cd283..0000000 --- a/docker/docker-compose.2004.58.yaml +++ /dev/null @@ -1,22 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-cassandra-client:20.04-5.8 - build: - args: - ubuntu_version: "focal" - swift_version: "5.8" - - build: - image: swift-cassandra-client:20.04-5.8 - - test: - image: swift-cassandra-client:20.04-5.8 - environment: [] - #- SANITIZER_ARG: "--sanitize=thread" - #- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt" - - shell: - image: swift-cassandra-client:20.04-5.8 diff --git a/docker/docker-compose.2204.510.yaml b/docker/docker-compose.2204.510.yaml deleted file mode 100644 index a945616..0000000 --- a/docker/docker-compose.2204.510.yaml +++ /dev/null @@ -1,21 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-cassandra-client:22.04-5.10 - build: - args: - base_image: "swiftlang/swift:nightly-5.10-jammy" - - build: - image: swift-cassandra-client:22.04-5.10 - - test: - image: swift-cassandra-client:22.04-5.10 - environment: [] - #- SANITIZER_ARG: "--sanitize=thread" - #- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt" - - shell: - image: swift-cassandra-client:22.04-5.10 diff --git a/docker/docker-compose.2204.59.yaml b/docker/docker-compose.2204.59.yaml deleted file mode 100644 index 7dd3e01..0000000 --- a/docker/docker-compose.2204.59.yaml +++ /dev/null @@ -1,22 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-cassandra-client:22.04-5.9 - build: - args: - ubuntu_version: "jammy" - swift_version: "5.9" - - build: - image: swift-cassandra-client:22.04-5.9 - - test: - image: swift-cassandra-client:22.04-5.9 - environment: [] - #- SANITIZER_ARG: "--sanitize=thread" - #- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt" - - shell: - image: swift-cassandra-client:22.04-5.9 diff --git a/docker/docker-compose.2204.main.yaml b/docker/docker-compose.2204.main.yaml deleted file mode 100644 index 1037dc8..0000000 --- a/docker/docker-compose.2204.main.yaml +++ /dev/null @@ -1,21 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-cassandra-client:22.04-main - build: - args: - base_image: "swiftlang/swift:nightly-main-jammy" - - build: - image: swift-cassandra-client:22.04-main - - test: - image: swift-cassandra-client:22.04-main - environment: [] - #- SANITIZER_ARG: "--sanitize=thread" - #- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt" - - shell: - image: swift-cassandra-client:22.04-main diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml deleted file mode 100644 index 06770b9..0000000 --- a/docker/docker-compose.yaml +++ /dev/null @@ -1,77 +0,0 @@ -# this file is not designed to be run directly -# instead, use the docker-compose.. files -# eg docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.2004.56.yaml run test -version: "3" - -services: - cassandra: - image: cassandra:3.11 - environment: - CASSANDRA_CQL_PORT: 9042 - CASSANDRA_USER: cassandra - CASSANDRA_PASSWORD: cassandra - CASSANDRA_KEYSPACE: cassandra - networks: - - cassandra - ports: - - 9042 - - runtime-setup: - image: swift-cassandra-client:default - build: - context: . - dockerfile: Dockerfile - - common: &common - image: swift-cassandra-client:default - depends_on: [runtime-setup] - volumes: - - ~/.ssh:/root/.ssh - - ..:/code:z - working_dir: /code - cap_drop: - - CAP_NET_RAW - - CAP_NET_BIND_SERVICE - - soundness: - <<: *common - command: /bin/bash -xcl "./scripts/soundness.sh" - - build: - <<: *common - environment: [] - command: /bin/bash -cl "swift build" - - test: - <<: *common - depends_on: [cassandra, runtime-setup] - environment: - CASSANDRA_HOST: cassandra - CASSANDRA_CQL_PORT: 9042 - CASSANDRA_USER: cassandra - CASSANDRA_PASSWORD: cassandra - CASSANDRA_KEYSPACE: cassandra - command: > - /bin/bash -xcl " - swift build --build-tests $${SANITIZER_ARG-} && \ - - while ! nc -z cassandra 9042; do - echo Waiting for Cassandra...; - sleep 3; - done; - - swift test $${SANITIZER_ARG-} - " - networks: - - cassandra - - # util - - shell: - <<: *common - entrypoint: /bin/bash - -# dedicated network - -networks: - cassandra: diff --git a/scripts/generate_contributors_list.sh b/scripts/generate_contributors_list.sh deleted file mode 100755 index a65b1b7..0000000 --- a/scripts/generate_contributors_list.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -##===----------------------------------------------------------------------===## -## -## This source file is part of the Swift Cassandra Client open source project -## -## Copyright (c) 2022 Apple Inc. and the Swift Cassandra Client project authors -## Licensed under Apache License v2.0 -## -## See LICENSE.txt for license information -## See CONTRIBUTORS.txt for the list of Swift Cassandra Client project authors -## -## SPDX-License-Identifier: Apache-2.0 -## -##===----------------------------------------------------------------------===## - -##===----------------------------------------------------------------------===## -## -## This source file is part of the SwiftNIO open source project -## -## Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors -## Licensed under Apache License v2.0 -## -## See LICENSE.txt for license information -## See CONTRIBUTORS.txt for the list of SwiftNIO project authors -## -## SPDX-License-Identifier: Apache-2.0 -## -##===----------------------------------------------------------------------===## - -set -eu -here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -contributors=$( cd "$here"/.. && git shortlog -es | cut -f2 | sed 's/^/- /' ) - -cat > "$here/../CONTRIBUTORS.txt" <<- EOF - For the purpose of tracking copyright, this is the list of individuals and - organizations who have contributed source code to the Swift Cassandra Client. - - For employees of an organization/company where the copyright of work done - by employees of that company is held by the company itself, only the company - needs to be listed here. - - ## COPYRIGHT HOLDERS - - - Apple Inc. (all contributors with '@apple.com') - - ### Contributors - - $contributors - - **Updating this list** - - Please do not edit this file manually. It is generated using \`./scripts/generate_contributors_list.sh\`. If a name is misspelled or appearing multiple times: add an entry in \`./.mailmap\` -EOF diff --git a/scripts/gha_run_unit_tests.sh b/scripts/gha_run_unit_tests.sh new file mode 100755 index 0000000..362b22c --- /dev/null +++ b/scripts/gha_run_unit_tests.sh @@ -0,0 +1,40 @@ +#!/bin/bash +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift Cassandra Client open source project +## +## Copyright (c) 2017-2018 Apple Inc. and the Swift Cassandra Client project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.txt for the list of Swift Cassandra Client project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +set -e + +if [ -z "${I_AM_RUNNING_IN_CI}" ] +then + echo "Not running in CI" + exit 1 +fi + +printf '#!/bin/sh\nexit 0' > /usr/sbin/policy-rc.d +echo "deb [signed-by=/etc/apt/keyrings/apache-cassandra.asc] https://debian.cassandra.apache.org 41x main" | tee -a /etc/apt/sources.list.d/cassandra.sources.list +curl -o /etc/apt/keyrings/apache-cassandra.asc https://downloads.apache.org/cassandra/KEYS +apt-get update +apt install -y -q default-jre +apt-get install -y -q cassandra +swift build --explicit-target-dependency-import-check error +while ! nodetool status 2>/dev/null +do + echo Waiting for Cassandra.. + sleep 3 +done + +export CASSANDRA_USER=cassandra +export CASSANDRA_PASSWORD=cassandra +export CASSANDRA_KEYSPACE=cassandra +swift test --explicit-target-dependency-import-check error diff --git a/scripts/preview_docc.sh b/scripts/preview_docc.sh deleted file mode 100755 index 893ea8e..0000000 --- a/scripts/preview_docc.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -##===----------------------------------------------------------------------===## -## -## This source file is part of the Swift Cassandra Client open source project -## -## Copyright (c) 2022 Apple Inc. and the Swift Cassandra Client project authors -## Licensed under Apache License v2.0 -## -## See LICENSE.txt for license information -## See CONTRIBUTORS.txt for the list of Swift Cassandra Client project authors -## -## SPDX-License-Identifier: Apache-2.0 -## -##===----------------------------------------------------------------------===## - -##===----------------------------------------------------------------------===## -## -## This source file is part of the Swift Distributed Actors open source project -## -## Copyright (c) 2018-2019 Apple Inc. and the Swift Distributed Actors project authors -## Licensed under Apache License v2.0 -## -## See LICENSE.txt for license information -## See CONTRIBUTORS.md for the list of Swift Distributed Actors project authors -## -## SPDX-License-Identifier: Apache-2.0 -## -##===----------------------------------------------------------------------===## - -swift package --disable-sandbox preview-documentation --target $1 diff --git a/scripts/soundness.sh b/scripts/soundness.sh deleted file mode 100755 index b60ccfb..0000000 --- a/scripts/soundness.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/bash -##===----------------------------------------------------------------------===## -## -## This source file is part of the Swift Cassandra Client open source project -## -## Copyright (c) 2022-2023 Apple Inc. and the Swift Cassandra Client project authors -## Licensed under Apache License v2.0 -## -## See LICENSE.txt for license information -## See CONTRIBUTORS.txt for the list of Swift Cassandra Client project authors -## -## SPDX-License-Identifier: Apache-2.0 -## -##===----------------------------------------------------------------------===## - -set -eu -here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -function replace_acceptable_years() { - # this needs to replace all acceptable forms with 'YEARS' - sed -e 's/2022-2023/YEARS/' -e 's/202[23]/YEARS/' -} - -printf "=> Checking for unacceptable language... " -# This greps for unacceptable terminology. The square bracket[s] are so that -# "git grep" doesn't find the lines that greps :). -unacceptable_terms=( - -e blacklis[t] - -e whitelis[t] - -e slav[e] - -e sanit[y] -) -if git grep --color=never -i "${unacceptable_terms[@]}" > /dev/null; then - printf "\033[0;31mUnacceptable language found.\033[0m\n" - git grep -i "${unacceptable_terms[@]}" - exit 1 -fi -printf "\033[0;32mokay.\033[0m\n" - -printf "=> Checking format... " -FIRST_OUT="$(git status --porcelain)" -swiftformat . > /dev/null 2>&1 -SECOND_OUT="$(git status --porcelain)" -if [[ "$FIRST_OUT" != "$SECOND_OUT" ]]; then - printf "\033[0;31mformatting issues!\033[0m\n" - git --no-pager diff - exit 1 -else - printf "\033[0;32mokay.\033[0m\n" -fi - -printf "=> Checking license headers...\n" -tmp=$(mktemp /tmp/.swift-cassandra-client-soundness_XXXXXX) - -for language in swift-or-c bash dtrace; do - printf " * checking $language... " - declare -a matching_files - declare -a exceptions - expections=( ) - matching_files=( -name '*' ) - case "$language" in - swift-or-c) - exceptions=( -path '*Sources/CDataStaxDriver/datastax-cpp-driver/*' -o -path '*Sources/Clibuv/libuv/*' -o -name uv.h -o -name Package.swift -o -name 'Package@*.swift' ) - matching_files=( -name '*.swift' -o -name '*.c' -o -name '*.h' ) - cat > "$tmp" <<"EOF" -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift Cassandra Client open source project -// -// Copyright (c) YEARS Apple Inc. and the Swift Cassandra Client project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Cassandra Client project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// -EOF - ;; - bash) - matching_files=( -name '*.sh' ) - cat > "$tmp" <<"EOF" -#!/bin/bash -##===----------------------------------------------------------------------===## -## -## This source file is part of the Swift Cassandra Client open source project -## -## Copyright (c) YEARS Apple Inc. and the Swift Cassandra Client project authors -## Licensed under Apache License v2.0 -## -## See LICENSE.txt for license information -## See CONTRIBUTORS.txt for the list of Swift Cassandra Client project authors -## -## SPDX-License-Identifier: Apache-2.0 -## -##===----------------------------------------------------------------------===## -EOF - ;; - dtrace) - matching_files=( -name '*.d' ) - cat > "$tmp" <<"EOF" -#!/usr/sbin/dtrace -q -s -/*===----------------------------------------------------------------------===* - * - * This source file is part of the Swift Cassandra Client open source project - * - * Copyright (c) YEARS Apple Inc. and the Swift Cassandra Client project authors - * Licensed under Apache License v2.0 - * - * See LICENSE.txt for license information - * See CONTRIBUTORS.txt for the list of Swift Cassandra Client project authors - * - * SPDX-License-Identifier: Apache-2.0 - * - *===----------------------------------------------------------------------===*/ -EOF - ;; - *) - echo >&2 "ERROR: unknown language '$language'" - ;; - esac - - expected_lines=$(cat "$tmp" | wc -l) - expected_sha=$(cat "$tmp" | shasum) - - ( - cd "$here/.." - find . \ - \( \! -path './.build/*' -a \ - \( "${matching_files[@]}" \) -a \ - \( \! \( "${exceptions[@]}" \) \) \) | while read line; do - if [[ "$(cat "$line" | replace_acceptable_years | head -n $expected_lines | shasum)" != "$expected_sha" ]]; then - printf "\033[0;31mmissing headers in file '$line'!\033[0m\n" - diff -u <(cat "$line" | replace_acceptable_years | head -n $expected_lines) "$tmp" - exit 1 - fi - done - printf "\033[0;32mokay.\033[0m\n" - ) -done - -rm "$tmp"