Repository navigation
133 lines (113 loc) · 4.59 KB
/
Copy pathdevcontainer.yml
File metadata and controls
133 lines (113 loc) · 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Devcontainer
on:
pull_request:
paths:
- '.devcontainer/**'
- '.github/workflows/devcontainer.yml'
- 'package.json'
- 'package-lock.json'
push:
branches:
- main
paths:
- '.devcontainer/**'
- '.github/workflows/devcontainer.yml'
- 'package.json'
- 'package-lock.json'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: devcontainer-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DEVCONTAINER_CLI_VERSION: 0.89.0
jobs:
contract:
name: Devcontainer contract
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Setup Bats-core
uses: bats-core/bats-action@3566550e0f594451ac0f58fcbfdeca93aa29a45e # 4.1.0
with:
support-install: false
assert-install: false
detik-install: false
file-install: false
- name: Check Dev Container configuration
run: |
jq empty .devcontainer/devcontainer.json
shellcheck .devcontainer/prepare.sh .devcontainer/setup.sh
sh -n .devcontainer/prepare.sh
bash -n .devcontainer/setup.sh
node --check .devcontainer/tests/playwright-smoke.cjs
node --check .devcontainer/tests/playwright-version.cjs
node .devcontainer/tests/playwright-version.cjs
! jq -e '
((.forwardPorts // [])[]? | strings | contains(":")) or
((.portsAttributes // {} | keys[]) | contains(":"))
' .devcontainer/devcontainer.json
- name: Test devcontainer shell contracts
run: |
bats --print-output-on-failure .devcontainer/tests/prepare.bats
bats --print-output-on-failure .devcontainer/tests/setup.bats
integration:
name: Devcontainer integration
needs: contract
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Install Dev Container CLI
run: npm install --global "@devcontainers/cli@${DEVCONTAINER_CLI_VERSION}"
- name: Start the Dev Container
run: devcontainer up --workspace-folder .
- name: Verify Nextcloud, LibreSign and Mailpit
run: |
devcontainer exec --workspace-folder . \
bash -lc "occ status | grep -q 'installed: true'"
devcontainer exec --workspace-folder . \
bash -lc "occ app:list --enabled | grep -q libresign"
devcontainer exec --workspace-folder . \
bash -lc "curl --fail --silent http://mailpit:8025/api/v1/info >/dev/null"
- name: Verify LibreSign setup is repeatable
run: |
devcontainer exec --workspace-folder . \
bash /var/www/html/apps-extra/libresign/.devcontainer/setup.sh \
| tee /tmp/libresign-setup.out
grep -q 'LibreSign environment ready' /tmp/libresign-setup.out
grep -q 'Nextcloud / LibreSign' /tmp/libresign-setup.out
grep -q 'Mailpit (environment)' /tmp/libresign-setup.out
grep -q 'Useful commands' /tmp/libresign-setup.out
- name: Verify Nextcloud through the NCDD proxy
run: |
nextcloud_host="$(docker compose \
--file .devcontainer/ncdd.generated.yml \
--file .devcontainer/docker-compose.yml \
config --format json | jq -r '.services.nextcloud.environment.NEXTCLOUD_HOST')"
curl --fail --insecure --retry 20 --retry-all-errors \
--resolve "${nextcloud_host}:443:127.0.0.1" \
"https://${nextcloud_host}/status.php" >/dev/null
- name: Verify Playwright browser against Nextcloud
run: |
docker compose \
--file .devcontainer/ncdd.generated.yml \
--file .devcontainer/docker-compose.yml \
--profile playwright \
run --rm --no-deps playwright \
node /var/www/html/apps-extra/libresign/.devcontainer/tests/playwright-smoke.cjs
- name: Collect container diagnostics
if: failure()
run: |
docker ps --all
docker logs --tail=200 "$(docker ps -aq --filter name=nextcloud | head -n1)" || true
docker logs --tail=200 "$(docker ps -aq --filter name=nginx | head -n1)" || true
docker logs --tail=200 librecode-dev-proxy || true