Version response type #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [ main ] | |
tags-ignore: | |
- 'v*' | |
jobs: | |
build: | |
name: 🏗️ Build | |
runs-on: ubuntu-latest | |
outputs: | |
next-version: ${{ steps.version.outputs.next-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python ⚙️ | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' # caching pip dependencies | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install dependencies ⚙️ | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Build and test 🏗️ | |
run: | | |
pip install httpx pytest pytest-cov coverage codecov | |
pytest -v --doctest-modules --junitxml=junit/test-results.xml --cov=trading_calendar --cov-report=xml --cov-report=html | |
- name: Upload coverage reports | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Get version number 🔢 | |
id: get-version | |
uses: release-drafter/release-drafter@v6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Store next version 🔢 | |
id: version | |
run: | | |
echo "next-version=${{ steps.get-version.outputs.tag_name }}" | cut -c -13,15- >> $GITHUB_OUTPUT | |
- name: Print next version 🔢 | |
run: | | |
echo "Next version: ${{ steps.version.outputs.next-version }}" | |
documentation: | |
name: 📚 Publish API doc | |
needs: [build] | |
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.event_name != 'schedule' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate OpenAPI specification 📝 | |
uses: column-st/[email protected] | |
with: | |
moduleDir: trading_calendar | |
outputExtension: json | |
- name: Generate API doc 📝 | |
uses: seeebiii/redoc-cli-github-action@v10 | |
with: | |
args: 'bundle openapi.json -o docs/api-doc/index.html' | |
- name: Deploy API doc 📚 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: docs/api-doc | |
target-folder: api-doc/${{ needs.build.outputs.next-version }}-SNAPSHOT | |
commit-message: Publishing API doc | |
clean: true | |
dry-run: false |