@@ -16,14 +16,28 @@ inputs:
16
16
runs :
17
17
using : composite
18
18
steps :
19
+ - name : Checkout main
20
+ id : checkout_release
21
+ uses : actions/checkout@v2
22
+ with :
23
+ path : ' __build'
24
+ ref : ' main'
25
+
19
26
- name : Build image
20
27
id : build_image
21
28
shell : bash
22
29
run : |
23
30
set -e
24
31
25
- # Run test build
32
+ # Symlink build scripts from main to improve security when testing PRs
33
+ cd "$GITHUB_WORKSPACE/__build"
26
34
yarn install
35
+ rm -rf build node_modules
36
+ ln -s "$GITHUB_WORKSPACE/__build/build" build
37
+ ln -s "$GITHUB_WORKSPACE/__build/node_modules" node_modules
38
+ cd "$GITHUB_WORKSPACE"
39
+
40
+ # Run test build
27
41
GIT_BRANCH=$(echo "${{ github.ref }}" | grep -oP 'refs/(heads|tags)/\K(.+)')
28
42
if [ "$GIT_BRANCH" == "" ]; then
29
43
GIT_BRANCH=main
55
69
container_name="vscdc-test-container"
56
70
docker run -d --name ${container_name} --rm --init --privileged -v "$(pwd)/containers/${{ inputs.definition }}:/workspace" ${{ inputs.image }} /bin/sh -c 'while sleep 1000; do :; done'
57
71
72
+ # Update UID/GID for user in container - Actions uses different UID/GID than container
73
+ # which causes bind mounts to be read only and cause certain write tests to fail
74
+ # The dev container CLI handles this automatically but we're not using it.
75
+ local_uid=$(id -u)
76
+ local_gid=$(id -g)
77
+ docker exec -u root ${container_name} /bin/sh -c "\
78
+ echo \"(*) Update user UID/GID...\" \
79
+ && groupmod -g ${local_gid} ${{ inputs.user }} \
80
+ && usermod -u ${local_uid} -g ${local_gid} ${{ inputs.user }}"
81
+
58
82
# Fake out existence of extensions, VS Code Server
59
83
echo "(*) Stubbing out extensions and VS Code Server..."
60
84
dev_container_relative_path="containers/${{ inputs.definition }}/.devcontainer"
74
98
echo "(*) Running test..."
75
99
docker exec -u "${{ inputs.user }}" ${container_name} /bin/sh -c '\
76
100
set -e \
77
- && id \
78
- && echo "$HOME" \
79
101
&& cd /workspace \
80
102
&& if [ -f "test-project/test.sh" ]; then \
81
103
cd test-project \
0 commit comments