Skip to content

Commit 56b2790

Browse files
authored
Allow modules to be loaded during startup (#9)
Load a custom module(s) during test setup.
1 parent d41781d commit 56b2790

5 files changed

Lines changed: 43 additions & 6 deletions

File tree

.github/workflows/test.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,27 @@ jobs:
2121
with:
2222
uploadLogs: true
2323
httpPort: 8008
24-
24+
25+
test-modules:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- uses: actions/setup-python@v2
30+
with:
31+
python-version: "3.x"
32+
- name: Run synapse
33+
uses: ./
34+
with:
35+
uploadLogs: true
36+
httpPort: 8008
37+
customModules: "git+https://github.com/michaelkaye/noop-synapse-storage-provider.git#egg=noop-synapse-storage-provider"
38+
customConfig: |
39+
media_storage_providers:
40+
- module: noop_storage_provider.NoopStorageProviderBackend
41+
store_local: True
42+
store_remote: True
43+
store_synchronous: True
44+
config:
45+
sample: "sample"
46+
- name: Wait for synapse to do something
47+
run: sleep 60

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ inputs:
1313
description: 'JSON-formatted custom config for synapse'
1414
required: false
1515
default: '{}'
16+
customModules:
17+
description: 'Comma-separated list of modules to pip install.'
18+
required: false
19+
default: ''
1620
httpPort:
1721
description: 'HTTP port for C-S and S-S APIs'
1822
required: false

create.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ async function run() {
1818
await exec.exec("env/bin/pip", ["install", "-q", "--upgrade", "pip"]);
1919
await exec.exec("env/bin/pip", ["install", "-q", "--upgrade", "setuptools"]);
2020
await exec.exec("env/bin/pip", ["install", "-q", "matrix-synapse"]);
21-
22-
21+
const customModules = core.getInput("customModules")
22+
if (customModules.length > 0) {
23+
const toLoad = customModules.split(',');
24+
for (let module of toLoad) {
25+
await exec.exec("env/bin/pip", ["install", "-q", module]);
26+
}
27+
}
2328
// homeserver.yaml is the default server config from synapse
2429

2530
core.info("Generating config...");

dist/create/index.js

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/create/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)