Skip to content

Commit

Permalink
issue-1116: Improve Main CI to use reusable workflow strategy (#1115)
Browse files Browse the repository at this point in the history
  • Loading branch information
djelinek authored Feb 7, 2024
1 parent 1292f64 commit 10dff75
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 35 deletions.
41 changes: 6 additions & 35 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/template-main.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 10dff75

Please sign in to comment.