Skip to content

Commit 79f115c

Browse files
committed
Adjustments to github actions
1 parent 40643b1 commit 79f115c

File tree

3 files changed

+15
-28
lines changed

3 files changed

+15
-28
lines changed

.github/workflows/publish.yml

+7-17
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,11 @@ jobs:
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323

24-
- name: Install dependencies
24+
- name: Install dependencies and run CI
2525
run: |
2626
python -m pip install --upgrade pip
27-
pip install pytest
28-
pip install -e .
29-
30-
- name: Run tests
31-
run: pytest
27+
pip install build pytest pytest-cov setuptools_scm
28+
make ci
3229
3330
publish:
3431
needs: test
@@ -41,23 +38,16 @@ jobs:
4138
with:
4239
python-version: '3.x'
4340

44-
- name: Install build tools
45-
run: |
46-
python -m pip install --upgrade pip
47-
pip install build twine
48-
4941
- name: Verify tag version matches package version
5042
run: |
51-
PACKAGE_VERSION=$(python setup.py --version)
52-
TAG_VERSION=${GITHUB_REF#refs/tags/v}
43+
pip install twine
44+
PACKAGE_VERSION=$(python -m setuptools_scm)
45+
TAG_VERSION=${GITHUB_REF#refs/tags/} # Remove 'refs/tags/' prefix
5346
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
5447
echo "Package version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)"
5548
exit 1
5649
fi
5750
58-
- name: Build package
59-
run: python -m build
60-
6151
- name: Publish to TestPyPI
6252
if: contains(github.ref, 'test')
6353
env:
@@ -70,7 +60,7 @@ jobs:
7060
env:
7161
TWINE_USERNAME: __token__
7262
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
73-
run: twine upload dist/*
63+
run: make ci.dist
7464

7565
- name: Create Release
7666
uses: softprops/action-gh-release@v1

.github/workflows/windows-test.yml

+3-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: windows-latest
1313
strategy:
1414
matrix:
15-
python-version: ['3.11', '3.12']
15+
python-version: ['3.12']
1616
architecture: ['x64']
1717

1818
steps:
@@ -31,17 +31,11 @@ jobs:
3131
- name: Install dependencies
3232
run: |
3333
python -m pip install --upgrade pip
34-
pip install pytest pytest-cov
35-
pip install -e .
34+
pip install build pytest pytest-cov
3635
3736
- name: Run tests
3837
run: |
39-
pytest --cov=cedarscript_ast_parser tests/
40-
- name: Test PyPI installation
41-
run: |
42-
pip uninstall cedarscript-ast-parser -y
43-
pip install cedarscript-ast-parser
44-
python -c "from cedarscript_ast_parser import CEDARScriptASTParser; CEDARScriptASTParser()"
38+
make ci
4539
4640
# Optional: Upload artifacts if your package generates any
4741
- name: Upload artifacts

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
.PHONY: all dist d clean c version v install i test t build b
22

3-
all: clean install test build version
3+
ci: clean install test
4+
all: ci build version
45

5-
dist d: all
6+
dist d: all ci.dist
7+
8+
ci.dist:
69
scripts/check-version.sh
710
twine upload dist/*
811

0 commit comments

Comments
 (0)