Skip to content
Snippets Groups Projects
  • Nemanja Glumac's avatar
    a54b3dc6
    Overhaul E2E tests token activation logic (#32186) · a54b3dc6
    Nemanja Glumac authored
    
    * Start all tests without a token
    
    * Update tests
    
    * Fix tests in `admin` group
    
    * Fix tests in `dashboard-filters` group
    
    * Fix tests `visualizations` group
    
    * Batch fixes
    
    * Fix database banner snowplow test
    
    * Fix full-app mobile view banner test
    
    * Simplify and remove `isPremiumActive` check
    
    * Fix the helper
    
    * Fix helper to fail fast
    
    * Fix tests
    
    * Ensure token scope is set
    
    * Ensure CYPRESS_ env tokens are present
    
    * Set token only if running Metabase ee
    
    * Improve JSDoc
    
    * Slightly tweak log message
    
    * Update E2E dev guide
    
    * Update cross-version tests
    
    * Remove premium token from Cypress backend setup
    
    * Improve a comment
    
    * Fix test
    
    * Update embedding copy
    
    ---------
    
    Co-authored-by: default avatarAlexander Polyankin <alexander.polyankin@metabase.com>
    Overhaul E2E tests token activation logic (#32186)
    Nemanja Glumac authored
    
    * Start all tests without a token
    
    * Update tests
    
    * Fix tests in `admin` group
    
    * Fix tests in `dashboard-filters` group
    
    * Fix tests `visualizations` group
    
    * Batch fixes
    
    * Fix database banner snowplow test
    
    * Fix full-app mobile view banner test
    
    * Simplify and remove `isPremiumActive` check
    
    * Fix the helper
    
    * Fix helper to fail fast
    
    * Fix tests
    
    * Ensure token scope is set
    
    * Ensure CYPRESS_ env tokens are present
    
    * Set token only if running Metabase ee
    
    * Improve JSDoc
    
    * Slightly tweak log message
    
    * Update E2E dev guide
    
    * Update cross-version tests
    
    * Remove premium token from Cypress backend setup
    
    * Improve a comment
    
    * Fix test
    
    * Update embedding copy
    
    ---------
    
    Co-authored-by: default avatarAlexander Polyankin <alexander.polyankin@metabase.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
pre-release.yml 10.92 KiB
name: Pre-release [WIP]

on:
  workflow_dispatch:
    inputs:
      commit:
        description: 'A full-length commit SHA-1 hash'
        required: true
      version:
        description: 'Intended version (e.g. v0.46.3)'
        required: true

env:
  MAX_HASH_LENGTH: 8
  CUSTOM_REPO: ${{ secrets.CUSTOM_RELEASE_REPO }}

jobs:
  check-commit:
    runs-on: ubuntu-22.04
    timeout-minutes: 10
    steps:
    - name: Ensure that the intended version (${{ github.event.inputs.version }}) was never released before
      run: |
        if [[ "${{ github.event.inputs.version }}" = v* ]]; then
          echo "Checking if ${{ github.event.inputs.version }} conflicts with a past release..."
        else
          echo "ERROR: the intended version must start with 'v', e.g. 'v0.46.3."
          echo "ABORT!"
          exit -1
        fi
        CANONICAL_REFS=https://github.com/metabase/metabase/archive/refs
        URL=${CANONICAL_REFS}/tags/${{ github.event.inputs.version }}.zip
        HTTP_CODE=$(curl -s -L -o /dev/null --head -w "%{HTTP_CODE}" ${URL})
        if [[ $HTTP_CODE =~ "200" ]]; then
          echo "ERROR: that version was already released in the past."
          echo "ABORT!"
          exit -1
        else
          if [[ $HTTP_CODE =~ "404" ]]; then
            echo "That version has not been released yet."
            echo "Proceeding to the next step..."
            exit 0
          else
            echo "ERROR: Unhandled case of HTTP $HTTP_CODE while checking ${URL}"
            echo "ABORT!"
            exit -1
          fi
        fi

    - name: Check out the code to verify the release branch
      uses: actions/checkout@v3
      with:
        fetch-depth: 0  # IMPORTANT! to get all the branches
    - name: Ensure that the specified commit exists in the latest release branch
      run: |
        echo "Checking if the specified commit is in a release branch..."
        COMMIT=${{ github.event.inputs.commit }}
        git branch -a --contains $COMMIT > branches.txt
        if [[ $(grep -c master branches.txt) =~ 1 ]]; then
          echo "Found in master branch. ABORT!"
          exit -1
        fi
        if [[ $(grep -c 'release-x' branches.txt) =~ 1 ]]; then
          echo "Found the commit $COMMIT in:"
          git branch -a --contains $COMMIT
          echo "Proceeding to the next step..."
          exit 0
        else
          echo "Commit $COMMIT is not found in a single release branch"
          echo "ABORT!."