150 lines (128 loc) · 3.89 KB
/
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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
test-upload:
runs-on: ${{ matrix.os }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
strategy:
fail-fast: false
matrix:
os:
- macos-13
- macos-14
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- name: Create artifacts
shell: bash
run: |
ls -l > artifact-${{ matrix.os }}.txt
mkdir artifacts
cp artifact-${{ matrix.os }}.txt artifacts/
- name: artifact-mover upload single file
uses: ./
with:
action: upload
bucket: ${{ secrets.TEST_BUCKET }}
name: test-artifact-single-file
path: ./artifact-${{ matrix.os }}.txt
- name: artifact-mover upload directory
uses: ./
with:
action: upload
bucket: ${{ secrets.TEST_BUCKET }}
name: test-artifact-directory
path: artifacts
# Test makes sure it downloads all the artifacts generated across the matrix
# with the same artifact name; same behavior as upload-artifact action
test-download:
needs: [test-upload]
runs-on: ${{ matrix.os }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
strategy:
fail-fast: false
matrix:
os:
- macos-13
- macos-14
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- name: artifact-mover download single file
uses: ./
with:
action: download
bucket: ${{ secrets.TEST_BUCKET }}
name: test-artifact-single-file
path: ./
- name: Test single file downloaded
if: runner.os == 'Linux'
run: |
tree -L 2
files=("macos-13" "macos-14" "ubuntu-latest" "windows-latest")
for file in "${files[@]}"; do
if [ -f "artifact-$file.txt" ]; then
echo "File $file exists"
else
echo "Expected ./artifact-$file.txt not found"
exit 1
fi
if test -f artifacts/artifact-$file.txt; then
echo "Directory file found before it was downloaded"
exit 1
else
echo "Directory file not found, as expected."
fi
done
- name: artifact-mover download directory
uses: ./
with:
action: download
bucket: ${{ secrets.TEST_BUCKET }}
name: test-artifact-directory
path: artifacts
- name: Test directory downloaded
if: runner.os == 'Linux'
run: |
tree -L 2
files=("macos-13" "macos-14" "ubuntu-latest" "windows-latest")
for file in "${files[@]}"; do
if [ -f "artifact-$file.txt" ]; then
echo "File artifact-$file.txt exists"
else
echo "Expected ./artifact-$file.txt not found"
exit 1
fi
if test -f artifacts/artifact-$file.txt; then
echo "Directory file found"
else
echo "Directory file not found"
exit 1
fi
done
- name: Install tree (MacOS)
if: runner.os == 'macOS'
run: brew install tree
- name: Install tree (Windows)
if: runner.os == 'Windows'
run: choco install tree
- name: List artifacts
shell: bash
run: |
tree -L 2