Merge pull request #872 from koizuka/send-navigation-breadcrumb-to-se… #34
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: Test | |
on: | |
push: | |
branches: | |
- n-air_development | |
pull_request: | |
jobs: | |
changes: | |
runs-on: windows-2019 | |
permissions: | |
contents: read | |
pull-requests: read | |
outputs: | |
app: ${{ steps.filter.outputs.common == 'true' || steps.filter.outputs.app == 'true' }} | |
bin: ${{ steps.filter.outputs.common == 'true' || steps.filter.outputs.bin == 'true' }} | |
steps: | |
- name: Checkout if push | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'push' }} | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
common: | |
- 'package.json' | |
- 'yarn.lock' | |
- '.github/workflows/test.yml' | |
app: | |
- 'installer.nsh' | |
- 'tsconfig.json' | |
- 'webpack.config.js' | |
- 'main.js' | |
- 'test-main.js' | |
- 'app/**' | |
- 'media/**' | |
- 'nvoice/**' | |
- 'obs-api/**' | |
- 'test/**' | |
- 'updater/**' | |
- 'vendor/**' | |
- 'jest.config.js' | |
bin: | |
- 'bin/package.json' | |
- 'bin/yarn.lock' | |
- 'bin/**/*.js' | |
- 'jest.bin-config.js' | |
setup-app: | |
name: setup(app) | |
needs: changes | |
if: ${{ needs.changes.outputs.app == 'true' || needs.changes.outputs.bin == 'true' }} | |
runs-on: windows-2019 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: cache node modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock', 'scripts/preinstall.js', 'scripts/install-native-deps.js', 'scripts/repositories.json') }} | |
- name: npm login | |
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> $env:USERPROFILE\.npmrc | |
- name: Install dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile --check-files | |
setup-bin: | |
name: setup(bin) | |
needs: changes | |
if: ${{ needs.changes.outputs.bin == 'true' }} | |
runs-on: windows-2019 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: cache node modules(bin) | |
id: cache-node-modules-bin | |
uses: actions/cache@v4 | |
with: | |
path: bin/node_modules | |
key: ${{ runner.os }}-node-bin-${{ hashFiles('bin/yarn.lock') }} | |
- name: Install dependencies | |
if: steps.cache-node-modules-bin.outputs.cache-hit != 'true' | |
run: yarn install --cwd=bin --frozen-lockfile --check-files | |
unit_test-app: | |
name: unit tests(app) | |
needs: [changes, setup-app] | |
if: ${{ needs.changes.outputs.app == 'true' }} | |
runs-on: windows-2019 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: cache node modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock', 'scripts/preinstall.js', 'scripts/install-native-deps.js', 'scripts/repositories.json') }} | |
- name: Run unit tests(app) | |
run: yarn test:unit:app | |
unit_test-bin: | |
name: unit tests(bin) | |
needs: [changes, setup-app, setup-bin] | |
if: ${{ needs.changes.outputs.bin == 'true' }} | |
runs-on: windows-2019 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: cache node modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock', 'scripts/preinstall.js', 'scripts/install-native-deps.js', 'scripts/repositories.json') }} | |
- name: cache node modules(bin) | |
id: cache-node-modules-bin | |
uses: actions/cache@v4 | |
with: | |
path: bin/node_modules | |
key: ${{ runner.os }}-node-bin-${{ hashFiles('bin/yarn.lock') }} | |
- name: Run unit tests(bin) | |
run: yarn test:unit:bin | |
e2e_test: | |
name: e2e tests | |
needs: [changes, setup-app] | |
runs-on: windows-2019 | |
strategy: | |
matrix: | |
directory: | |
- 'e2e/[^s]*.js' | |
- 'e2e/s*.js' | |
- 'api/[^s]*.js' | |
- 'api/s*.js' | |
steps: | |
- name: Checkout code | |
if: ${{ needs.changes.outputs.app == 'true' }} | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
if: ${{ needs.changes.outputs.app == 'true' }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: cache node modules | |
if: ${{ needs.changes.outputs.app == 'true' }} | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock', 'scripts/preinstall.js', 'scripts/install-native-deps.js', 'scripts/repositories.json') }} | |
- name: Compile | |
if: ${{ needs.changes.outputs.app == 'true' }} | |
run: yarn compile:ci | |
- name: Run e2e tests | |
if: ${{ needs.changes.outputs.app == 'true' }} | |
run: yarn test --fail-fast test-dist/test/${{ matrix.directory }} | |
test-summary: | |
# 注意: needs に setupも入れないと、setupで失敗すると後段のresultが `skipped` になってしまい、すりぬけてしまう | |
needs: [setup-app, setup-bin, unit_test-app, unit_test-bin, e2e_test] | |
if: always() | |
steps: | |
- name: test-summary | |
run: | | |
echo '${{ toJson(needs) }}' | |
RESULT=${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} | |
echo RESULT=$RESULT | |
if [[ $RESULT == true ]]; then | |
echo "All tests passed" | |
else | |
echo "Some tests failed" | |
exit 1 | |
fi | |
runs-on: ubuntu-latest |