chore: Update links in README #548
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: Python dependencies | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-11] | |
defaults: | |
run: | |
shell: bash # For `source` | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Select dependency files (linux) | |
if: startswith(matrix.os, 'ubuntu') | |
run: | | |
echo 'ACTIVATE_PATH=venv/bin/activate' >> $GITHUB_ENV | |
echo 'REQUIREMENTS=requirements/linux.txt' >> $GITHUB_ENV | |
echo 'DEV_REQUIREMENTS=requirements/linux-dev.txt' >> $GITHUB_ENV | |
- name: Select dependency files (windows) | |
if: startswith(matrix.os, 'windows') | |
run: | | |
echo 'ACTIVATE_PATH=venv/Scripts/activate' >> $GITHUB_ENV | |
echo 'REQUIREMENTS=requirements/windows.txt' >> $GITHUB_ENV | |
echo 'DEV_REQUIREMENTS=requirements/windows-dev.txt' >> $GITHUB_ENV | |
- name: Select dependency files (mac) | |
if: startswith(matrix.os, 'macOS') | |
run: | | |
echo 'ACTIVATE_PATH=venv/bin/activate' >> $GITHUB_ENV | |
echo 'REQUIREMENTS=requirements/mac.txt' >> $GITHUB_ENV | |
echo 'DEV_REQUIREMENTS=requirements/mac-dev.txt' >> $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
python -m ensurepip | |
python -m venv venv | |
source ${{ env.ACTIVATE_PATH }} | |
python -m pip install --upgrade pip | |
pip_tools_version="$(grep '^pip-tools==' ${{ env.DEV_REQUIREMENTS }} | awk '{print $1}')" | |
python -m pip install "$pip_tools_version" | |
- name: Ensure requirements are satisfied | |
run: | | |
source ${{ env.ACTIVATE_PATH }} | |
echo ======================================== | |
pip-compile --resolver=backtracking --generate-hashes setup.cfg --output-file ${{ env.REQUIREMENTS }} | |
echo ======================================== | |
echo ======================================== | |
pip-compile --resolver=backtracking --generate-hashes requirements/dev.in --output-file ${{ env.DEV_REQUIREMENTS }} | |
echo ======================================== | |
cp "${{ env.REQUIREMENTS }}" "${{ env.REQUIREMENTS }}"_fixed | |
cp "${{ env.DEV_REQUIREMENTS }}" "${{ env.DEV_REQUIREMENTS }}"_fixed | |
if [ $(git diff requirements/ | wc -l) -gt 0 ]; then | |
echo Pinned requirements invalid! | |
git status | |
git diff | |
exit 1 | |
else | |
echo Pinned requirements valid | |
fi | |
- name: Run pip-compile --upgrade | |
if: always() | |
continue-on-error: true | |
run: | | |
source ${{ env.ACTIVATE_PATH }} | |
echo ======================================== | |
pip-compile --resolver=backtracking --generate-hashes setup.cfg --output-file ${{ env.REQUIREMENTS }} --upgrade | |
echo ======================================== | |
echo ======================================== | |
pip-compile --resolver=backtracking --generate-hashes requirements/dev.in --output-file ${{ env.DEV_REQUIREMENTS }} --upgrade | |
echo ======================================== | |
if [ $(git diff requirements/ | wc -l) -gt 0 ]; then | |
echo Updated pinned requirements! | |
git status | |
git diff | |
else | |
echo Pinned requirements not updated. | |
fi | |
cp "${{ env.REQUIREMENTS }}" "${{ env.REQUIREMENTS }}"_updated | |
cp "${{ env.DEV_REQUIREMENTS }}" "${{ env.DEV_REQUIREMENTS }}"_updated | |
cp "${{ env.REQUIREMENTS }}"_fixed "${{ env.REQUIREMENTS }}" | |
cp "${{ env.DEV_REQUIREMENTS }}"_fixed "${{ env.DEV_REQUIREMENTS }}" | |
- name: Upload updated dependency files | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: requirements | |
if-no-files-found: warn | |
path: | | |
${{ env.REQUIREMENTS }} | |
${{ env.DEV_REQUIREMENTS }} | |
${{ env.REQUIREMENTS }}_updated | |
${{ env.DEV_REQUIREMENTS }}_updated |