diff --git a/.github/workflows/c-bindings.yml b/.github/workflows/c-bindings.yml deleted file mode 100644 index 5167efa582..0000000000 --- a/.github/workflows/c-bindings.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: C bindings tests CI - -on: - push: - branches: [ "main" ] - pull_request: - merge_group: - branches: [ "main" ] - -jobs: - c-bindings: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - - name: Install Protoc - uses: arduino/setup-protoc@v2 - - - name: Set up cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- - - - name: Build crates - run: cargo build - - - name: Build C bindings example - working-directory: bindings/c - run: make diff --git a/.github/workflows/golang-bindings.yml b/.github/workflows/golang-bindings.yml deleted file mode 100644 index 27689cf768..0000000000 --- a/.github/workflows/golang-bindings.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Go bindings tests CI - -on: - push: - branches: [ "main" ] - pull_request: - merge_group: - branches: [ "main" ] - -jobs: - golang-bindings: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - - - name: get TCL - run: sudo apt-get install -y tcl8.6-dev - - - name: Install Protoc - uses: arduino/setup-protoc@v2 - - - name: Set up cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- - - - name: Build crates - run: cargo build - - - name: Run Go bindings tests - working-directory: bindings/go - run: LD_LIBRARY_PATH=../../target/debug go test diff --git a/.github/workflows/nemesis.yml b/.github/workflows/nemesis.yml index c2274a7d5f..8535c87241 100644 --- a/.github/workflows/nemesis.yml +++ b/.github/workflows/nemesis.yml @@ -4,6 +4,8 @@ on: push: branches: [ "main" ] pull_request: + pull_request_target: + branches: ["main"] merge_group: branches: [ "main" ] @@ -15,8 +17,17 @@ env: # RUSTFLAGS: "-D warnings" jobs: - test-nemesis: + authorize: + environment: ${{ github.event_name == 'pull_request_target' && + github.event.pull_request.head.repo.full_name != github.repository && + 'external' || 'internal' }} runs-on: ubuntu-latest + steps: + - run: true + + test-nemesis: + needs: authorize + runs-on: self-hosted name: Run Nemesis Tests env: RUSTFLAGS: -D warnings @@ -33,30 +44,15 @@ jobs: - uses: actions/checkout@v3 - - name: Set up cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- - - - name: Cargo build + - name: Run nemesis tests run: | - cargo build - mv ./target/debug/sqld /usr/local/bin - sqld --version + echo $PATH - name: Download MinIO binary run: | wget -q https://dl.min.io/server/minio/release/linux-amd64/minio -O minio chmod +x minio - mv minio /usr/local/bin + mv minio /home/ubuntu/.cargo/bin minio --version - name: Nemesis tests checkout @@ -75,6 +71,25 @@ jobs: cd nemesis-tests go build -o ../tursotests cmd/tursotest/main.go + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - name: Cargo build + run: | + cargo build + mv ./target/debug/sqld /home/ubuntu/.cargo/bin + sqld --version + - name: Run nemesis tests run: | ./tursotests nemesis local \ No newline at end of file diff --git a/.github/workflows/publish-server.yml b/.github/workflows/publish-server.yml deleted file mode 100644 index b42f647b33..0000000000 --- a/.github/workflows/publish-server.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Create and publish sqld binaried and Docker image - -on: - push: - branches: ['main'] - tags: - - libsql-server-v*.*.* - -env: - REGISTRY: ghcr.io - IMAGE_NAME: tursodatabase/libsql-server - -jobs: - # docker image build and upload to ghcr - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=match,pattern=libsql-server-(.*),group=1 - type=raw,value=latest - - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index 82e66d2617..0000000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Release Drafter - -on: - push: - # branches to consider in the event; optional, defaults to all - branches: - - main - # pull_request event is required only for autolabeler - pull_request: - # Only following types are handled by the action, but one can default to all as well - types: [opened, reopened, synchronize] - # pull_request_target event is required for autolabeler to support PRs from forks - # pull_request_target: - # types: [opened, reopened, synchronize] - -permissions: - contents: read - -jobs: - update_release_draft: - permissions: - # write permission is required to create a github release - contents: write - # write permission is required for autolabeler - # otherwise, read permission is required at least - pull-requests: write - runs-on: ubuntu-latest - steps: - # (Optional) GitHub Enterprise requires GHE_HOST variable set - #- name: Set GHE_HOST - # run: | - # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV - - # Drafts your next Release notes as Pull Requests are merged into "master" - - uses: release-drafter/release-drafter@v5 - # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml - # with: - # config-name: my-config.yml - # disable-autolabeler: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-libsql-server.yml b/.github/workflows/release-libsql-server.yml deleted file mode 100644 index 2b00ee5858..0000000000 --- a/.github/workflows/release-libsql-server.yml +++ /dev/null @@ -1,239 +0,0 @@ -# Copyright 2022-2023, axodotdev -# SPDX-License-Identifier: MIT or Apache-2.0 -# -# CI that: -# -# * checks for a Git Tag that looks like a release -# * builds artifacts with cargo-dist (archives, installers, hashes) -# * uploads those artifacts to temporary workflow zip -# * on success, uploads the artifacts to a Github Release™ -# -# Note that a Github Release™ with this tag is assumed to exist as a draft -# with the appropriate title/body, and will be undrafted for you. -name: Release - -permissions: - contents: write - -# This task will run whenever you push a git tag that looks like a version -# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc. -# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where -# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION -# must be a Cargo-style SemVer Version (must have at least major.minor.patch). -# -# If PACKAGE_NAME is specified, then the release will be for that -# package (erroring out if it doesn't have the given version or isn't cargo-dist-able). -# -# If PACKAGE_NAME isn't specified, then the release will be for all -# (cargo-dist-able) packages in the workspace with that version (this mode is -# intended for workspaces with only one dist-able package, or with all dist-able -# packages versioned/released in lockstep). -# -# If you push multiple tags at once, separate instances of this workflow will -# spin up, creating an independent Github Release™ for each one. However Github -# will hard limit this to 3 tags per commit, as it will assume more tags is a -# mistake. -# -# If there's a prerelease-style suffix to the version, then the Github Release™ -# will be marked as a prerelease. -on: - push: - tags: - - 'libqsl-server-**[0-9]+.[0-9]+.[0-9]+*' - pull_request: - -jobs: - # Run 'cargo dist plan' to determine what tasks we need to do - plan: - runs-on: ubuntu-latest - outputs: - val: ${{ steps.plan.outputs.manifest }} - tag: ${{ !github.event.pull_request && github.ref_name || '' }} - tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }} - publishing: ${{ !github.event.pull_request }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Install cargo-dist - run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.4.2/cargo-dist-installer.sh | sh" - - id: plan - run: | - cargo dist plan ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }} --output-format=json > dist-manifest.json - echo "cargo dist plan ran successfully" - cat dist-manifest.json - echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT" - - name: "Upload dist-manifest.json" - uses: actions/upload-artifact@v3 - with: - name: artifacts - path: dist-manifest.json - - # Build and packages all the platform-specific things - upload-local-artifacts: - # Let the initial task tell us to not run (currently very blunt) - needs: plan - if: ${{ fromJson(needs.plan.outputs.val).releases != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }} - strategy: - fail-fast: false - # Target platforms/runners are computed by cargo-dist in create-release. - # Each member of the matrix has the following arguments: - # - # - runner: the github runner - # - dist-args: cli flags to pass to cargo dist - # - install-dist: expression to run to install cargo-dist on the runner - # - # Typically there will be: - # - 1 "global" task that builds universal installers - # - N "local" tasks that build each platform's binaries and platform-specific installers - matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} - runs-on: ${{ matrix.runner }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: swatinem/rust-cache@v2 - - name: Install cargo-dist - run: ${{ matrix.install_dist }} - - name: Install dependencies - run: | - ${{ matrix.packages_install }} - - name: Build artifacts - run: | - # Actually do builds and make zips and whatnot - cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json - echo "cargo dist ran successfully" - - id: cargo-dist - name: Post-build - # We force bash here just because github makes it really hard to get values up - # to "real" actions without writing to env-vars, and writing to env-vars has - # inconsistent syntax between shell and powershell. - shell: bash - run: | - # Parse out what we just built and upload it to the Github Release™ - echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT" - echo "EOF" >> "$GITHUB_OUTPUT" - - cp dist-manifest.json "$BUILD_MANIFEST_NAME" - - name: "Upload artifacts" - uses: actions/upload-artifact@v3 - with: - name: artifacts - path: | - ${{ steps.cargo-dist.outputs.paths }} - ${{ env.BUILD_MANIFEST_NAME }} - - # Build and package all the platform-agnostic(ish) things - upload-global-artifacts: - needs: [plan, upload-local-artifacts] - runs-on: "ubuntu-20.04" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Install cargo-dist - run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.4.2/cargo-dist-installer.sh | sh" - # Get all the local artifacts for the global tasks to use (for e.g. checksums) - - name: Fetch local artifacts - uses: actions/download-artifact@v3 - with: - name: artifacts - path: target/distrib/ - - id: cargo-dist - shell: bash - run: | - cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json - echo "cargo dist ran successfully" - - # Parse out what we just built and upload it to the Github Release™ - echo "paths<> "$GITHUB_OUTPUT" - jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT" - echo "EOF" >> "$GITHUB_OUTPUT" - - name: "Upload artifacts" - uses: actions/upload-artifact@v3 - with: - name: artifacts - path: ${{ steps.cargo-dist.outputs.paths }} - - should-publish: - needs: - - plan - - upload-local-artifacts - - upload-global-artifacts - if: ${{ needs.plan.outputs.publishing == 'true' }} - runs-on: ubuntu-latest - steps: - - name: print tag - run: echo "ok we're publishing!" - - publish-homebrew-formula: - needs: [plan, should-publish] - runs-on: "ubuntu-20.04" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PLAN: ${{ needs.plan.outputs.val }} - GITHUB_USER: "axo bot" - GITHUB_EMAIL: "admin+bot@axo.dev" - if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} - steps: - - uses: actions/checkout@v4 - with: - repository: "libsql/homebrew-sqld" - token: ${{ secrets.HOMEBREW_TAP_TOKEN }} - # So we have access to the formula - - name: Fetch local artifacts - uses: actions/download-artifact@v3 - with: - name: artifacts - path: Formula/ - - name: Commit formula files - run: | - git config --global user.name "${GITHUB_USER}" - git config --global user.email "${GITHUB_EMAIL}" - - for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do - name=$(echo "$release" | jq .app_name --raw-output) - version=$(echo "$release" | jq .app_version --raw-output) - - git add Formula/${name}.rb - git commit -m "${name} ${version}" - done - git push - - # Create a Github Release with all the results once everything is done - publish-release: - needs: [plan, should-publish] - runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: "Download artifacts" - uses: actions/download-artifact@v3 - with: - name: artifacts - path: artifacts - - name: Cleanup - run: | - # Remove the granular manifests - rm artifacts/*-dist-manifest.json - - name: Create Release - uses: ncipollo/release-action@v1 - with: - tag: ${{ needs.plan.outputs.tag }} - allowUpdates: true - updateOnlyUnreleased: true - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - prerelease: ${{ fromJson(needs.plan.outputs.val).announcement_is_prerelease }} - artifacts: "artifacts/*" diff --git a/.github/workflows/release-libsql.yml b/.github/workflows/release-libsql.yml deleted file mode 100644 index c8c0c08cc8..0000000000 --- a/.github/workflows/release-libsql.yml +++ /dev/null @@ -1,207 +0,0 @@ -name: Create and publish libsql binaries - -on: - push: - #branches: ['main'] - tags: - - libsql-v*.*.* - -jobs: - - start-runner: - name: Start self-hosted EC2 runner - runs-on: ubuntu-latest - outputs: - label: ${{ steps.start-ec2-runner.outputs.label }} - ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} - steps: - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION }} - - - name: Start EC2 runner - id: start-ec2-runner - uses: machulav/ec2-github-runner@v2 - with: - mode: start - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - ec2-image-id: ami-0e811aad4d084edb9 - ec2-instance-type: t4g.2xlarge - subnet-id: subnet-05010d45bfb86f5fb - security-group-id: sg-01bd3845621443669 - - build_binaries: - needs: start-runner - strategy: - matrix: - os: - - linux-x86_64 - - macos-arm64 - - ${{ needs.start-runner.outputs.label }} - variant: - - 'wasm-udf-dynamic' - - 'wasm-udf-wasmedge' - - 'wasm-udf' - - '' - - runs-on: ${{ matrix.os }} - steps: - #Debug output + special rustup config for the ubuntu/aarch64 runner - - name: show step matrix details - run: | - env - set -ex - uname -a - echo "os: ${{ matrix.os }}" - echo "variant: ${{ matrix.variant }}" - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > ./rustup.sh - chmod a+x rustup.sh - ./rustup.sh -y - if [[ "${{ matrix.os}}" == "${{ needs.start-runner.outputs.label }}" ]]; then - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable - echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH - echo "PATH=$PATH:/root/.cargo/bin" >> $GITHUB_PATH - fi - pwd - whoami - - #for windows only, use correct newlines - - name: Set git to use LF - if: matrix.os == 'windows-latest' - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - - uses: actions/checkout@v3 - - - uses: dtolnay/rust-toolchain@stable - - - name: setup msys2 for windows - if: matrix.os == 'windows-latest' - uses: msys2/setup-msys2@v2 - with: - update: true - install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-sqlite3 gcc make base-devel mingw-w64-x86_64-rust zip - msystem: mingw64 - path-type: inherit - - - name: run configure - working-directory: libsql-sqlite3 - run: | - set -ex - mkdir build - pushd build - case "${{ matrix.variant }}" in - "wasm-udf-dynamic") - ../configure --enable-wasm-runtime-dynamic - ;; - "wasm-udf-wasmedge") - # Fix for https://github.com/WasmEdge/WasmEdge/issues/2622 - if [[ "${{ matrix.os}}" == "${{ needs.start-runner.outputs.label }}" ]]; then - curl -SLO https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh - chmod a+x install.sh - ./install.sh --dist manylinux2014 -D - else - curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash - fi - source ~/.wasmedge/env - ../configure --enable-wasm-runtime-wasmedge - ;; - "wasm-udf") - ../configure --enable-wasm-runtime - ;; - *) - ../configure - ;; - esac - popd - - - name: build - working-directory: libsql-sqlite3 - run: | - set -ex - if [[ "${{ matrix.variant }}" == "wasm-udf-wasmedge" ]]; then - source ~/.wasmedge/env || echo "no wasmedge installed" - fi - pushd build - make - make sqlite3.c - ls -la - popd - - - name: package artefacts (for named variants) - working-directory: libsql-sqlite3 - if: matrix.variant != '' - run: | - set -ex - uname -a - OS=$(uname -s) - ARCH=$(uname -m) - cd build - tar cvzf libsql-${{ github.ref_name }}-${{ matrix.variant }}-$OS-$ARCH.tar.gz .libs libsql sqlite3 - tar cvzf libsql-amalgamation-${{ github.ref_name }}-${{ matrix.variant }}-$OS-$ARCH.tar.gz sqlite3.c sqlite3.h - ls -la - cd .. - - - name: package artefacts - working-directory: libsql-sqlite3 - if: matrix.variant == '' - run: | - set -ex - uname -a - OS=$(uname -s) - ARCH=$(uname -m) - cd build - tar cvzf libsql-${{ github.ref_name }}-$OS-$ARCH.tar.gz .libs libsql sqlite3 - tar cvzf libsql-amalgamation-${{ github.ref_name }}-$OS-$ARCH.tar.gz sqlite3.c sqlite3.h - ls -la - cd .. - - - name: Push artefacts into release draft - working-directory: libsql-sqlite3 - uses: softprops/action-gh-release@v1 - if: ${{startsWith(github.ref, 'refs/tags/') }} - with: - fail_on_unmatched_files: false - files: | - build/libsql-${{ github.ref_name }}-${{ matrix.variant }}-Linux-x86_64.tar.gz - build/libsql-amalgamation-${{ github.ref_name }}-${{ matrix.variant }}-Linux-x86_64.tar.gz - build/libsql-${{ github.ref_name }}-Linux-x86_64.tar.gz - build/libsql-amalgamation-${{ github.ref_name }}-Linux-x86_64.tar.gz - build/libsql-${{ github.ref_name }}-${{ matrix.variant }}-Linux-aarch64.tar.gz - build/libsql-amalgamation-${{ github.ref_name }}-${{ matrix.variant }}-Linux-aarch64.tar.gz - build/libsql-${{ github.ref_name }}-Linux-aarch64.tar.gz - build/libsql-amalgamation-${{ github.ref_name }}-Linux-aarch64.tar.gz - build/libsql-${{ github.ref_name }}-${{ matrix.variant }}-Darwin-x86_64.tar.gz - build/libsql-amalgamation-${{ github.ref_name }}-${{ matrix.variant }}-Darwin-x86_64.tar.gz - build/libsql-${{ github.ref_name }}-Darwin-x86_64.tar.gz - build/libsql-amalgamation-${{ github.ref_name }}-Darwin-x86_64.tar.gz - build/libsql-${{ github.ref_name }}-${{ matrix.variant }}-Darwin-arm64.tar.gz - build/libsql-amalgamation-${{ github.ref_name }}-${{ matrix.variant }}-Darwin-arm64.tar.gz - build/libsql-${{ github.ref_name }}-Darwin-arm64.tar.gz - build/libsql-amalgamation-${{ github.ref_name }}-Darwin-arm64.tar.gz - - stop-runner: - name: Stop self-hosted EC2 runner - needs: - - start-runner # required to get output from the start-runner job - - build_binaries # required to wait when the main job is done - runs-on: ubuntu-latest - if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs - steps: - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION }} - - name: Stop EC2 runner - uses: machulav/ec2-github-runner@v2 - with: - mode: stop - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - label: ${{ needs.start-runner.outputs.label }} - ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4a1509a80b..347b5e1a85 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -21,41 +21,8 @@ jobs: env: RUSTFLAGS: -D warnings steps: - - uses: hecrj/setup-rust-action@v1 - - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Set up cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- - - - name: Cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --check - - - name: Cargo check - uses: actions-rs/cargo@v1 - with: - command: check - args: --all-targets --all-features - - - name: Test openssl - shell: bash {0} - run: cargo tree -p libsql-server -i openssl; [ $? = 101 ] + - run: | + echo "bye" # Disabled because we vendor rusqlite which does not use # clippy so it warns. @@ -70,109 +37,14 @@ jobs: name: Check features and unused dependencies runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@nightly - - uses: taiki-e/install-action@cargo-hack - - uses: taiki-e/install-action@cargo-udeps - - uses: Swatinem/rust-cache@v2 - - run: cargo +nightly hack udeps -p libsql --each-feature + - run: | + echo "bye" test: runs-on: ubuntu-latest name: Run Tests env: RUSTFLAGS: -D warnings - services: - minio: - image: lazybit/minio - ports: - - 9000:9000 - - 9090:9090 - env: - MINIO_ACCESS_KEY: minioadmin - MINIO_SECRET_KEY: minioadmin - volumes: - - /data - options: --name=minio --health-cmd "curl http://localhost:9000/minio/health/live" steps: - - uses: hecrj/setup-rust-action@v1 - - # needed because we run out of disk space during tests - - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@main - with: - # this might remove tools that are actually needed, - # when set to "true" but frees about 6 GB - tool-cache: true - - - name: Install deps - run: sudo apt update && sudo apt install -y libclang-dev - - - name: Install protoc - uses: taiki-e/install-action@v2 - with: - tool: protoc@${{ env.PROTOC_VERSION }} - - - uses: taiki-e/install-action@v2 - with: - tool: nextest - - - uses: actions/checkout@v3 - - - name: Set up cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- - - - name: Run tests - run: cargo nextest run - env: - LIBSQL_BOTTOMLESS_AWS_ACCESS_KEY_ID: minioadmin - LIBSQL_BOTTOMLESS_AWS_SECRET_ACCESS_KEY: minioadmin - LIBSQL_BOTTOMLESS_AWS_DEFAULT_REGION: eu-central-2 - LIBSQL_BOTTOMLESS_BUCKET: bottomless - LIBSQL_BOTTOMLESS_ENDPOINT: http://localhost:9000 - - # test-rust-wasm: - # runs-on: ubuntu-latest - # name: Run Rust Wasm Tests - # env: - # RUSTFLAGS: -D warnings - # steps: - # - uses: hecrj/setup-rust-action@v1 - # with: - # targets: [wasm32-unknown-unknown] - - # # needed because we run out of disk space during tests - # - name: Free Disk Space (Ubuntu) - # uses: jlumbroso/free-disk-space@main - # with: - # # this might remove tools that are actually needed, - # # when set to "true" but frees about 6 GB - # tool-cache: true - - # - uses: actions/checkout@v3 - - # - name: Set up cargo cache - # uses: actions/cache@v3 - # continue-on-error: false - # with: - # path: | - # ~/.cargo/bin/ - # ~/.cargo/registry/index/ - # ~/.cargo/registry/cache/ - # ~/.cargo/git/db/ - # target/ - # key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - # restore-keys: ${{ runner.os }}-cargo- - - # - name: Run check - # run: cargo check --verbose -p libsql --target wasm32-unknown-unknown --no-default-features --features cloudflare + - run: | + echo "bye" \ No newline at end of file diff --git a/.github/workflows/sqlite3.yml b/.github/workflows/sqlite3.yml deleted file mode 100644 index 792d282664..0000000000 --- a/.github/workflows/sqlite3.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Makefile CI with Wasm enabled - -on: - push: - branches: [ "main" ] - paths: - - "libsql-sqlite3/**" - pull_request: - paths: - - "libsql-sqlite3/**" - merge_group: - branches: [ "main" ] - paths: - - "libsql-sqlite3/**" - -jobs: - make-sqlite3: - runs-on: ubuntu-latest - defaults: - run: - working-directory: libsql-sqlite3 - - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - - - name: get TCL - run: sudo apt-get install -y tcl8.6-dev - - - name: get WasmEdge - run: > - wget -O- https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-slim-runtime-0.11.2-manylinux2014_x86_64.tar.gz | tar zxv - && sudo cp -r WasmEdge-0.11.2-Linux/include/* /usr/include/ - && sudo cp -r WasmEdge-0.11.2-Linux/lib64/* /usr/lib/ - - - name: configure with Wasm - run: ./configure --enable-wasm-runtime-dynamic - - - name: make the library generally available - run: mkdir tmp_lib && DESTDIR=$(pwd)/tmp_lib make liblibsql_install && sudo cp -r tmp_lib/usr/local/lib/* /usr/lib/ - - - name: Run tests - run: make test - - - name: Run Rust tests with Wasm - run: make rusttestwasm diff --git a/.github/workflows/tursoci.yml b/.github/workflows/tursoci.yml new file mode 100644 index 0000000000..fd46290ac0 --- /dev/null +++ b/.github/workflows/tursoci.yml @@ -0,0 +1,80 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Go + +on: + pull_request: + pull_request_target: + branches: ["main"] + push: + branches: ["main"] + +env: + TURSO_API_TOKEN: ${{ secrets.TURSOCI_TOKEN }} + +jobs: + authorize: + environment: ${{ github.event_name == 'pull_request_target' && + github.event.pull_request.head.repo.full_name != github.repository && + 'external' || 'internal' }} + runs-on: ubuntu-latest + steps: + - run: true + + build: + needs: authorize + runs-on: self-hosted + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + #ref: "refs/pull/${{ github.event.number }}/merge" # THIS IS INSECURE + + - name: Integration tests checkout + uses: actions/checkout@v3 + with: + repository: tursodatabase/tursotest + ref: "main" + path: "tests" + token: ${{ secrets.ACCESS_TOKEN_TO_TESTS }} + + - name: Setup Golang with cache + uses: actions/setup-go@v4 + with: + go-version-file: go.mod + cache: false + + - name: TidyTree + run: if [ "$(go mod tidy && git diff | wc -l)" -gt 0 ]; then exit 1; fi + + - name: Format + run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi + + - name: Build + run: go build -v ./... + + - name: Vet + run: go vet -v ./... + + - name: Install sqlclosecheck + run: go install github.com/ryanrolds/sqlclosecheck@latest + + - name: sqlclosecheck + run: go vet -vettool=${HOME}/go/bin/sqlclosecheck ./... + + - name: Staticcheck + uses: dominikh/staticcheck-action@v1.3.0 + with: + version: "2023.1.2" + build-tags: "preview" + install-go: false + + - name: Test + run: go test -v ./... + + - name: Build Turso binary + run: go build -o turso cmd/turso/main.go + + - name: Integration Test + run: cd tests && export TURSO_BINARY=../turso && go run cmd/tursotest/main.go -test.v -test.count=1 run integrationtests \ No newline at end of file