From d61c92ce8d088a8e4b29a36a310b3ebae0056913 Mon Sep 17 00:00:00 2001 From: w3stling Date: Sat, 3 Aug 2024 10:27:42 +0200 Subject: [PATCH] Update build script --- .github/workflows/build.yml | 2 +- .github/workflows/pr-check.yml | 56 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr-check.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6be1186..c2b7154 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,7 @@ jobs: 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.5.0 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 0000000..cd2c072 --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,56 @@ +# This workflow will check pull request and run tests + +name: Pull Request Check + +on: + pull_request: + branches: + - main + +permissions: + checks: write + pull-requests: write + +jobs: + build: + name: 🛂 Pull Request Check + timeout-minutes: 20 + runs-on: ubuntu-latest + + steps: + - name: Checkout repository ⚙️ + uses: actions/checkout@v4 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting + fetch-depth: 0 + + - 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: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + files: | + junit/test-results.xml + + - name: Upload coverage reports + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }}