Skip to content

Commit 6e6094c

Browse files
committed
✨ feat: add GitHub Actions workflows for testing and publishing
1 parent 5a9e122 commit 6e6094c

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed

.github/workflows/publish.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
name: Build and Publish Extension
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Lint code
28+
run: npm run lint
29+
30+
- name: Check types
31+
run: npm run check-types
32+
33+
- name: Package Extension
34+
run: npm run package
35+
36+
- name: Install VSCE
37+
run: npm install -g @vscode/vsce
38+
39+
- name: Build VSIX
40+
run: vsce package
41+
42+
- name: Upload VSIX as Artifact
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: vscode-ddev-phpmd
46+
path: "*.vsix"
47+
48+
# Only run on tag push
49+
- name: Publish to VS Code Marketplace
50+
if: startsWith(github.ref, 'refs/tags/v')
51+
run: vsce publish -p ${{ secrets.VSCE_PAT }}
52+
env:
53+
VSCE_PAT: ${{ secrets.VSCE_PAT }}

.github/workflows/test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Extension Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
name: Test Extension
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest]
16+
runs-on: ${{ matrix.os }}
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20'
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Lint code
32+
run: npm run lint
33+
34+
- name: Check types
35+
run: npm run check-types
36+
37+
- name: Compile extension
38+
run: npm run compile-tests
39+
40+
- name: Run tests
41+
run: xvfb-run -a npm run test
42+
if: runner.os == 'Linux'
43+
44+
- name: Run tests (macOS)
45+
run: npm run test
46+
if: runner.os == 'macOS'

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.trunk/**
22
.vscode/**
33
.vscode-test/**
4+
.github/**
45
out/**
56
node_modules/**
67
src/**

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,28 @@ This extension contributes the following settings:
4444

4545
If you find a bug or want to contribute to the development of this extension, please visit our [GitHub repository](https://github.com/OpenForgeProject/vscode-ddev-phpmd).
4646

47+
### Development
48+
49+
This project uses GitHub Actions for continuous integration:
50+
51+
- **Extension Tests**: Automatically runs linting and tests on both Ubuntu and macOS environments
52+
- **Build and Publish**: Creates the VSIX package and publishes to the VS Code Marketplace on tag release
53+
54+
To run the tests locally:
55+
56+
```bash
57+
# Install dependencies
58+
npm install
59+
60+
# Lint and check types
61+
npm run lint
62+
npm run check-types
63+
64+
# Compile and run tests
65+
npm run compile-tests
66+
npm run test
67+
```
68+
4769
## License
4870

4971
This extension is licensed under the GNU General Public License v3.0 (GPL-3.0). See the [LICENSE](https://github.com/OpenForgeProject/vscode-ddev-phpmd/LICENSE) file for details.

0 commit comments

Comments
 (0)