File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : build-and-test
2+ description : |
3+ Set up Python and run the build and test steps.
4+
5+ runs :
6+ using : composite
7+ steps :
8+ - name : Set up Python
9+ uses : ./.github/actions/setup-python
10+ # TODO: move dependencies to a separate file (e.g. a requirements.txt file)
11+ - name : Install dependencies
12+ shell : bash
13+ run : |
14+ python -m pip install pytest build
15+ - name : Run build
16+ shell : bash
17+ run : python -m build
18+ - name : Show dist files
19+ shell : bash
20+ run : |
21+ echo "Dist files:"
22+ ls -lh dist/
23+ - name : Run pytest
24+ shell : bash
25+ run : |
26+ python -m pip install -e .
27+ pytest
Original file line number Diff line number Diff line change 1+ name : build-and-test
2+ description : |
3+ This action lets the Python version for CI be specified in a single place.
4+
5+ runs :
6+ using : composite
7+ steps :
8+ - name : Set up Python
9+ uses : actions/setup-python@v5
10+ with :
11+ python-version : " 3.12"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ # This workflow builds and tests code that is pushed to the `master` branch.
2+
3+ name : merge
4+
5+ on :
6+ push :
7+ branches :
8+ - master
9+
10+ jobs :
11+ merge :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout repo
15+ uses : actions/checkout@v4
16+ with :
17+ fetch-tags : true
18+ fetch-depth : 0
19+ - name : Build and test
20+ uses : ./.github/actions/build-and-test
Original file line number Diff line number Diff line change 1+ # This workflow builds and tests code in pull requests.
2+
3+ name : pr
4+
5+ on : pull_request
6+
7+ jobs :
8+ pr :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : Checkout repo
12+ uses : actions/checkout@v4
13+ with :
14+ fetch-tags : true
15+ fetch-depth : 0
16+ - name : Build and test
17+ uses : ./.github/actions/build-and-test
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ # This workflow initiates a release of the project.
2+
3+ name : release
4+
5+ on :
6+ workflow_dispatch :
7+ inputs :
8+ version :
9+ description : Release version (e.g. `v0.4.5`)
10+ type : string
11+ required : true
12+
13+ jobs :
14+ release :
15+ permissions :
16+ # `contents: write` is required to create tags and create releases
17+ # `id-token: write` is required for PyPI attestations
18+ contents : write
19+ id-token : write
20+ runs-on : ubuntu-latest
21+ env :
22+ RELEASE_VERSION : ${{ inputs.version }}
23+ steps :
24+ - name : Checkout repo
25+ uses : actions/checkout@v4
26+ with :
27+ fetch-tags : true
28+ fetch-depth : 0
29+ - name : Create local lightweight tag
30+ run : git tag "${RELEASE_VERSION}"
31+ - name : Build and test
32+ uses : ./.github/actions/build-and-test
33+ - name : Push tag
34+ run : git push origin "${RELEASE_VERSION}"
35+ - name : Create release from tag
36+ env :
37+ GH_TOKEN : ${{ github.token }}
38+ run : |
39+ gh api \
40+ --method POST \
41+ "/repos/${GITHUB_REPOSITORY}/releases" \
42+ -f "tag_name=${RELEASE_VERSION}" \
43+ -f "name=${RELEASE_VERSION}" \
44+ -F "draft=false" \
45+ -F "prerelease=false" \
46+ -F "generate_release_notes=true"
47+ - name : Publish package distributions to PyPI
48+ uses : pypa/gh-action-pypi-publish@release/v1
You can’t perform that action at this time.
0 commit comments