diff --git a/.github/workflows/integration-tests-v1.yaml b/.github/workflows/integration-tests-v1.yaml new file mode 100644 index 00000000..26bc82b3 --- /dev/null +++ b/.github/workflows/integration-tests-v1.yaml @@ -0,0 +1,85 @@ +name: Run integration tests for 1.0 +on: + workflow_dispatch: + inputs: + environment: + description: 'Environment to run the tests against' + type: choice + required: true + default: 'dev' + options: + - dev + - staging + workflow_call: + inputs: + environment: + default: 'staging' + required: false + type: string + secrets: + FIREBOLT_USERNAME: + required: true + FIREBOLT_PASSWORD: + required: true + FIREBOLT_STG_USERNAME: + required: true + FIREBOLT_STG_PASSWORD: + required: true + SERVICE_ID: + required: true + SERVICE_SECRET: + required: true + SERVICE_ID_STG: + required: true + SERVICE_SECRET_STG: + required: true +jobs: + tests: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up node.js + uses: actions/setup-node@v2 + with: + node-version: '16' + + - name: Install dependencies + run: npm install + + - name: Determine env variables + run: | + if [ "${{ inputs.environment }}" == 'staging' ]; then + echo "USERNAME=${{ secrets.FIREBOLT_STG_USERNAME }}" >> "$GITHUB_ENV" + echo "PASSWORD=${{ secrets.FIREBOLT_STG_PASSWORD }}" >> "$GITHUB_ENV" + echo "CLIENT_ID=${{ secrets.SERVICE_ID_STG }}" >> "$GITHUB_ENV" + echo "CLIENT_SECRET=${{ secrets.SERVICE_SECRET_STG }}" >> "$GITHUB_ENV" + else + echo "USERNAME=${{ secrets.FIREBOLT_USERNAME }}" >> "$GITHUB_ENV" + echo "PASSWORD=${{ secrets.FIREBOLT_PASSWORD }}" >> "$GITHUB_ENV" + echo "CLIENT_ID=${{ secrets.SERVICE_ID }}" >> "$GITHUB_ENV" + echo "CLIENT_SECRET=${{ secrets.SERVICE_SECRET }}" >> "$GITHUB_ENV" + fi + + - name: Setup database and engine + id: setup + uses: firebolt-db/integration-testing-setup@v1 + with: + firebolt-username: ${{ env.USERNAME }} + firebolt-password: ${{ env.PASSWORD }} + api-endpoint: "api.${{ inputs.environment }}.firebolt.io" + region: "us-east-1" + + - name: Run integration tests + env: + FIREBOLT_USERNAME: ${{ env.USERNAME }} + FIREBOLT_PASSWORD: ${{ env.PASSWORD }} + FIREBOLT_DATABASE: ${{ steps.setup.outputs.database_name }} + FIREBOLT_ENGINE_NAME: ${{ steps.setup.outputs.engine_name }} + FIREBOLT_ENGINE_ENDPOINT: ${{ steps.setup.outputs.engine_url }} + FIREBOLT_API_ENDPOINT: "api.${{ inputs.environment }}.firebolt.io" + FIREBOLT_CLIENT_ID: ${{ env.CLIENT_ID }} + FIREBOLT_CLIENT_SECRET: ${{ env.CLIENT_SECRET }} + run: | + npm run test:ci integration \ No newline at end of file diff --git a/.github/workflows/integration-tests-v2.yaml b/.github/workflows/integration-tests-v2.yaml new file mode 100644 index 00000000..5d7f9cd0 --- /dev/null +++ b/.github/workflows/integration-tests-v2.yaml @@ -0,0 +1,76 @@ +name: Run integration tests for 2.0 +on: + workflow_dispatch: + inputs: + environment: + description: 'Environment to run the tests against' + type: choice + required: true + default: 'staging' + options: + - dev + - staging + workflow_call: + inputs: + environment: + description: 'Environment to run the tests against' + type: choice + required: true + default: 'staging' + options: + - dev + - staging + secrets: + FIREBOLT_CLIENT_ID_STG_NEW_IDN: + required: true + FIREBOLT_CLIENT_SECRET_STG_NEW_IDN: + required: true + FIREBOLT_CLIENT_ID_NEW_IDN: + required: true + FIREBOLT_CLIENT_SECRET_NEW_IDN: + required: true +jobs: + tests: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up node.js + uses: actions/setup-node@v2 + with: + node-version: '16' + + - name: Install dependencies + run: npm install + + - name: Determine env variables + run: | + if [ "${{ inputs.environment }}" == 'staging' ]; then + echo "CLIENT_ID=${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}" >> "$GITHUB_ENV" + echo "CLIENT_SECRET=${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}" >> "$GITHUB_ENV" + else + echo "CLIENT_ID=${{ secrets.FIREBOLT_CLIENT_ID_NEW_IDN }}" >> "$GITHUB_ENV" + echo "CLIENT_SECRET=${{ secrets.FIREBOLT_CLIENT_SECRET_NEW_IDN }}" >> "$GITHUB_ENV" + fi + + - name: Setup database and engine + id: setup + uses: firebolt-db/integration-testing-setup@v2 + with: + firebolt-client-id: ${{ env.CLIENT_ID }} + firebolt-client-secret: ${{ env.CLIENT_SECRET }} + account: "developer" + api-endpoint: "api.${{ inputs.environment }}.firebolt.io" + region: "us-east-1" + + - name: Run integration tests + env: + FIREBOLT_ACCOUNT: "developer" + FIREBOLT_DATABASE: ${{ steps.setup.outputs.database_name }} + FIREBOLT_ENGINE_NAME: ${{ steps.setup.outputs.engine_name }} + FIREBOLT_API_ENDPOINT: "api.${{ inputs.environment }}.firebolt.io" + FIREBOLT_CLIENT_ID: ${{ env.CLIENT_ID + FIREBOLT_CLIENT_SECRET: ${{ env.CLIENT_SECRET }} + run: | + npm run test:ci integration \ No newline at end of file diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index 1701fde9..5348ae82 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -1,45 +1,68 @@ name: Run integration tests on: workflow_dispatch: + inputs: + environment: + description: 'Environment to run the tests against' + type: choice + required: true + default: 'dev' + options: + - dev + - staging workflow_call: inputs: - branch: + environment: + default: 'staging' required: false type: string - description: 'Branch to run on' + secrets: + FIREBOLT_USERNAME: + required: true + FIREBOLT_PASSWORD: + required: true + FIREBOLT_STG_USERNAME: + required: true + FIREBOLT_STG_PASSWORD: + required: true + SERVICE_ID: + required: true + SERVICE_SECRET: + required: true + SERVICE_ID_STG: + required: true + SERVICE_SECRET_STG: + required: true + # V2 secrets + FIREBOLT_CLIENT_ID_STG_NEW_IDN: + required: true + FIREBOLT_CLIENT_SECRET_STG_NEW_IDN: + required: true + FIREBOLT_CLIENT_ID_NEW_IDN: + required: true + FIREBOLT_CLIENT_SECRET_NEW_IDN: + required: true jobs: - tests: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - with: - ref: ${{ inputs.branch }} - - - name: Set up node.js - uses: actions/setup-node@v2 - with: - node-version: '16' - - - name: Install dependencies - run: npm install - - name: Setup database and engine - id: setup - uses: firebolt-db/integration-testing-setup@v2 - with: - firebolt-client-id: ${{ secrets.FIREBOLT_CLIENT_ID_NEW_IDN }} - firebolt-client-secret: ${{ secrets.FIREBOLT_CLIENT_SECRET_NEW_IDN }} - account: "developer" - api-endpoint: "api.dev.firebolt.io" - region: "us-east-1" + integration-test-v1: + uses: ./.github/workflows/integration-tests-v1.yml + with: + environment: ${{ inputs.environment }} + secrets: + FIREBOLT_USERNAME: ${{ secrets.FIREBOLT_USERNAME }} + FIREBOLT_PASSWORD: ${{ secrets.FIREBOLT_PASSWORD }} + FIREBOLT_STG_USERNAME: ${{ secrets.FIREBOLT_STG_USERNAME }} + FIREBOLT_STG_PASSWORD: ${{ secrets.FIREBOLT_STG_PASSWORD }} + SERVICE_ID: ${{ secrets.SERVICE_ID }} + SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }} + SERVICE_ID_STG: ${{ secrets.SERVICE_ID_STG }} + SERVICE_SECRET_STG: ${{ secrets.SERVICE_SECRET_STG }} + integration-test-v2: + uses: ./.github/workflows/integration-tests-v2.yml + with: + environment: ${{ inputs.environment }} + secrets: + FIREBOLT_CLIENT_ID_STG_NEW_IDN: ${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }} + FIREBOLT_CLIENT_SECRET_STG_NEW_IDN: ${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }} + FIREBOLT_CLIENT_ID_NEW_IDN: ${{ secrets.FIREBOLT_CLIENT_ID_NEW_IDN }} + FIREBOLT_CLIENT_SECRET_NEW_IDN: ${{ secrets.FIREBOLT_CLIENT_SECRET_NEW_IDN }} - - name: Run integration tests - env: - FIREBOLT_ACCOUNT: "developer" - FIREBOLT_DATABASE: ${{ steps.setup.outputs.database_name }} - FIREBOLT_ENGINE_NAME: ${{ steps.setup.outputs.engine_name }} - FIREBOLT_API_ENDPOINT: ${{ secrets.FIREBOLT_API_ENDPOINT }} - FIREBOLT_CLIENT_ID: ${{ secrets.FIREBOLT_CLIENT_ID_NEW_IDN }} - FIREBOLT_CLIENT_SECRET: ${{ secrets.FIREBOLT_CLIENT_SECRET_NEW_IDN }} - run: | - npm run test:ci integration diff --git a/.github/workflows/release-v0.yaml b/.github/workflows/release-v0.yaml deleted file mode 100644 index 1dd0186b..00000000 --- a/.github/workflows/release-v0.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: 0.x Release new version - -on: - workflow_dispatch: - inputs: - majorRelease: - required: false - description: 'Release as version. Example values are: minor, major, 5.6.1, 1.0.0. Leave empty for regular release.' - tag: - required: false - description: 'Prerelease tag name. Leave empty for regular release.' - -jobs: - release: - uses: ./.github/workflows/release-workflow.yaml - with: - branch: 0.x - majorRelease: ${{ inputs.majorRelease }} - tag: ${{ inputs.tag }} - secrets: inherit diff --git a/.github/workflows/release-workflow.yaml b/.github/workflows/release-workflow.yaml index 858017b5..e34c4a63 100644 --- a/.github/workflows/release-workflow.yaml +++ b/.github/workflows/release-workflow.yaml @@ -1,34 +1,27 @@ name: Release new version on: - workflow_call: + workflow_dispatch: inputs: majorRelease: required: false - type: string description: 'Release as version. Example values are: minor, major, 5.6.1, 1.0.0. Leave empty for regular release.' - branch: - required: true - type: string - description: 'main or 0.x branch' tag: required: false - type: string description: 'Prerelease tag name. Leave empty for regular release.' jobs: - # integration-tests: - # uses: ./.github/workflows/integration-tests.yaml + integration-tests: + uses: ./.github/workflows/integration-tests.yaml publish: runs-on: ubuntu-latest - # needs: integration-tests + needs: integration-tests steps: - name: Check out code uses: actions/checkout@v2 with: fetch-depth: 0 - ref: ${{ inputs.branch }} token: ${{ secrets.RELEASE_PAT }} - name: Set up node.js @@ -62,7 +55,7 @@ jobs: - name: Push git tags run: | - git push --follow-tags origin ${{ inputs.branch }} + git push --follow-tags origin main - name: Get latest tag id: tag_generation diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index a66b5fc9..00000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Release new version - -on: - workflow_dispatch: - inputs: - majorRelease: - required: false - description: 'Release as version. Example values are: minor, major, 5.6.1, 1.0.0. Leave empty for regular release.' - tag: - required: false - description: 'Prerelease tag name. Leave empty for regular release.' - -jobs: - release: - uses: ./.github/workflows/release-workflow.yaml - with: - branch: main - majorRelease: ${{ inputs.majorRelease }} - tag: ${{ inputs.tag }} - secrets: inherit