diff --git a/.github/workflows/ci:test.yml b/.github/workflows/ci:test.yml index c00d7103c..9785556fb 100644 --- a/.github/workflows/ci:test.yml +++ b/.github/workflows/ci:test.yml @@ -14,123 +14,64 @@ concurrency: jobs: test: - name: Continuous integration (tests) - runs-on: ubuntu-latest - timeout-minutes: 20 - steps: - - name: Checkout 🛎ī¸ - uses: actions/checkout@v4 - - - name: Cache ~/.cache/puppeteer 🎭 - uses: actions/cache@v4 - id: cache-puppeteer - env: - cache-name: cache-puppeteer - with: - path: ~/.cache/puppeteer - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - - - name: Install 💾 - uses: ./.github/actions/install - - - name: Cache build đŸ’Ŋ - uses: meteor-actions/cache-build@v4 - with: - key: test - - - name: Tests đŸ”Ŧ - run: meteor npm run ci:test - - - name: Archive coverage data đŸ’Ŋ - uses: actions/upload-artifact@v4 - with: - name: test-coverage - path: .coverage - retention-days: 1 - - test-coverage-upload: - name: Continuous integration (upload tests coverage) - - needs: - - test - - runs-on: ubuntu-latest - - timeout-minutes: 1 - - steps: - - name: Load coverage data đŸ’Ŋ - uses: actions/download-artifact@v4 - with: - name: test-coverage - path: .coverage - - - name: Publish coverage report 📰 - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - flags: test - directory: ./.coverage/ - fail_ci_if_error: true - - test-app: - name: Continuous integration (app tests) - runs-on: ubuntu-latest - timeout-minutes: 20 - steps: - - name: Checkout 🛎ī¸ - uses: actions/checkout@v4 - - - name: Cache ~/.cache/puppeteer 🎭 - uses: actions/cache@v4 - id: cache-puppeteer - env: - cache-name: cache-puppeteer - with: - path: ~/.cache/puppeteer - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - - - name: Install 💾 - uses: ./.github/actions/install - - - name: Cache build đŸ’Ŋ - uses: meteor-actions/cache-build@v4 - with: - key: test-app - - - name: App Tests 🕹ī¸ - run: meteor npm run ci:test -- --full-app - - - name: Archive coverage data đŸ’Ŋ - uses: actions/upload-artifact@v4 - with: - name: test-app-coverage - path: .coverage - retention-days: 1 - - test-app-coverage-upload: - name: Continuous integration (upload app tests coverage) - - needs: - - test-app - - runs-on: ubuntu-latest - - timeout-minutes: 1 - - steps: - - name: Load coverage data đŸ’Ŋ - uses: actions/download-artifact@v4 - with: - name: test-app-coverage - path: .coverage - - - name: Publish coverage report 📰 - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - flags: test-app - directory: ./.coverage/ - fail_ci_if_error: true + name: Continuous integration + strategy: + + matrix: + + test-type: + - test + - test-app + + test-target: + - client + - server + + include: + + - test-target: client + test-env: 'TEST_SERVER=0' + + - test-target: server + test-env: 'TEST_CLIENT=0' + + - test-type: test + test-flags: '--' + + - test-type: test-app + test-flags: '-- --full-app' + + - test-target: client + test-type: test + test-timeout: 20 + test-icon: 🕹ī¸ + coverage-flags: client,test + + - test-target: client + test-type: test-app + test-timeout: 20 + test-icon: 🧑‍đŸ’ģ + coverage-flags: client, test-app + + - test-target: server + test-type: test + test-timeout: 20 + test-icon: đŸ”Ŧ + coverage-flags: server,test + + - test-target: server + test-type: test-app + test-timeout: 20 + test-icon: 🤖 + coverage-flags: server, test-app + + uses: ./.github/workflows/test.yml + secrets: inherit + with: + test-target: ${{ matrix.test-target }} + test-type: ${{ matrix.test-type }} + test-icon: ${{ matrix.test-icon }} + test-env: ${{ matrix.test-env }} + test-flags: ${{ matrix.test-flags }} + test-timeout: ${{ matrix.test-timeout }} + coverage-flags: ${{ matrix.coverage-flags }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..ab0189911 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,87 @@ +name: test + +on: + workflow_call: + inputs: + test-target: + type: string + required: true + test-type: + type: string + required: true + test-icon: + type: string + required: true + test-env: + type: string + required: true + test-flags: + type: string + required: true + test-timeout: + type: number + required: true + coverage-flags: + type: string + required: true + +jobs: + + test: + runs-on: ubuntu-latest + timeout-minutes: ${{ inputs.test-timeout }} + + steps: + - name: Checkout 🛎ī¸ + uses: actions/checkout@v4 + + - name: Cache ~/.cache/puppeteer 🎭 + uses: actions/cache@v4 + id: cache-puppeteer + env: + cache-name: cache-puppeteer + with: + path: ~/.cache/puppeteer + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + + - name: Install 💾 + uses: ./.github/actions/install + + - name: Cache build đŸ’Ŋ + uses: meteor-actions/cache-build@v4 + with: + key: ${{ inputs.test-target }}-${{ inputs.test-type }} + + - name: Tests ${{ inputs.test-icon }} + run: ${{ inputs.test-env }} meteor npm run ci:test ${{ inputs.test-flags }} + + - name: Archive coverage data đŸ’Ŋ + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.test-target }}-${{ inputs.test-type }}-coverage + path: .coverage + retention-days: 1 + + test-coverage-upload: + needs: + - test + + runs-on: ubuntu-latest + + timeout-minutes: 1 + + steps: + - name: Load coverage data đŸ’Ŋ + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.test-target }}-${{ inputs.test-type }}-coverage + path: .coverage + + - name: Publish coverage report 📰 + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + flags: ${{ inputs.coverage-flags }} + directory: ./.coverage/ + fail_ci_if_error: true