-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (120 loc) · 5.25 KB
/
test-upload.yaml
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
on:
push: {}
workflow_dispatch:
inputs:
environment:
type: environment
default: production
name: test-upload
jobs:
test-upload-multiple-files:
runs-on: ubuntu-latest
environment: ${{ inputs.environment || 'production' }}
name: A job that pushes a lot of files on artifacts
steps:
- uses: actions/checkout@v3
- name: create multiple files
run: mkdir -p test-files && for i in {1..2000}; do dd if=/dev/random of=test-files/$i.txt count=1 bs=1M; done
- name: Push all files
uses: ./
with:
url: ${{ vars.ARTIFACTS_URL }}
user: ${{ secrets.ARTIFACTS_USER }}
password: ${{ secrets.ARTIFACTS_PASSWORD }}
source: ./test-files
method: upload
test-upload-multiple-files-container:
runs-on: ubuntu-latest
environment: ${{ inputs.environment || 'production' }}
container: ubuntu
name: Upload multiple files inside from a container job
steps:
- uses: actions/checkout@v3
- name: create multiple files
run: mkdir -p test-files && for i in {1..2000}; do dd if=/dev/random of=test-files/$i.txt count=1 bs=1M; done
shell: bash
- name: Push all files
uses: ./
with:
url: ${{ vars.ARTIFACTS_URL }}
user: ${{ secrets.ARTIFACTS_USER }}
password: ${{ secrets.ARTIFACTS_PASSWORD }}
source: ./test-files
method: upload
test-upload-big-file:
runs-on: ubuntu-latest
environment: ${{ inputs.environment || 'production' }}
name: A job that push a big file on artifacts
steps:
- uses: actions/checkout@v3
- name: create one big file
run: dd if=/dev/random of=big_file.txt count=1024 bs=1M
- name: Push on big file
id: artifacts-upload
uses: ./
with:
url: ${{ vars.ARTIFACTS_URL }}
user: ${{ secrets.ARTIFACTS_USER }}
password: ${{ secrets.ARTIFACTS_PASSWORD }}
source: ./big_file.txt
method: upload
- name: Download file
run: curl -u ${{ secrets.ARTIFACTS_USER }}:${{ secrets.ARTIFACTS_PASSWORD }} --silent --fail --show-error --max-time 3600 ${{ steps.artifacts-upload.outputs.link }}/big_file.txt > upload_big_file.txt
- name: Compare files
run: cmp --silent upload_big_file.txt ./big_file.txt
push-artifacts-action:
runs-on: ubuntu-latest
environment: ${{ inputs.environment || 'production' }}
name: A job that push single files on artifacts
needs: [test-upload-big-file, test-upload-multiple-files]
steps:
- uses: actions/checkout@v3
- id: artifacts-upload
uses: ./
with:
url: ${{ vars.ARTIFACTS_URL }}
user: ${{ secrets.ARTIFACTS_USER }}
password: ${{ secrets.ARTIFACTS_PASSWORD }}
source: action.yaml
method: upload
- uses: ./
with:
method: upload
url: ${{ vars.ARTIFACTS_URL }}
user: ${{ secrets.ARTIFACTS_USER }}
password: ${{ secrets.ARTIFACTS_PASSWORD }}
source: README.md
- name: Download file
run: curl -u ${{ secrets.ARTIFACTS_USER }}:${{ secrets.ARTIFACTS_PASSWORD }} --silent --fail --show-error --max-time 3600 ${{ steps.artifacts-upload.outputs.link }}/README.md > upload_README.md
- name: Compare files
run: cmp --silent upload_README.md ./README.md
- name: Download file with artifacts-link
run: curl -u ${{ secrets.ARTIFACTS_USER }}:${{ secrets.ARTIFACTS_PASSWORD }} --silent --fail --show-error --max-time 3600 ${{ steps.artifacts-upload.outputs.link }}/action.yaml > upload_action.yaml
- name: Download file with redirect-link
run: curl -u ${{ secrets.ARTIFACTS_USER }}:${{ secrets.ARTIFACTS_PASSWORD }} -L --silent --fail --show-error --max-time 3600 ${{ steps.artifacts-upload.outputs.redirect-link }}/action.yaml > redirect-link.yaml
- name: Download with artifacts-url and artifacts-name
run: curl -u ${{ secrets.ARTIFACTS_USER }}:${{ secrets.ARTIFACTS_PASSWORD }} --silent --fail --show-error --max-time 3600 ${{ vars.ARTIFACTS_URL }}/builds/${{ steps.artifacts-upload.outputs.name }}/action.yaml > name_action.yaml
- run: NUMBER_OF_FILES=$(curl -u ${{ secrets.ARTIFACTS_USER }}:${{ secrets.ARTIFACTS_PASSWORD }} --silent --fail --show-error --max-time 3600 ${{ vars.ARTIFACTS_URL }}/download/${{ steps.artifacts-upload.outputs.name }}/?format=text)
- name: Verify number of files
run: $([[ $NUMBER_OF_FILES -le 103 ]])
- name: Compare files
run: cmp --silent upload_action.yaml ./name_action.yaml
- name: Compare files2
run: cmp --silent upload_action.yaml ./action.yaml
- name: Compare redirect link downloaded file
run: cmp --silent redirect-link.yaml action.yaml
test-empty-folder:
runs-on: ubuntu-latest
environment: ${{ inputs.environment || 'production' }}
name: A job that try to push an empty folder
steps:
- uses: actions/checkout@v3
- run: mkdir -p artifacts
- name: Push all files
uses: ./
with:
url: ${{ vars.ARTIFACTS_URL }}
user: ${{ secrets.ARTIFACTS_USER }}
password: ${{ secrets.ARTIFACTS_PASSWORD }}
source: ./artifacts
method: upload