Update modal component's button #1419
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: End-to-end Tests | |
concurrency: | |
group: e2e-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
paths: | |
- "*.go" | |
- "go.mod" | |
- "go.sum" | |
- "pkg/**" | |
- "tools/**" | |
- "config/**" | |
- "!config/stack/ttn-lw-stack.yml" | |
- "package.json" | |
- "pkg/webui/**" | |
- "sdk/js/**" | |
- "yarn.lock" | |
- "cypress/**" | |
- "docker-compose.yml" | |
- ".github/workflows/console-e2e.yml" | |
env: | |
TTN_LW_LOG_LEVEL: debug | |
TTN_LW_IS_EMAIL_PROVIDER: dir | |
TTN_LW_IS_EMAIL_DIR: .dev/email | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
CYPRESS_FAIL_FAST: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
determine-if-required: | |
name: Determine if run is required | |
runs-on: ubuntu-24.04 | |
outputs: | |
needs-to-run: ${{ steps.check-result.outputs.passed != 'true' }} | |
hash: ${{ steps.get-hash.outputs.hash }} | |
timeout-minutes: 5 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Get hash of code files | |
id: get-hash | |
run: echo "hash=${{ hashFiles('.github/workflows/console-e2e.yml', '*.go', 'go.mod', 'go.sum', 'pkg/**', 'tools/**', 'config/**', 'package.json', 'pkg/webui/**', 'sdk/js/**', 'yarn.lock', 'cypress/**', 'docker-compose.yml') }}" >> $GITHUB_OUTPUT | |
- name: Get the cached result | |
id: run-cache | |
uses: actions/cache@v4 | |
with: | |
path: .cache/passed | |
key: run-cache-${{ steps.get-hash.outputs.hash }}-${{ github.run_id }} | |
restore-keys: | | |
run-cache-${{ steps.get-hash.outputs.hash }} | |
- name: Check cached result connected to the hashed files (if any) | |
id: check-result | |
continue-on-error: true | |
run: test -f .cache/passed && echo "passed=$(cat .cache/passed)" >> $GITHUB_OUTPUT | |
preparation: | |
name: Run preparations | |
runs-on: ubuntu-24.04 | |
needs: determine-if-required | |
if: needs.determine-if-required.outputs.needs-to-run == 'true' | |
timeout-minutes: 30 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Install Go and Dependencies | |
uses: ./.github/actions/install-go-and-deps | |
- name: Build Mage | |
uses: ./.github/actions/build-mage | |
- name: Install Node and Dependencies | |
uses: ./.github/actions/install-node-and-deps | |
- name: Initialize SQL dump cache | |
id: db-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
.env/cache/database.pgdump | |
.env/admin_api_key.txt | |
key: db-cache-${{ hashFiles('pkg/identityserver/**/*.go', 'pkg/identityserver/**/*.sql', 'cmd/ttn-lw-stack/commands/is_db.go', '.github/workflows/console-e2e.yml', 'docker-compose.yml') }} | |
- name: Initialize device repository index cache | |
id: dr-index-cache | |
uses: actions/cache@v4 | |
with: | |
path: data/lorawan-devices-index | |
key: dr-index-cache-${{ hashFiles('data/lorawan-devices') }} | |
- name: Create device repository index | |
run: tools/bin/mage dev:initDeviceRepo | |
if: steps.dr-index-cache.outputs.cache-hit != 'true' | |
- name: Run test preparations | |
if: steps.db-cache.outputs.cache-hit != 'true' | |
run: tools/bin/mage -v dev:dbStop dev:dbErase dev:dbStart dev:initStack dev:sqlDump | |
- name: Build Frontend | |
uses: ./.github/actions/build-frontend | |
- name: Initialize build cache | |
id: build-cache | |
uses: actions/cache@v4 | |
with: | |
path: ttn-lw-stack | |
key: build-cache-${{ hashFiles('go.mod', 'go.sum', 'pkg/**', 'config/**', 'cmd/**') }} | |
- name: Build TTS | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: go build ./cmd/ttn-lw-stack | |
- name: Zip build artifacts | |
run: zip -r build.zip .env/cache/database.pgdump .env/admin_api_key.txt data/lorawan-devices-index public ttn-lw-stack tools/bin/mage | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-files | |
path: build.zip | |
end-to-end: | |
name: Main frontend end-to-end tests (Chrome) | |
runs-on: ubuntu-24.04 | |
env: | |
NODE_ENV: development | |
CYPRESS_MACHINE_NUMBER: ${{ matrix.machines }} | |
strategy: | |
matrix: | |
machines: [1, 2, 3, 4] | |
needs: [determine-if-required, preparation] | |
if: needs.determine-if-required.outputs.needs-to-run == 'true' | |
timeout-minutes: 15 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Install Go and Dependencies | |
uses: ./.github/actions/install-go-and-deps | |
- name: Build Mage | |
uses: ./.github/actions/build-mage | |
- name: Install Node and Dependencies | |
uses: ./.github/actions/install-node-and-deps | |
- name: Upgrade Google Chrome | |
run: | | |
sudo apt-get update | |
sudo apt-get --only-upgrade install google-chrome-stable | |
google-chrome --version | |
- uses: actions/download-artifact@v4 | |
name: Download build artifacts | |
with: | |
name: "build-files" | |
- name: Download last failed spec | |
uses: dawidd6/action-download-artifact@v3 | |
continue-on-error: true | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
workflow: console-e2e.yml | |
branch: ${{ github.head_ref }} | |
workflow_conclusion: completed | |
name: cypress-failed-test-spec | |
search_artifacts: true | |
- name: Read failed spec file | |
id: get-failed-spec | |
continue-on-error: true | |
run: | | |
sed -i 's/\.\.\///g' .failed-specs-*.txt | |
sed -i 's|/integration/|/e2e/|' .failed-specs-*.txt | |
echo "failed-test=$(paste -d , .failed-specs-*.txt)" >> $GITHUB_OUTPUT | |
echo "neg-failed-test=!$(paste -d ',!' .failed-specs-*.txt)" >> $GITHUB_OUTPUT | |
- name: Unzip build artifacts | |
run: unzip -o build.zip | |
- name: Generate certs | |
run: tools/bin/mage dev:certificates | |
- name: Restore initialized sql db | |
run: tools/bin/mage -v dev:dbStart dev:sqlRestore | |
- name: Run stack | |
run: tools/bin/mage dev:startDevStack & | |
- name: Run previously failed test first | |
uses: cypress-io/github-action@v6 | |
if: steps.get-failed-spec.outputs.failed-test != '' | |
with: | |
config-file: config/cypress.config.js | |
config: baseUrl=https://localhost:8885 | |
record: true | |
parallel: true | |
browser: chrome | |
group: previously-failed-${{ needs.determine-if-required.outputs.hash }} | |
spec: ${{ steps.get-failed-spec.outputs.failed-test }} | |
- name: Run frontend end-to-end tests | |
uses: cypress-io/github-action@v6 | |
with: | |
config-file: config/cypress.config.js | |
config: baseUrl=https://localhost:8885 | |
record: true | |
parallel: true | |
browser: chrome | |
group: main-${{ needs.determine-if-required.outputs.hash }} | |
spec: | | |
**/* | |
!cypress/e2e/smoke/smoke.spec.js | |
${{ steps.get-failed-spec.outputs.neg-failed-test }} | |
- name: Upload logs | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: logs | |
path: .cache/devStack.log | |
- name: Upload screenshots for failed tests | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
- name: Upload name of failing test | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-failed-test-spec | |
path: .cache/.failed-specs-*.txt | |
cross-browser-smoke: | |
name: Cross-browser smoke tests (Firefox 129.0) | |
runs-on: ubuntu-24.04 | |
env: | |
NODE_ENV: development | |
needs: [determine-if-required, preparation] | |
if: needs.determine-if-required.outputs.needs-to-run == 'true' | |
timeout-minutes: 15 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Install Go and Dependencies | |
uses: ./.github/actions/install-go-and-deps | |
- name: Build Mage | |
uses: ./.github/actions/build-mage | |
- name: Install Node and Dependencies | |
uses: ./.github/actions/install-node-and-deps | |
- uses: actions/download-artifact@v4 | |
name: Download build artifacts | |
with: | |
name: "build-files" | |
- name: Unzip build artifacts | |
run: unzip -o build.zip | |
- name: Install FF 115.7.0 ESR | |
run: | | |
wget --no-verbose -O /tmp/firefox.tar.bz2 https://download-installer.cdn.mozilla.net/pub/firefox/releases/129.0/linux-x86_64/en-US/firefox-129.0.tar.bz2 | |
tar -C /opt -xjf /tmp/firefox.tar.bz2 | |
rm /tmp/firefox.tar.bz2 | |
sudo ln -fs /opt/firefox/firefox /usr/bin/firefox | |
- name: Generate certs | |
run: tools/bin/mage dev:certificates | |
- name: Restore initialized sql db | |
run: tools/bin/mage dev:dbStart dev:sqlRestore | |
- name: Run stack | |
run: tools/bin/mage dev:startDevStack & | |
- name: Run end-to-end smoke tests (Firefox) | |
uses: cypress-io/github-action@v6 | |
with: | |
config-file: config/cypress.config.js | |
config: baseUrl=https://localhost:8885 | |
browser: firefox | |
record: true | |
spec: cypress/e2e/smoke/smoke.spec.js | |
- name: Upload logs | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: logs | |
path: .cache/devStack.log | |
- name: Upload screenshots for failed tests | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
cache-result: | |
name: Write result cache | |
runs-on: ubuntu-24.04 | |
needs: [preparation, end-to-end, cross-browser-smoke, determine-if-required] | |
timeout-minutes: 5 | |
steps: | |
- name: Setup result cache to skip redundant runs | |
id: run-cache | |
uses: actions/cache@v4 | |
with: | |
path: .cache/passed | |
key: run-cache-${{ needs.determine-if-required.outputs.hash }} | |
- name: Create result file for caching | |
run: mkdir -p .cache && echo true > .cache/passed |