diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 539074f44..0886729e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,43 +13,14 @@ concurrency: jobs: test: - runs-on: ${{ matrix.os }} + name: ${{ matrix.version }} strategy: - matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] - version: [ min, 1.84.2, max ] fail-fast: false - - env: - CODE_VERSION: ${{ matrix.version }} - TEST_RESOURCES: test-resources - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 18.15.x - cache: npm - - - name: Run Tests (macOS, windows) - if: matrix.os != 'ubuntu-latest' - run: | - npm run test - - - name: Run Tests (linux) - if: matrix.os == 'ubuntu-latest' - run: | - xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run test - - - name: Upload Screenshots - uses: actions/upload-artifact@v4 - if: failure() - with: - name: screenshots-${{ matrix.os }}-${{ matrix.version }} - path: ${{ github.workspace }}/test/**/screenshots/*.png + matrix: + version: [ min, 1.84.2, max ] + uses: ./.github/workflows/template-main.yaml + with: + version: ${{ matrix.version }} check: if: always() diff --git a/.github/workflows/template-main.yaml b/.github/workflows/template-main.yaml new file mode 100644 index 000000000..c643c80c5 --- /dev/null +++ b/.github/workflows/template-main.yaml @@ -0,0 +1,48 @@ +name: Main CI - template + +on: + workflow_call: + inputs: + version: + required: true + type: string + +jobs: + test: + name: ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + fail-fast: false + + env: + CODE_VERSION: ${{ inputs.version }} + TEST_RESOURCES: test-resources + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 18.15.x + cache: npm + + - name: Run Tests (macOS, windows) + if: matrix.os != 'ubuntu-latest' + run: | + npm test + + - name: Run Tests (linux) + if: matrix.os == 'ubuntu-latest' + run: | + xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm test + + - name: Upload Screenshots + uses: actions/upload-artifact@v4 + if: failure() + with: + name: screenshots-${{ matrix.os }}-${{ inputs.version }} + path: ${{ github.workspace }}/test/**/screenshots/*.png