meteor / meteor

Meteor, the JavaScript App Platform
https://meteor.com
Other
44.37k stars 5.19k forks source link

What is the recommended way to run package tests on GitHub Actions with Meteor 3? #13412

Open filipenevola opened 5 days ago

filipenevola commented 5 days ago

Hey, any example of running meteor test-packages ./ with Meteor 3 on GitHub Actions?

I've tried a few things, but they fail for different reasons.

If you guys have a good example, please post it here.


One test that I want to run is this: https://github.com/quavedev/meteor-packages/blob/main/collections/collections-tests.js

Locally it's running fine but when I'm using mochadriver with --once it doesn't detect any tests. With test-in-console sometimes I get Fiber errors.


Thanks!

leonardoventurini commented 5 days ago

Wait, those tests are not using mocha but tinytest, have you run it elsewhere?

I tried running mocha tests locally and it works with --once:

meteor test-packages ./ --driver-package meteortesting:mocha --once

image

This is my package.js:

image

I will write a Github Action later for this package and share here if it works well

filipenevola commented 5 days ago

I want to run tests with TinyTest on a GitHub action.

Like I do locally but without loading the browser, just using Puppeteer or something.

I want to have a simple setup to do that in all our packages like we do locally with meteor test-packages.

I didn't find any example. I could write in different ways but for most cases I find TinyTest the fastest to write (most of it I'm not writing, it's just Cursor, I'm just explaining what I want to test for Cursor).

leonardoventurini commented 3 days ago

I wrote this workflow today for mocha... should be easy to adjust, please let me know if it works for you, if it still doesn't detect the tests I can log a task to check it.

name: Test Meteor Perf Package

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest

    env:
      METEOR_VERSION: 3.0.4

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Set up Node.js
        uses: actions/setup-node@v2
        with:
          node-version: 20

      - name: Cache Meteor Installation
        id: meteor-cache
        uses: actions/cache@v3
        with:
          path: ~/.meteor
          key: ${{ runner.os }}-meteor-${{ env.METEOR_VERSION }}
          restore-keys: |
            ${{ runner.os }}-meteor-
      - name: Install Meteor (if not cached)
        if: steps.meteor-cache.outputs.cache-hit != 'true'
        run: |
          npx meteor@${{ env.METEOR_VERSION }}
      - name: Export Path
        run: |
          echo "$HOME/.meteor" >> $GITHUB_PATH
      - name: Run Tests
        run: |
          TEST_CLIENT=0 meteor test-packages ./ --driver-package meteortesting:mocha --no-release-check --once