Add tests for persistent attribute case conversion (#2180) #13250
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
### Note: Dependabot does not have access to secrets and is only able | |
### to access a read-only version of the GITHUB-TOKEN: | |
### https://github.com/dependabot/dependabot-core/issues/3253 | |
name: "Build, Test, and Publish" | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
baw-client: | |
name: Build Baw Client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Baw Client | |
uses: actions/checkout@v4 | |
with: | |
repository: QutEcoacoustics/baw-client | |
ref: migration | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "12" | |
cache: "npm" | |
- name: Create environment | |
run: | | |
echo '{ | |
"environments": { | |
"production": { | |
"apiRoot": "https://staging.ecosounds.org", | |
"siteRoot": "http://development.ecosounds.org:4200", | |
"siteDir": "/assets/old-client/", | |
"parentRoot": "http://development.ecosounds.org:4200", | |
"parentDir": "/", | |
"ga": { "trackingId": "" } | |
} | |
}, | |
"values": { | |
"keys": { "googleMaps": "" }, | |
"brand": { | |
"name": "<<brand name here>>", | |
"title": "<<brand name here>> | Acoustic Workbench" | |
}, | |
"content": { | |
"research": { | |
"header_title": "Custom Menu", | |
"items": [ | |
{ | |
"innerText": "Example", | |
"url": "http://www.EXAMPLE.org/awebpage" | |
} | |
] | |
} | |
} | |
} | |
}' > ./buildConfig/environmentSettings.json | |
- name: Read environment | |
run: cat buildConfig/environmentSettings.json | |
- name: Install project dependencies | |
run: npm install | |
- name: Build | |
run: npm run build -- --production | |
- name: Publish build files | |
uses: actions/upload-artifact@v4 | |
with: | |
path: bin/ | |
name: baw-client | |
test: | |
name: Unit Tests (${{ matrix.os }} ${{ matrix.browsers }}) | |
needs: baw-client | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macOS-latest | |
browsers: | |
- ChromeHeadless | |
- FirefoxHeadless | |
steps: | |
- name: Checkout Workbench Client | |
uses: actions/checkout@v4 | |
# macos latest points to the arm MacOS runner that doesn't come with | |
# Firefox installed. Therefore, we install Firefox manually | |
- name: Install Firefox | |
if: matrix.os == 'macOS-latest' | |
run: brew install --cask firefox | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "npm" | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: baw-client | |
- name: Copy baw-client to assets | |
run: mkdir src/assets/old-client && cp -r baw-client/baw-client/* src/assets/old-client | |
- name: Install project dependencies | |
run: npm ci --force | |
- name: Run test suite on ${{ matrix.browsers }} | |
run: npm run test:pipeline -- --browsers ${{ matrix.browsers }} | |
- name: Upload Unit Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Unit Test Results (OS ${{ matrix.os }} ${{ matrix.browsers }}) | |
path: TESTS-*.xml | |
- name: Lint project | |
run: npm run lint | |
# e2e: | |
# name: E2E Tests | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: Install Node.js | |
# uses: actions/setup-node@v1 | |
# with: | |
# node-version: 12.x | |
# - name: NPM install | |
# run: npm ci | |
# # Webdriver downloads the latest driver version by default. If the version does not match the version of chrome | |
# # installed, it will crash during e2e tests. Best solution appears to be to download the version of the webdriver | |
# # which matches the CIs google chrome | |
# # https://github.com/angular/protractor/issues/5460 | |
# - name: Ensure webdriver installs correct adapter for current chrome version | |
# run: npm run webdriver -- update --versions.chrome=$(google-chrome --version | cut -d ' ' -f 3) | |
# - name: Run e2e test suite | |
# run: npm run e2e -- --webdriver-update=false | |
ssr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Workbench Client | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Checkout LFS objects | |
run: git lfs checkout | |
- name: Build container | |
run: docker build -t qutecoacoustics/workbench-client . --build-arg GIT_COMMIT="a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0" --build-arg WORKBENCH_CLIENT_VERSION="70.1.1+test.a0a0a0a0" | |
- name: Run docker container | |
run: docker run -d -p 4000:4000 -v "$(pwd)/src/assets/environment.json:/environment.json" qutecoacoustics/workbench-client | |
- name: Run SSR tests | |
shell: pwsh | |
run: ./scripts/ssr-tests.ps1 | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Workbench Client | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Checkout LFS objects | |
run: git lfs checkout | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "npm" | |
- name: Install project dependencies | |
run: npm ci --force | |
- name: Build the workbench client | |
run: npm run build | |
- name: Publish build files | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ./dist/workbench-client/ | |
name: workbench-client | |
results: | |
name: "Publish Unit Tests Results" | |
runs-on: ubuntu-latest | |
needs: [test] | |
if: > | |
github.actor != 'dependabot[bot]' && | |
github.actor != 'kodiakhq[bot]' && | |
github.event_name == 'pull_request' | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
files: artifacts/**/TESTS-*.xml | |
test_changes_limit: 0 | |
deduplicate_classes_by_file_name: true | |
publish: | |
name: "Publish Docker Container" | |
needs: [test, ssr, build] | |
if: > | |
github.actor != 'dependabot[bot]' && | |
github.actor != 'kodiakhq[bot]' && | |
(github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tag')) | |
uses: ./.github/workflows/publish.yml | |
with: | |
release_tag: 'beta' | |
secrets: inherit |