@@ -4,7 +4,7 @@ name: Test & deploy
4
4
on :
5
5
push :
6
6
branches :
7
- - master
7
+ - main
8
8
pull_request :
9
9
schedule :
10
10
- cron : " 0 6,18 * * *"
49
49
- name : Install from repo in test mode
50
50
run : " pip install -e '.[dev]'"
51
51
- name : Run tests
52
- run : " python -m pytest minihack/tests --basetemp=minihack_test_data"
52
+ run : " python -m pytest -svx minihack/tests --basetemp=minihack_test_data"
53
53
- name : Compress test output dir
54
54
if : ${{ always() }}
55
55
run : |
60
60
with :
61
61
name : minihack_test_data_${{ matrix.python-version }}
62
62
path : minihack_test_ci_${{ github.sha }}.tar.gz
63
+
64
+
65
+ test_sdist :
66
+ name : Test sdist on MacOS w/ Py3.8
67
+ needs : test_repo
68
+ runs-on : macos-latest
69
+ steps :
70
+ - name : Setup Python 3.8 env
71
+ uses : actions/setup-python@v2
72
+ with :
73
+ python-version : 3.8
74
+ - name : Ensure latest pip & wheel
75
+ run : " python -m pip install -q --upgrade pip wheel"
76
+ - name : Install dependencies
77
+ run : |
78
+ brew install cmake
79
+ - uses : actions/checkout@v2
80
+ with :
81
+ submodules : true
82
+ - name : Generate sdist
83
+ run : |
84
+ MINIHACK_RELEASE_BUILD=1 python setup.py sdist
85
+ - name : Install from sdist
86
+ run : |
87
+ SDISTNAME=$(ls dist/)
88
+ MODE="[all]"
89
+ pip install "dist/$SDISTNAME$MODE"
90
+ - name : Run tests outside repo dir
91
+ run : |
92
+ REPONAME=$(basename $PWD)
93
+ pushd ..
94
+ python -m pytest -svx $REPONAME/minihack/tests --basetemp=$REPONAME/minihack_test_data
95
+ popd
96
+ - name : Compress test output dir
97
+ if : ${{ always() }}
98
+ run : |
99
+ tar -zcvf minihack_test_ci_${{ github.sha }}.tar.gz minihack_test_data
100
+ - name : Save test results
101
+ if : ${{ always() }}
102
+ uses : actions/upload-artifact@v1
103
+ with :
104
+ name : minihack_test_data_sdist
105
+ path : minihack_test_ci_${{ github.sha }}.tar.gz
106
+ - name : Save sdist
107
+ if : ${{ always() }}
108
+ uses : actions/upload-artifact@v1
109
+ with :
110
+ name : minihack_dist
111
+ path : dist/
112
+
113
+ # TODO move this to separate workflow whenever github decides to provide basic
114
+ # functionalities like workflow dependencies :|
115
+ deploy_sdist :
116
+ name : Deploy sdist to pypi
117
+ needs : test_sdist
118
+ if : github.event_name == 'release' && github.event.action == 'released'
119
+ runs-on : ubuntu-latest
120
+ steps :
121
+ - uses : actions/checkout@v2
122
+ - name : Check version matches release tag
123
+ run : |
124
+ echo "v$(cat version.txt)"
125
+ echo "${{ github.event.release.tag_name }}"
126
+ [[ "${{ github.event.release.tag_name }}" == "v$(cat version.txt)" ]]
127
+ - name : Get dist artifacts from test_sdist
128
+ uses : actions/download-artifact@v2
129
+ with :
130
+ name : minihack_dist
131
+ path : dist
132
+ - name : Install from sdist
133
+ run : |
134
+ pwd
135
+ ls -R
136
+ ls -al .
137
+ ls -R dist/
138
+ ls -al dist/
139
+ # NOTE: we assume that dist/ contains a built sdist (and only that).
140
+ # Yes, we could be more defensively, but What Could Go Wrong?™
141
+ - name : Publish package to PyPI
142
+ uses : pypa/gh-action-pypi-publish@master
143
+ with :
144
+ user : __token__
145
+ password : ${{ secrets.PYPI_TOKEN }}
0 commit comments