Test against latest dependencies #1815
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: Test against latest dependencies | |
# Run if we change any of these paths and every night at 1 (or 2) AM Central time | |
on: | |
push: | |
branches-ignore: | |
- 'master' | |
paths: | |
- 'requirements.txt' | |
- '.github/workflows/nightly_cron.yml' | |
schedule: | |
- cron: '0 7 * * *' # Every day at 07:00 UTC (1AM CST or 2AM CDT) | |
# Allows us to run manually | |
workflow_dispatch: | |
# Cancel older runs of the same workflow on the same branch | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build against latest dependencies | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
python-version: ['3.12'] | |
python-executable: ['cp312'] | |
defaults: | |
run: | |
shell: bash | |
runs-on: ${{ matrix.os }} | |
outputs: | |
dependency-table: ${{ steps.dependency-table.outputs.table }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setting up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set Run ID | |
id: definition # Needed to retrieve the output of this step later | |
run: echo "run_id=$GITHUB_RUN_ID" >> $GITHUB_OUTPUT | |
- name: Collecting naked dependencies | |
id: dependencies # Needed to retrieve the output of this step later | |
run: | | |
dependencies=$(python build_tools/github/get_latest_dependencies.py) | |
echo "latest_dependencies=$dependencies" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel | |
- name: Generating dependency table | |
id: dependency-table # Needed to set output of job | |
run: | | |
pip install requests tabulate | |
table=$(python .github/utils/get_dependency_releases.py $DEPENDENCIES) | |
# This is used in the next job (if necessary) rather than re-running the above | |
echo "table=$table" >> $GITHUB_OUTPUT | |
env: | |
DEPENDENCIES: ${{ steps.dependencies.outputs.latest_dependencies }} | |
- name: Building and testing wheel | |
run: python -m cibuildwheel --output-dir dist | |
env: | |
CIBW_ARCHS_LINUX: "x86_64" | |
CIBW_ARCHS_MACOS: "x86_64" | |
CIBW_ARCHS_WINDOWS: "AMD64" | |
CIBW_BEFORE_ALL: make version | |
CIBW_BEFORE_BUILD: > | |
for dependency in ${{ steps.dependencies.outputs.latest_dependencies }}; do | |
pip install $dependency | |
done | |
# Windows runs a batch script that I couldn't get to work, so we just force it to run bash | |
CIBW_BEFORE_BUILD_WINDOWS: bash -c 'for dependency in ${{ steps.dependencies.outputs.latest_dependencies }}; do pip install $dependency; done' | |
# Tests are run in a separate virtual env, so we need to re-install deps | |
CIBW_BEFORE_TEST: > | |
for dependency in ${{ steps.dependencies.outputs.latest_dependencies }}; do | |
pip install $dependency | |
done | |
CIBW_BEFORE_TEST_WINDOWS: bash -c 'for dependency in ${{ steps.dependencies.outputs.latest_dependencies }}; do pip install $dependency; done' | |
CIBW_BUILD: "${{ matrix.python-executable }}-*" | |
CIBW_ENVIRONMENT_MACOS: PMD_MPL_BACKEND=TkAGG | |
# No support for pypy or musl | |
CIBW_SKIP: "pp* *-musllinux_*" | |
CIBW_TEST_COMMAND: pytest --showlocals --durations=20 --pyargs pmdarima | |
# https://github.com/marketplace/actions/action-slack#custom-notification | |
- name: Posting to Slack | |
uses: 8398a7/action-slack@v3 | |
if: failure() | |
with: | |
status: custom | |
custom_payload: | | |
{ | |
text: ":no_entry: Nightly Build Failed", | |
attachments: [{ | |
"author_name": "Nightly Build", // This one needs to be in quotes for some reason | |
fallback: 'Nightly Build Failed!', | |
color: 'danger', | |
title: 'CI Result', | |
text: 'Failed', | |
fields: [ | |
{ | |
title: 'OS', | |
value: '${{ matrix.os }}', | |
short: false | |
}, | |
{ | |
title: 'Python Version', | |
value: '${{ matrix.python-version }}', | |
short: false | |
}, | |
{ | |
title: 'Link to Run', | |
value: '<https://github.com/alkaline-ml/pmdarima/actions/runs/${{ env.RUN_ID }}|HERE>', | |
short: false | |
} | |
], | |
actions: [{}] // Don't know if we actually need this, but it is shown in the docs as empty | |
}] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.NIGHTLY_SLACK_CHANNEL }} | |
RUN_ID: ${{ steps.definition.outputs.run_id }} | |
# We only run this job if the previous one fails (any of the 4 jobs that it spins up) | |
send_latest_releases: | |
needs: [build] | |
if: failure() | |
name: Send latest dependency releases to Slack | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Setting up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Posting to Slack | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: custom | |
custom_payload: | | |
{ | |
text: "Latest Dependency Releases (most recent first):\n${{ env.TABLE }}", | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.NIGHTLY_SLACK_CHANNEL }} | |
TABLE: ${{ needs.build.outputs.dependency-table }} |