-
-
Notifications
You must be signed in to change notification settings - Fork 6
183 lines (147 loc) · 4.98 KB
/
test.yml
File metadata and controls
183 lines (147 loc) · 4.98 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test_python_installation:
strategy:
fail-fast: false
matrix:
# This tests the amazon linux versions receiving standard support
# Refer - https://endoflife.date/amazon-linux
amazon-linux-version: [ 2, 2023 ]
# This tests the lowest supported python version and the latest stable python version
# Refer - https://devguide.python.org/versions/#status-of-python-versions
python-version: [ 3.8.18, 3.12.0 ]
cache: [ true, false ]
runs-on: ubuntu-latest
container: amazonlinux:${{ matrix.amazon-linux-version }}
steps:
- name: Setup runner
run: |
yum install -y git sudo tar gzip which
- name: Checkout
run: |
git clone --depth 1 -b "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" "https://github.com/${GITHUB_REPOSITORY}.git" .
- name: Install python
uses: ./
with:
python-version: ${{ matrix.python-version }}
cache: ${{ matrix.cache }}
- name: Test installation
run: |
set -x
which python3
which python
python3 --version
python --version
python3 --version 2>&1 | grep -F "${{ matrix.python-version }}"
test "$(python3 -m pip --version)" = "$(pip3 --version)"
python --version 2>&1 | grep -F "${{ matrix.python-version }}"
test "$(python3 -m pip --version)" = "$(pip --version)"
test_pip_installs:
strategy:
fail-fast: false
matrix:
amazon-linux-version: [ 2, 2023 ]
python-version: [ "3.8", "3.9", "3.10", "3.11" , "3.12" ]
cache: [ true, false ]
runs-on: ubuntu-latest
container: amazonlinux:${{ matrix.amazon-linux-version }}
steps:
- name: Setup runner
run: |
yum install -y git sudo tar gzip which
- name: Checkout
run: |
git clone --depth 1 -b "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" "https://github.com/${GITHUB_REPOSITORY}.git" .
- name: Install python
uses: ./
with:
python-version: "${{ matrix.python-version }}"
cache: ${{ matrix.cache }}
- name: Test installation
run: |
set -x
pip install requests
pip3 install s4cmd
pip3 install boto3
test_python_version_file:
runs-on: ubuntu-latest
container: amazonlinux:2023
steps:
- name: Setup runner
run: |
yum install -y git sudo tar gzip which
- name: Checkout
run: |
git clone --depth 1 -b "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" "https://github.com/${GITHUB_REPOSITORY}.git" .
- name: Create python version file
run: |
echo '3.11.5' > .python-version
- name: Install python
uses: ./
with:
python-version-file: ".python-version"
- name: Test installation
run: |
set -x
which python3
which python
python3 --version
python --version
python3 --version 2>&1 | grep -F "3.11.5"
test "$(python3 -m pip --version)" = "$(pip3 --version)"
python --version 2>&1 | grep -F "3.11.5"
test "$(python3 -m pip --version)" = "$(pip --version)"
test_python_resolution_order:
runs-on: ubuntu-latest
container: amazonlinux:2023
steps:
- name: Setup runner
run: |
yum install -y git sudo tar gzip which
- name: Checkout
run: |
git clone --depth 1 -b "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" "https://github.com/${GITHUB_REPOSITORY}.git" .
- name: Create python version file
run: |
echo '3.12' > .python-version
- name: Install python
uses: ./
with:
python-version: "3.13"
- name: Test python version
run: |
set -x
which python3
which python
python3 --version
python --version
python3 --version 2>&1 | grep -F "3.13"
test_invalid_action_input:
runs-on: ubuntu-latest
container: amazonlinux:2023
steps:
- name: Setup runner
run: |
yum install -y git sudo tar gzip which
- name: Checkout
run: |
git clone --depth 1 -b "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" "https://github.com/${GITHUB_REPOSITORY}.git" .
- name: Install python
id: test-installation
continue-on-error: true
uses: ./
- name: Test python version
shell: bash
run: |
set -x
if [[ "${{ steps.test-installation.outcome }}" == "success" ]]; then
echo "error: The action should have failed because both python-version and python-version-file were not given but it has suceeded."
exit 1
else
echo "success: The action successfully failed because both python-version and python-version-file were not given"
fi