Skip to content

Commit

Permalink
Merge pull request #10691 from richard-cox/e2e-common-build
Browse files Browse the repository at this point in the history
Reduce the amount of time we spend running gh workflows
  • Loading branch information
richard-cox authored Mar 26, 2024
2 parents e422c21 + e539865 commit 443b25b
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 7 deletions.
53 changes: 51 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,46 @@ env:
# Build the dashboard to use in tests. When set to false it will grab `latest` from CDN (useful for running e2e tests quickly)
BUILD_DASHBOARD: true

E2E_BUILD_DIST_NAME: dist
E2E_BUILD_DIST_DIR: dist
E2E_BUILD_DIST_EMBER_NAME: dist_ember
E2E_BUILD_DIST_EMBER_DIR: dist_ember

jobs:
e2e-ui-build:
if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
cache: 'yarn'
- name: Install packages
run: yarn install:ci
- name: Build e2e
run: yarn e2e:build
- name: Upload e2e build
uses: actions/upload-artifact@v4
with:
name: ${{ env.E2E_BUILD_DIST_NAME }}
path: ${{ env.E2E_BUILD_DIST_DIR }}/
if-no-files-found: error
retention-days: 10
compression-level: 9
- name: Upload e2e build ember
uses: actions/upload-artifact@v4
with:
name: ${{ env.E2E_BUILD_DIST_EMBER_NAME }}
path: ${{ env.E2E_BUILD_DIST_EMBER_DIR }}/
if-no-files-found: error
retention-days: 10
compression-level: 9
e2e-test:
if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')"
needs: e2e-ui-build
strategy:
fail-fast: false
matrix:
Expand All @@ -54,6 +91,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: '14.x'
cache: 'yarn'

# Installing fixed version of Chrome since latest version does not work (117-118 didn't work)
# Leaving this here again in case we need to pin to a specific Chrome version in the future
Expand All @@ -67,9 +105,20 @@ jobs:

- name: Install packages
run: yarn install:ci

- name: Download e2e build
uses: actions/download-artifact@v4
with:
name: ${{ env.E2E_BUILD_DIST_NAME }}
path: ${{ env.E2E_BUILD_DIST_DIR }}
- name: Download e2e build ember
uses: actions/download-artifact@v4
with:
name: ${{ env.E2E_BUILD_DIST_EMBER_NAME }}
path: ${{ env.E2E_BUILD_DIST_EMBER_DIR }}

- name: Prepare build
run: yarn e2e:pre-prod
- name: Run Rancher
run: yarn e2e:docker

- name: Setup Rancher and user
run: |
Expand Down
5 changes: 4 additions & 1 deletion cypress/e2e/tests/pages/charts/monitoring-istio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ describe('Charts', { tags: ['@charts', '@adminUser'] }, () => {
const chartsPageUrl = '/c/local/apps/charts/chart?repo-type=cluster&repo=rancher-charts';

describe('Monitoring', () => {
const chartsMonitoringPage = `${ chartsPageUrl }&chart=rancher-monitoring`;
// Ideally we should not specify this, older versions can disappear / have issues.
// However it seems the latest can also have issues (like no matching CRD chart)
const monitoringVersion = '103.0.2%2Bup45.31.1';
const chartsMonitoringPage = `${ chartsPageUrl }&chart=rancher-monitoring&version=${ monitoringVersion }`;

const chartsPage: ChartsPage = new ChartsPage(chartsMonitoringPage);

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"cy:run:sorry": "./scripts/e2e",
"e2e:pre-dev": "yarn docker:local:stop && yarn docker:local:start && NODE_ENV=dev TEST_INSTRUMENT=true yarn build",
"e2e:dev": "START_SERVER_AND_TEST_INSECURE=1 server-test start:dev https-get://localhost:8005 cy:run:sorry",
"e2e:pre-prod": "yarn docker:local:stop && mkdir dist && TEST_INSTRUMENT=true ./scripts/build-e2e && ./scripts/e2e-docker-start ",
"e2e:build": "mkdir dist && TEST_INSTRUMENT=true ./scripts/build-e2e",
"e2e:docker": "yarn docker:local:stop && ./scripts/e2e-docker-start ",
"e2e:prod": "BUILD_DASHBOARD=$BUILD_DASHBOARD GREP_TAGS=$GREP_TAGS TEST_USERNAME=$TEST_USERNAME TEST_BASE_URL=https://127.0.0.1/dashboard yarn cy:run:sorry",
"coverage": "npx nyc merge coverage coverage/coverage.json",
"storybook": "cd storybook && yarn install && yarn storybook",
Expand Down Expand Up @@ -206,4 +207,4 @@
"merge": ">=2.1.1",
"semver": ">=7.5.2"
}
}
}
4 changes: 2 additions & 2 deletions scripts/build-e2e
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BUILD_DASHBOARD="${BUILD_DASHBOARD:-true}"

cd $(dirname $0)/..

OUTPUT_DIR=dist
OUTPUT_DIR="${E2E_BUILD_DIST_DIR:-dist}"

# Note - When fetching dashboard / ui from CDN
# we can't pull the `latest` or `latest2` directory and we don't build a tar.gz for latest builds...
Expand All @@ -41,7 +41,7 @@ else
fi

# Ensure we have the latest ember (rancher/ui) build as well
OUTPUT_EMBER_DIR=dist_ember
OUTPUT_EMBER_DIR="${E2E_BUILD_DIST_EMBER_DIR:-dist_ember}"

echo "Pulling latest rancher/ui"
mkdir $OUTPUT_EMBER_DIR
Expand Down

0 comments on commit 443b25b

Please sign in to comment.