diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index cf569691..f7b0ec1d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,7 +1,7 @@ name: Check on: [ pull_request, push ] jobs: - mysql: + mysql5_7: runs-on: ubuntu-latest # push: always run. # pull_request: run only when the PR is submitted from a forked repository, not within this repository. @@ -13,34 +13,88 @@ jobs: image: mysql:5.7 options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10 ports: - - "3306:3306" + - "3306:3306" env: MYSQL_ROOT_PASSWORD: root MYSQL_USER: ci MYSQL_PASSWORD: password steps: - - uses: actions/checkout@v3 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: 8 - distribution: 'temurin' - cache: "gradle" - - name: Connect - run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "show databases;" - - name: Create database - run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "create database ci_test;" - - name: Build with testing - run: ./gradlew --stacktrace :embulk-output-mysql:check + - uses: actions/checkout@v4 + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: "zulu" + cache: "gradle" + - name: Connect + run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "show databases;" + - name: Create database + run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "create database ci_test;" + - name: Build with testing + run: ./gradlew --stacktrace :embulk-output-mysql:check + env: + _JAVA_OPTIONS: "-Xmx2048m -Xms512m" + EMBULK_OUTPUT_MYSQL_TEST_CONFIG: "${{ github.workspace }}/ci/mysql.yml" + - uses: actions/upload-artifact@v4 + if: always() + with: + name: mysql5_7 + path: embulk-output-mysql/build/reports/tests/test + mysql8_3: + runs-on: ubuntu-latest + # push: always run. + # pull_request: run only when the PR is submitted from a forked repository, not within this repository. + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + strategy: + fail-fast: false + services: + mysql: + # Testing with MySQL 8.3 here, neither with 8.4 nor 9.0, because + # MySQL 8.4 has disabled mysql_native_password by default. + # Connector/J 5.x cannot connect to MySQL 8.4 due to this. + # TODO: Start testing with MySQL 8.4 and/or 9.0 with Connector/J 8.x. + image: mysql:8.3 + options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10 + ports: + - "3306:3306" env: - _JAVA_OPTIONS: "-Xmx2048m -Xms512m" - EMBULK_OUTPUT_MYSQL_TEST_CONFIG: "${{ github.workspace }}/ci/mysql.yml" - - uses: actions/upload-artifact@v3 - if: always() - with: - name: mysql - path: embulk-output-mysql/build/reports/tests/test - postgresql: + MYSQL_ROOT_PASSWORD: root + MYSQL_USER: ci + MYSQL_PASSWORD: password + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: "zulu" + cache: "gradle" + - name: Connect + run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "show databases;" + - name: show version + run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "select version();" + - name: Create database + run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "create database ci_test;" + # Workaround to change MySQL's password mechanism to `mysql_native_password` + # from `caching_sha2_password` that is the default in MySQL 8 because + # Connector/J 5.x does not support `caching_sha2_password`. + # See: https://dev.mysql.com/doc/refman/8.4/en/account-names.html + # TODO: Start testing with `caching_sha2_password` with Connector/J 8.x. + - name: Change password (root@localhost) + run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" + - name: Change password (root@%) + run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';" + - name: Build with testing + run: ./gradlew --stacktrace :embulk-output-mysql:check + env: + _JAVA_OPTIONS: "-Xmx2048m -Xms512m" + EMBULK_OUTPUT_MYSQL_TEST_CONFIG: "${{ github.workspace }}/ci/mysql.yml" + - uses: actions/upload-artifact@v4 + if: always() + with: + name: mysql8_3 + path: embulk-output-mysql/build/reports/tests/test + postgresql9_4: runs-on: ubuntu-latest # push: always run. # pull_request: run only when the PR is submitted from a forked repository, not within this repository. @@ -56,31 +110,79 @@ jobs: env: POSTGRES_PASSWORD: postgres steps: - - uses: actions/checkout@v3 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: 8 - distribution: 'temurin' - cache: "gradle" - - name: Connect - run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "\l" - env: - PGPASSWORD: postgres - - name: Create database - run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "create database ci_test;" - env: - PGPASSWORD: postgres - - name: Build with testing - run: ./gradlew --stacktrace :embulk-output-postgresql:check + - uses: actions/checkout@v4 + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: "zulu" + cache: "gradle" + - name: Connect + run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "\l" + env: + PGPASSWORD: postgres + - name: Create database + run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "create database ci_test;" + env: + PGPASSWORD: postgres + - name: Build with testing + run: ./gradlew --stacktrace :embulk-output-postgresql:check + env: + _JAVA_OPTIONS: "-Xmx2048m -Xms512m" + EMBULK_OUTPUT_POSTGRESQL_TEST_CONFIG: "${{ github.workspace }}/ci/postgresql.yml" + - uses: actions/upload-artifact@v4 + if: always() + with: + name: postgresql9_4 + path: embulk-output-postgresql/build/reports/tests/test + # Testing with PostgreSQL 13 here, not with PostgreSQL 14 or later, because + # it raises an exception: "The authentication type 10 is not supported." + # TODO: Start testing with PostgreSQL 14 or later. + postgresql13: + runs-on: ubuntu-latest + # push: always run. + # pull_request: run only when the PR is submitted from a forked repository, not within this repository. + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + strategy: + fail-fast: false + services: + postgres: + image: postgres:13 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + ports: + - "5432:5432" env: - _JAVA_OPTIONS: "-Xmx2048m -Xms512m" - EMBULK_OUTPUT_POSTGRESQL_TEST_CONFIG: "${{ github.workspace }}/ci/postgresql.yml" - - uses: actions/upload-artifact@v3 - if: always() - with: - name: postgresql - path: embulk-output-postgresql/build/reports/tests/test + POSTGRES_PASSWORD: postgres + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: "zulu" + cache: "gradle" + - name: Connect + run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "\l" + env: + PGPASSWORD: postgres + - name: Show version + run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "select * from version();" + env: + PGPASSWORD: postgres + - name: Create database + run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "create database ci_test;" + env: + PGPASSWORD: postgres + - name: Build with testing + run: ./gradlew --stacktrace :embulk-output-postgresql:check + env: + _JAVA_OPTIONS: "-Xmx2048m -Xms512m" + EMBULK_OUTPUT_POSTGRESQL_TEST_CONFIG: "${{ github.workspace }}/ci/postgresql.yml" + - uses: actions/upload-artifact@v4 + if: always() + with: + name: postgresql13 + path: embulk-output-postgresql/build/reports/tests/test redshift: runs-on: ubuntu-latest # push: always run. @@ -98,33 +200,33 @@ jobs: env: POSTGRES_PASSWORD: postgres steps: - - uses: actions/checkout@v3 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: 8 - distribution: 'temurin' - cache: "gradle" - - name: Connect - run: psql -h 127.0.0.1 -p 5439 -U postgres -d postgres -c "\l" - env: - PGPASSWORD: postgres - - name: Create database - run: psql -h 127.0.0.1 -p 5439 -U postgres -d postgres -c "create database ci_test;" - env: - PGPASSWORD: postgres - - name: Build with testing - run: ./gradlew --stacktrace :embulk-output-redshift:check - env: - _JAVA_OPTIONS: "-Xmx2048m -Xms512m" - EMBULK_OUTPUT_REDSHIFT_TEST_CONFIG: "${{ github.workspace }}/ci/redshift.yml" - - uses: actions/upload-artifact@v3 - if: always() - with: - name: redshift - path: embulk-output-redshift/build/reports/tests/test - if-no-files-found: ignore - sqlserver: + - uses: actions/checkout@v4 + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: "zulu" + cache: "gradle" + - name: Connect + run: psql -h 127.0.0.1 -p 5439 -U postgres -d postgres -c "\l" + env: + PGPASSWORD: postgres + - name: Create database + run: psql -h 127.0.0.1 -p 5439 -U postgres -d postgres -c "create database ci_test;" + env: + PGPASSWORD: postgres + - name: Build with testing + run: ./gradlew --stacktrace :embulk-output-redshift:check + env: + _JAVA_OPTIONS: "-Xmx2048m -Xms512m" + EMBULK_OUTPUT_REDSHIFT_TEST_CONFIG: "${{ github.workspace }}/ci/redshift.yml" + - uses: actions/upload-artifact@v4 + if: always() + with: + name: redshift + path: embulk-output-redshift/build/reports/tests/test + if-no-files-found: ignore + sqlserver: # TODO: Use https://hub.docker.com/_/microsoft-mssql-server runs-on: ubuntu-latest # push: always run. # pull_request: run only when the PR is submitted from a forked repository, not within this repository. @@ -132,12 +234,12 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: 8 - distribution: 'temurin' - cache: "gradle" - - name: Build-only - run: ./gradlew --stacktrace :embulk-output-sqlserver:compileJava :embulk-output-sqlserver:compileTestJava + - uses: actions/checkout@v4 + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: "zulu" + cache: "gradle" + - name: Build-only + run: ./gradlew --stacktrace :embulk-output-sqlserver:compileJava :embulk-output-sqlserver:compileTestJava