Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/_integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Integration Tests

on:
workflow_call:
inputs:
os:
required: true
type: string

permissions:
contents: read

jobs:
integration-tests:
name: Integration Tests (${{ inputs.os }})
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v7

- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: npm

- name: Install dependencies
run: npm ci

- name: Compile tests
run: npm run compile-tests

# VS Code integration tests need a display server on Linux
- name: Run extension tests (Linux)
if: inputs.os == 'ubuntu-latest'
uses: coactions/setup-xvfb@v1
with:
run: npm test

- name: Run extension tests (Windows/macOS)
if: inputs.os != 'ubuntu-latest'
run: npm test
28 changes: 10 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,10 @@ jobs:
- name: Package (production build)
run: npm run package

test:
name: Test (${{ matrix.os }})
unit-tests:
name: Unit Tests & Coverage
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7

Expand All @@ -65,16 +61,12 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Compile tests
run: npm run compile-tests
- name: Run unit tests with coverage
run: npm run test:unit:coverage

# VS Code integration tests need a display server on Linux
- name: Run extension tests (Linux)
if: runner.os == 'Linux'
uses: coactions/setup-xvfb@v1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: github.repository == 'OpenForgeProject/mageforge-vscode'
with:
run: npm test

- name: Run extension tests (Windows/macOS)
if: runner.os != 'Linux'
run: npm test
files: ./coverage/lcov.info
fail_ci_if_error: false
20 changes: 20 additions & 0 deletions .github/workflows/test-integration-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Integration Tests (macOS)

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
integration-tests:
uses: ./.github/workflows/_integration-tests.yml
with:
os: macos-latest
20 changes: 20 additions & 0 deletions .github/workflows/test-integration-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Integration Tests (Ubuntu)

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
integration-tests:
uses: ./.github/workflows/_integration-tests.yml
with:
os: ubuntu-latest
20 changes: 20 additions & 0 deletions .github/workflows/test-integration-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Integration Tests (Windows)

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
integration-tests:
uses: ./.github/workflows/_integration-tests.yml
with:
os: windows-latest
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ out/
# VS Code test binaries & cache
.vscode-test/

# Test coverage
coverage/

# Local tooling
.DS_Store
10 changes: 9 additions & 1 deletion .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { defineConfig } from '@vscode/test-cli';
import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';

const workspaceDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mageforge-vscode-test-'));
fs.mkdirSync(path.join(workspaceDir, 'app', 'etc'), { recursive: true });
fs.writeFileSync(path.join(workspaceDir, 'app', 'etc', 'env.php'), '<?php return [];');

export default defineConfig({
files: 'out/**/*.test.js',
files: 'out/test/extension.test.js',
version: '1.131.0',
workspaceFolder: workspaceDir,
});
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
![MageForge Hero](./.github/assets/MageForge-Header.png)

![CI](https://github.com/OpenForgeProject/mageforge-vscode/actions/workflows/ci.yml/badge.svg)
![Integration Tests (Ubuntu)](https://github.com/OpenForgeProject/mageforge-vscode/actions/workflows/test-integration-ubuntu.yml/badge.svg)
![Integration Tests (Windows)](https://github.com/OpenForgeProject/mageforge-vscode/actions/workflows/test-integration-windows.yml/badge.svg)
![Integration Tests (macOS)](https://github.com/OpenForgeProject/mageforge-vscode/actions/workflows/test-integration-macos.yml/badge.svg)
![Release Please](https://github.com/OpenForgeProject/mageforge-vscode/actions/workflows/release-please.yml/badge.svg)
[![Version](https://img.shields.io/visual-studio-marketplace/v/OpenForgeProject.mageforge)](https://marketplace.visualstudio.com/items?itemName=OpenForgeProject.mageforge)
[![License](https://img.shields.io/github/license/OpenForgeProject/mageforge-vscode)](./LICENSE)
[![Coverage](https://codecov.io/gh/OpenForgeProject/mageforge-vscode/branch/main/graph/badge.svg)](https://codecov.io/gh/OpenForgeProject/mageforge-vscode)

The official VS Code integration for [MageForge](https://github.com/OpenForgeProject/mageforge).

Expand Down
Loading
Loading