From 6f2b7667f4ba28126c8b90bc995d1a9e670dfc6d Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Thu, 27 Aug 2020 15:00:19 -0700 Subject: [PATCH] /{mysql-client-tests-entrypoint.sh, MySQLDockerfile, .github/}: Testing custom action --- .github/workflows/ci-mysql-client-tests.yaml | 17 +++++ .../workflows/ci-mysql-integration-tests.yaml | 68 ------------------- ACTIONS-README.md | 13 ++++ MySQLDockerfile | 29 +++++--- action.yaml | 8 +++ mysql-client-tests-entrypoint.sh | 13 ++++ 6 files changed, 69 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/ci-mysql-client-tests.yaml delete mode 100644 .github/workflows/ci-mysql-integration-tests.yaml create mode 100644 ACTIONS-README.md create mode 100644 action.yaml create mode 100755 mysql-client-tests-entrypoint.sh diff --git a/.github/workflows/ci-mysql-client-tests.yaml b/.github/workflows/ci-mysql-client-tests.yaml new file mode 100644 index 0000000000..7e5cd7f9a6 --- /dev/null +++ b/.github/workflows/ci-mysql-client-tests.yaml @@ -0,0 +1,17 @@ +on: [push] + +jobs: + mysql_client_integrations_job: + runs-on: ubuntu-latest + name: Run tests + steps: + # To use this repository's private action, + # you must check out the repository + - name: Checkout + uses: actions/checkout@v2 + - name: Test mysql client integrations + uses: ./ # Uses an action in the root directory + id: mysql-tests + # Use the output from the `hello` step + - name: Get the output results + run: echo "The results were ${{ steps.mysql-tests.outputs.results }}" \ No newline at end of file diff --git a/.github/workflows/ci-mysql-integration-tests.yaml b/.github/workflows/ci-mysql-integration-tests.yaml deleted file mode 100644 index 9b8e1a6b32..0000000000 --- a/.github/workflows/ci-mysql-integration-tests.yaml +++ /dev/null @@ -1,68 +0,0 @@ -name: Test MySQL Integrations - -on: - pull_request: - branches: [ master ] - -jobs: - test: - name: Bats tests for MySQL integrations - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: [ ubuntu-latest ] - steps: - - name: Setup Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.13 - id: go - - name: Setup Python 3.x - uses: actions/setup-python@v2 - with: - python-version: ^3.6 - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: ^12 - - name: Create CI Bin - run: | - mkdir -p ./.ci_bin - echo "::add-path::$(pwd)/.ci_bin" - - name: Install Bats - run: | - npm i bats - echo "::add-path::$(pwd)/node_modules/.bin" - working-directory: ./.ci_bin - - name: Install Dolt - working-directory: ./go - run: | - go build -mod=readonly -o ../.ci_bin/dolt ./cmd/dolt/. - go build -mod=readonly -o ../.ci_bin/git-dolt ./cmd/git-dolt/. - go build -mod=readonly -o ../.ci_bin/git-dolt-smudge ./cmd/git-dolt-smudge/. - go build -mod=readonly -o ../.ci_bin/remotesrv ./utils/remotesrv/. - - name: Setup Dolt Config - run: | - dolt config --global --add user.name 'Liquidata Actions' - dolt config --global --add user.email 'actions@liquidata.co' - - uses: actions/setup-java@v1 - with: - java-version: '9.0.4' # The JDK version to make available on the path. - java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk - architecture: x64 # (x64 or x86) - defaults to x64 - - name: Install mysql connector for java - run: | - curl -L -o /mysql-client-tests/java/mysql-connector-java-8.0.21.jar \ - https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.21/mysql-connector-java-8.0.21.jar - - name: Install python deps - run: | - pip3 install mysql-connector-python - pip3 install PyMySQL - - name: Install node deps - working-directory: ./mysql-client-tests/node - run: npm install - - name: Test all - run: | - bats --tap mysql-client-tests.bats - working-directory: ./mysql-client-tests diff --git a/ACTIONS-README.md b/ACTIONS-README.md new file mode 100644 index 0000000000..7d858ba86b --- /dev/null +++ b/ACTIONS-README.md @@ -0,0 +1,13 @@ +# Dolt MySQL client integration docker action + +This action runs ./mysql-client-tests in docker. + +## Outputs + +### `results` + +The results of the tests. + +## Example usage + +uses: actions/mysql-client-test-action@v1 diff --git a/MySQLDockerfile b/MySQLDockerfile index 6e0cd720f8..68f6c78246 100644 --- a/MySQLDockerfile +++ b/MySQLDockerfile @@ -1,6 +1,15 @@ +FROM golang:1.15.0-buster as builder +WORKDIR /root/building/go +COPY ./go/ . + +# install dolt from source +ENV GOFLAGS="-mod=readonly" +RUN go build -o dolt ./cmd/dolt + FROM ubuntu:18.04 +COPY --from=builder /root/building/go/dolt /usr/local/bin/dolt COPY ./mysql-client-tests /mysql-client-tests -COPY ./go /dolt-go +COPY ./mysql-client-tests-entrypoint.sh /mysql-client-tests/entrypoint.sh # install python ENV DEBIAN_FRONTEND=noninteractive @@ -21,8 +30,7 @@ RUN apt-get -y install curl RUN pip3 install mysql-connector-python RUN pip3 install PyMySQL -# install java -# Install OpenJDK-8 +# install OpenJDK-8 RUN apt-get update && \ apt-get install -y openjdk-8-jdk && \ apt-get install -y ant && \ @@ -49,18 +57,16 @@ RUN cat /etc/apt/sources.list.d/nodesource.list RUN apt -y install nodejs # install bats -RUN apt-get update -RUN apt-get install bats +RUN apt-get -y update +RUN apt-get -y install bats -# install dolt TODO build from source -RUN curl -L https://github.com/liquidata-inc/dolt/releases/latest/download/install.sh | bash RUN dolt version # setup dolt config -RUN dolt config --global --add metrics.disabled true -RUN dolt config --global --add metrics.host localhost -RUN dolt config --global --add user.name mysql-test-runner -RUN dolt config --global --add user.email mysql-test-runner@liquidata.co +#RUN dolt config --global --add metrics.disabled true +#RUN dolt config --global --add metrics.host localhost +#RUN dolt config --global --add user.name mysql-test-runner +#RUN dolt config --global --add user.email mysql-test-runner@liquidata.co # install node deps WORKDIR /mysql-client-tests/node @@ -69,3 +75,4 @@ RUN npm install # run tests WORKDIR /mysql-client-tests #CMD ["bats", "mysql-client-tests.bats"] +ENTRYPOINT ["/mysql-client-tests/entrypoint.sh"] diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000000..9660678eec --- /dev/null +++ b/action.yaml @@ -0,0 +1,8 @@ +name: 'Dolt MySQL client integration tests' +description: 'Smoke tests for mysql client integrations' +outputs: + results: # logged test results output + description: 'The results of the tests' +runs: + using: 'docker' + image: 'MySQLDockerfile' diff --git a/mysql-client-tests-entrypoint.sh b/mysql-client-tests-entrypoint.sh new file mode 100755 index 0000000000..80bfa4155a --- /dev/null +++ b/mysql-client-tests-entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +pwd +ls -a +dolt config --global --add metrics.disabled true +dolt config --global --add metrics.host localhost +dolt config --global --add user.name mysql-test-runner +dolt config --global --add user.email mysql-test-runner@liquidata.co + +bats -v + +results=$(bats /mysql-client-tests/mysql-client-tests.bats) +echo "::set-output name=results::$results" \ No newline at end of file