Skip to content

Commit 7b0d31b

Browse files
committed
Add GitHub Actions
1 parent 0c21083 commit 7b0d31b

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed

.github/workflows/build.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build PerformanceProfiler Plugin
2+
on:
3+
push:
4+
branches:
5+
- "**/*"
6+
tags:
7+
- "v*"
8+
- "*@v*"
9+
# pull_request:
10+
# types: [opened, synchronize]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
env:
16+
NODE_ENV: production
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
persist-credentials: false
23+
24+
- name: Install libs
25+
run: sudo apt-get install --no-install-recommends -y libjson-perl libyaml-perl zip
26+
27+
- name: Build plugin
28+
run: |
29+
perl Makefile.PL
30+
make manifest
31+
make zipdist
32+
make dist
33+
34+
- name: Upload all plugins
35+
id: upload-all-plugins
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: plugin
39+
path: |
40+
PerformanceProfiler-*
41+
42+
- name: Upload tarball
43+
id: upload-tarball
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: tarball
47+
path: |
48+
PerformanceProfiler-*.tar.gz
49+
50+
- name: Add comment to PR
51+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
52+
if: ${{ github.event_name == 'pull_request' }}
53+
with:
54+
issue-number: ${{ github.event.pull_request.number }}
55+
body: |
56+
### Download Links
57+
58+
You can download the build artifacts from the following links:
59+
60+
- **All Plugins**: [Download from Actions Artifacts](${{ steps.upload-all-plugins.outputs.artifact-url }})
61+
- **Tarball**: [Download from Actions Artifacts](${{ steps.upload-tarball.outputs.artifact-url }})
62+
63+
- name: Upload package to GitHub Releases
64+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
65+
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8
66+
with:
67+
draft: true
68+
files: |
69+
PerformanceProfiler-*.zip
70+
PerformanceProfiler-*.tar.gz

.github/workflows/test.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Test
2+
on:
3+
push:
4+
branches:
5+
- "**/*"
6+
tags:
7+
- "v*"
8+
- "*@v*"
9+
# pull_request:
10+
# types: [opened, synchronize]
11+
12+
jobs:
13+
perl:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
config:
18+
- { image: cloud7 }
19+
- { image: buster }
20+
- { image: bullseye }
21+
- { image: fedora35 }
22+
- { image: fedora37 }
23+
- { image: fedora40 }
24+
- { image: fedora41 }
25+
- { image: fedora42 }
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
persist-credentials: false
30+
- uses: actions/checkout@v4
31+
with:
32+
persist-credentials: false
33+
repository: movabletype/movabletype
34+
ref: develop
35+
path: mt
36+
- uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
- name: Run tests
42+
run: |
43+
docker run --rm \
44+
-v ${{ github.workspace }}/mt:/app \
45+
-v ${{ github.workspace }}/plugins/PerformanceProfiler:/app/plugins/PerformanceProfiler \
46+
-w /app \
47+
-e MT_TEST_ENV_ADMIN_THEME_ID=${{ matrix.admin_theme_id }} \
48+
ghcr.io/movabletype/movabletype/test:${{ matrix.config.image }} \
49+
prove -j4 -PMySQLPool=MT::Test::Env -It/lib \
50+
plugins/PerformanceProfiler/t

0 commit comments

Comments
 (0)