Skip to content

Commit d371061

Browse files
mr-czaidoon1
authored andcommitted
ci: make most directories read-only before running the tests
1 parent bad48d8 commit d371061

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/rust.yml

+27
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,41 @@ jobs:
106106
if: runner.os == 'Windows'
107107
run: choco install llvm -y
108108

109+
- name: Mark working directory as read-only
110+
# to ensure that the tests always use a temporary directory
111+
if: runner.os == 'Linux'
112+
run: |
113+
mkdir -p target
114+
touch Cargo.lock
115+
git submodule update --init --recursive
116+
chmod -R a-w .
117+
chmod -R a+w target Cargo.lock
118+
109119
- name: Run rocksdb tests
110120
run: |
111121
cargo test --all
112122
cargo test --all --features multi-threaded-cf
113123
124+
- name: Mark working directory as writable
125+
if: runner.os == 'Linux'
126+
run: chmod -R a+w .
127+
114128
- name: Free disk space
115129
run: cargo clean
116130

131+
- name: Mark working directory as read-only
132+
# to ensure that the tests always use a temporary directory
133+
if: runner.os == 'Linux'
134+
run: |
135+
mkdir -p target
136+
touch Cargo.lock
137+
chmod -R a-w .
138+
chmod -R a+w target Cargo.lock
139+
117140
- name: Run rocksdb tests (jemalloc)
118141
if: runner.os != 'Windows'
119142
run: cargo test --all --features jemalloc
143+
144+
- name: Mark working directory as writable
145+
if: runner.os == 'Linux'
146+
run: chmod -R a+w .

0 commit comments

Comments
 (0)