-
-
Notifications
You must be signed in to change notification settings - Fork 115
104 lines (85 loc) · 2.79 KB
/
filecopymethod-test.yml
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
# Some platform-specific file copy syscalls (e.g. creating reflinks) are only
# supported on some platforms, and only with specific filesystems. These
# syscalls are used by different FileCopyMethod implementations.
#
# This workflow sets up the conditions needed for those syscalls to work,
# and then runs the tests with the different FileCopyMethods.
name: FileCopyMethod
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
jobs:
test-linux:
name: Test Linux
runs-on: ubuntu-latest
strategy:
matrix:
environment:
- filesystem: btrfs
filecopymethod: CopyBytes
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: go get -v -t -d ./...
- name: Build
run: go build -v .
- name: Set up filesystem
run: |-
mkdir -p ./test/filesystem
IMAGE_PATH="./test/filesystem/contents.img"
MOUNT_PATH="./test/filesystem/mounted"
truncate -s 500m "$IMAGE_PATH"
mkfs -t "${{matrix.environment.filesystem}}" "$IMAGE_PATH"
mkdir "$MOUNT_PATH"
sudo mount -o loop "$IMAGE_PATH" "$MOUNT_PATH"
sudo chown -R "$(id -u):$(id -g)" "$MOUNT_PATH"
- name: Copy files to mounted filesystem
run: |-
rsync -av --exclude=".*" --exclude "test/filesystem" . "test/filesystem/mounted"
- name: Test
working-directory: test/filesystem/mounted
run: go test -v
env:
TEST_FILECOPYMETHOD: ${{matrix.environment.filecopymethod}}
test-macos:
name: Test MacOS
runs-on: macos-latest
strategy:
matrix:
environment:
- filesystem: APFS
filecopymethod: CopyBytes
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: go get -v -t -d ./...
- name: Build
run: go build -v .
- name: Set up filesystem (MacOS)
run: |-
mkdir -p ./test/filesystem
IMAGE_PATH="./test/filesystem/contents.dmg"
MOUNT_PATH="./test/filesystem/mounted"
hdiutil create -size 500m -fs "${{matrix.environment.filesystem}}" "$IMAGE_PATH"
hdiutil attach -mountpoint "$MOUNT_PATH" "$IMAGE_PATH"
- name: Copy files to mounted filesystem
run: |-
rsync -av --exclude=".*" --exclude "test/filesystem" . "test/filesystem/mounted"
- name: Test
working-directory: test/filesystem/mounted
run: go test -v
env:
TEST_FILECOPYMETHOD: ${{matrix.environment.filecopymethod}}