-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (118 loc) · 3.47 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
# Copyright (c) The stash contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Test Action
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
test-deps:
name: "check for dependencies"
runs-on: ubuntu-latest
container: quay.io/centos/centos:stream8
steps:
- uses: actions/checkout@v4
- name: Run action
continue-on-error: true
id: fail
uses: ./restore
with:
path: .github
key: this-must-fail
- name: It did not fail
if: ${{ steps.fail.outputs.stash-hit != '' }}
run: |
echo "::error ::Dependency check should have failed!"
exit 1
test-save:
name: "stash/save on ${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Run unittests
shell: bash
env:
GH_TOKEN: "${{ github.token }}"
run: |
cd restore
python3 test_get_stash.py
- name: Test Save
uses: ./save
with:
path: .github/
# Create a unique key to test intra workflow artifacts.
key: test/stash-${{ matrix.os }}-${{ github.sha }}
retention-days: '1'
- name: Test Overwrite
id: test
uses: ./save
with:
path: .github/
# Create a unique key to test intra workflow artifacts.
key: test/stash-${{ matrix.os }}-${{ github.sha }}
retention-days: '1'
- name: Check Output
shell: bash
env:
ID: ${{ steps.test.outputs.stash-id }}
URL: ${{ steps.test.outputs.stash-url }}
run: |
if [ -z "$ID" -o -z "$URL" ]; then
echo "Output empty"
exit 1
fi
- name: Check if inter-workflow stash exists
id: stash
uses: ./restore
with:
key: test-stash-cross-${{ matrix.os }}
path: test-stash
- name: Save cross-workflow Stash
if: ${{ steps.stash.outputs.stash-hit == 'false' }}
uses: ./save
with:
path: .github/
key: test-stash-cross-${{ matrix.os }}
retention-days: '90'
test-restore:
name: "stash/restore on ${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
needs: test-save
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Test intra-workflow stash
uses: ./restore
with:
key: test/stash-${{ matrix.os }}-${{ github.sha }}
path: intra/.github/
- shell: bash
run: ls -laR intra
- name: Test inter-workflow stash
uses: ./restore
with:
key: test-stash-cross-${{ matrix.os }}
path: inter/.github/
- shell: bash
run: ls -laR inter/