-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (60 loc) · 1.92 KB
/
ci.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
name: CI
on:
push:
branches:
- main
tags:
- '**'
pull_request: {}
jobs:
test-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: docker build . -t check-python-version
- run: |
mkdir foobar
echo "VERSION = '1.0a1'" > foobar/version.py
- run: >
docker run --rm
-e INPUT_TEST_GITHUB_REF
-e INPUT_VERSION_FILE_PATH
-e ALT_GITHUB_OUTPUT
-v `pwd`:/app
check-python-version
env:
# we can't use GITHUB_REF, so we use the backup var name
INPUT_TEST_GITHUB_REF: refs/tags/v1.0.0a1
INPUT_VERSION_FILE_PATH: foobar/version.py
ALT_GITHUB_OUTPUT: /app/output1.txt
- run: cat output1.txt
- run: grep -q 'IS_PRERELEASE=true' output1.txt
- run: grep -q 'VERSION=1.0a1' output1.txt
- run: echo "VERSION = '1.1.1'" > foobar/version.py
- run: >
docker run --rm
-e INPUT_SKIP_ENV_CHECK
-e INPUT_VERSION_FILE_PATH
-e ALT_GITHUB_OUTPUT
-v `pwd`:/app
check-python-version
env:
INPUT_SKIP_ENV_CHECK: true
INPUT_VERSION_FILE_PATH: foobar/version.py
ALT_GITHUB_OUTPUT: /app/output2.txt
- run: cat output2.txt
- run: grep -q 'IS_PRERELEASE=false' output2.txt
- run: grep -q 'VERSION=1.1.1' output2.txt
test-action:
runs-on: ubuntu-latest
steps:
- run: |
mkdir mypackage
echo "__version__ = 'v1.0post1'" > mypackage/version.py
- uses: samuelcolvin/check-python-version@main
id: check-python-version
with:
version_file_path: mypackage/version.py
test_github_ref: refs/tags/1-post1
- run: test ${{ steps.check-python-version.outputs.IS_PRERELEASE }} == 'false'
- run: test ${{ steps.check-python-version.outputs.VERSION }} == '1.0.post1'