Skip to content

Fix v2 dry plan (#580) #655

Fix v2 dry plan (#580)

Fix v2 dry plan (#580) #655

# Run secret-dependent integration tests only after /test-with-secrets approval
on:
push:
branches:
- main
pull_request:
types: [ labeled ]
repository_dispatch:
types: [ test-with-secrets-command ]
name: Integration tests
jobs:
# Branch-based in origin repo pull request
integration-trusted:
runs-on: ubuntu-latest
if: |
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository &&
${{ github.event.label.name }} == 'v1-engine-changed'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '21'
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: build
run: |
./mvnw clean install -B -DskipTests
- name: Prepare python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip' # caching pip dependencies
- run: pip install -r wren-sqlglot-server/requirements.txt
- name: integration tests
env:
TEST_BIG_QUERY_PROJECT_ID: ${{ secrets.TEST_BIG_QUERY_PROJECT_ID }}
TEST_BIG_QUERY_PARENT_PROJECT_ID: ${{ secrets.TEST_BIG_QUERY_PARENT_PROJECT_ID }}
TEST_BIG_QUERY_CREDENTIALS_BASE64_JSON: ${{ secrets.TEST_BIG_QUERY_CREDENTIALS_BASE64_JSON }}
TEST_BIG_QUERY_BUCKET_NAME: ${{ secrets.TEST_BIG_QUERY_BUCKET_NAME }}
TEST_DUCKDB_STORAGE_ACCESS_KEY: ${{ secrets.TEST_DUCKDB_STORAGE_ACCESS_KEY }}
TEST_DUCKDB_STORAGE_SECRET_KEY: ${{ secrets.TEST_DUCKDB_STORAGE_SECRET_KEY }}
run: |
./mvnw test -B --fail-at-end -pl :wren-tests
# Repo owner has commented /test-with-secrets on a (fork-based) pull request
integration-fork:
runs-on: ubuntu-latest
permissions:
pull-requests: write
checks: write
if: |
github.event_name == 'repository_dispatch' &&
github.event.client_payload.slash_command.args.named.sha != '' &&
contains(
github.event.client_payload.pull_request.head.sha,
github.event.client_payload.slash_command.args.named.sha
)
steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '21'
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Create comment
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.client_payload.pull_request.number }}
body: |
ci link: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: build
run: |
./mvnw clean install -B -DskipTests
- name: Prepare python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip' # caching pip dependencies
- run: pip install -r wren-sqlglot-server/requirements.txt
- name: integration tests
env:
TEST_BIG_QUERY_PROJECT_ID: ${{ secrets.TEST_BIG_QUERY_PROJECT_ID }}
TEST_BIG_QUERY_PARENT_PROJECT_ID: ${{ secrets.TEST_BIG_QUERY_PARENT_PROJECT_ID }}
TEST_BIG_QUERY_CREDENTIALS_BASE64_JSON: ${{ secrets.TEST_BIG_QUERY_CREDENTIALS_BASE64_JSON }}
TEST_BIG_QUERY_BUCKET_NAME: ${{ secrets.TEST_BIG_QUERY_BUCKET_NAME }}
TEST_DUCKDB_STORAGE_ACCESS_KEY: ${{ secrets.TEST_DUCKDB_STORAGE_ACCESS_KEY }}
TEST_DUCKDB_STORAGE_SECRET_KEY: ${{ secrets.TEST_DUCKDB_STORAGE_SECRET_KEY }}
run: |
./mvnw test -B --fail-at-end -pl :wren-tests
# Update check run called "integration-fork"
- uses: actions/github-script@v6
id: update-check-run
if: ${{ always() }}
env:
number: ${{ github.event.client_payload.pull_request.number }}
job: ${{ github.job }}
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
conclusion: ${{ job.status }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pull } = await github.rest.pulls.get({
...context.repo,
pull_number: process.env.number
});
const ref = pull.head.sha;
const { data: checks } = await github.rest.checks.listForRef({
...context.repo,
ref
});
const check = checks.check_runs.filter(c => c.name === process.env.job);
const { data: result } = await github.rest.checks.update({
...context.repo,
check_run_id: check[0].id,
status: 'completed',
conclusion: process.env.conclusion
});
return result;