Skip to content

Commit

Permalink
try a different approach (#58)
Browse files Browse the repository at this point in the history
make it work, ish
  • Loading branch information
TheHaff authored Feb 27, 2024
1 parent aec420d commit dc7b4ea
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 64 deletions.
45 changes: 1 addition & 44 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,11 @@ name: Pull Request

on:
push:
# trigger ci by creating a branch starting with ci-test/
branches: 'ci-test/*'
branches: ['ci-test/*']
pull_request:
branches: '*'

jobs:
check-changes:
runs-on: ubuntu-latest
name: Check Changed Files
outputs:
modules: ${{ steps.build-matrix.outputs.modules }}
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
files_yaml: |
auth:
- 'packages/auth/**'
common:
- 'packages/common/**'
event-producer:
- 'packages/event-producer/**'
player:
- 'packages/player/**'
player-web-components:
- 'packages/player-web-components/**'
template:
- 'packages/template/**'
true-time:
- 'packages/true-time/**'
# Optionally set `files_yaml_from_source_file` to read the YAML from a file. e.g `files_yaml_from_source_file: .github/changed-files.yml`

- name: Run step if test file(s) change
# NOTE: Ensure all outputs are prefixed by the same key used above e.g. `test_(...)` | `doc_(...)` | `src_(...)` when trying to access the `any_changed` output.
if: steps.changed-files.outputs.any_changed == 'true'
env:
TEST_ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "One or more test file(s) has changed."
echo "List all the files that have changed: $TEST_ALL_CHANGED_FILES"
trigger-lint:
name: Run Lint Checks
uses: ./.github/workflows/lint.yml
Expand All @@ -54,9 +15,5 @@ jobs:
name: Run Unit Tests
permissions:
pull-requests: write
needs: [ check-changes ]
if: needs.changed-files.outputs.all_changed_files == 'true'
with:
modules: ${{ needs.check-changes.outputs.modules }}
uses: ./.github/workflows/unit-test.yml
secrets: inherit
39 changes: 21 additions & 18 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
pull-requests: write
name: Run Unit Tests
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
Expand All @@ -32,17 +34,15 @@ jobs:
- 'packages/true-time/**'
# Optionally set `files_yaml_from_source_file` to read the YAML from a file. e.g `files_yaml_from_source_file: .github/changed-files.yml`

- name: Run step if test file(s) change
# NOTE: Ensure all outputs are prefixed by the same key used above e.g. `test_(...)` | `doc_(...)` | `src_(...)` when trying to access the `any_changed` output.
if: steps.changed-files.outputs.any_changed == 'true'
env:
TEST_ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "One or more test file(s) has changed."
echo "List all the files that have changed: $TEST_ALL_CHANGED_FILES"
- name: Run step if test file(s) change
# NOTE: Ensure all outputs are prefixed by the same key used above e.g. `test_(...)` | `doc_(...)` | `src_(...)` when trying to access the `any_changed` output.
if: steps.changed-files.outputs.any_changed == 'true'
env:
TEST_ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.any_changed_files }}
run: |
echo "One or more test file(s) has changed."
echo "List all the files that have changed: $TEST_ALL_CHANGED_FILES"
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Prepare test user for player tests
id: json
run: |
Expand All @@ -61,34 +61,37 @@ jobs:
env:
TEST_USER: ${{ steps.json.outputs.encoded }}
- name: Report Auth Coverage
if: ${{ ${input.modules}.changed-files.outputs.test_all_changed_files }}
if: steps.changed-files.outputs.auth_any_changed
uses: davelosert/vitest-coverage-report-action@v2
with:
name: 'Auth'
working-directory: 'packages/auth'
- name: Report Common Coverage
if: steps.changed-files.outputs.auth_any_changed == 'true'
if: steps.changed-files.outputs.common_any_changed
uses: davelosert/vitest-coverage-report-action@v2
with:
name: 'Common'
working-directory: 'packages/common'
- name: Report Event-Producer Coverage
if: ${{ needs.check-changes.outputs.modules != '' && toJson(fromJson(needs.check-changes.outputs.modules)) != '[]' }}
if: steps.changed-files.outputs.event-producer_any_changed
uses: davelosert/vitest-coverage-report-action@v2
with:
name: 'Event Producer'
json-summary-path: 'packages/event-producer/coverage/coverage-final.json'
json-final-path: 'packages/event-producer/coverage/coverage-summary.json'
working-directory: 'packages/event-producer'
vite-config-path: 'packages/event-producer/vite.config.ts'
- name: Report Player-Web-Components Coverage
if: ${{ needs.check-changes.outputs.modules != '' && toJson(fromJson(needs.check-changes.outputs.modules)) != '[]' }}
if: steps.changed-files.outputs.player-web-components_any_changed
uses: davelosert/vitest-coverage-report-action@v2
with:
name: 'Player Web Components'
working-directory: 'packages/player-web-components'
- name: Report Template Coverage
if: steps.changed-files.outputs.template_any_changed
uses: davelosert/vitest-coverage-report-action@v2
with:
name: 'Template'
working-directory: 'packages/template'
- name: Report True-Time Coverage
if: ${{ needs.check-changes.outputs.modules != '' && toJson(fromJson(needs.check-changes.outputs.modules)) != '[]' }}
if: steps.changed-files.outputs.true-time_any_changed
uses: davelosert/vitest-coverage-report-action@v2
with:
name: 'True Time'
Expand Down
7 changes: 5 additions & 2 deletions packages/event-producer/src/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ export const postMessage = (message: OutageStartError | TidalMessage) => {
globalThis.dispatchEvent(event);
};

// eslint-disable-next-line no-console
console.log('rizz buzz');
// @ts-expect-error this is for testing ci only
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const someLegacyCode = () => {
console.error('please delete me');
};

0 comments on commit dc7b4ea

Please sign in to comment.