Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyoon committed Jul 2, 2024
1 parent 73ad657 commit 837ef52
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 90 deletions.
23 changes: 5 additions & 18 deletions .github/workflows/apply-pip-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
echo "python_version=$(python3 scripts/get_python_version.py)" >> "$GITHUB_OUTPUT"
id: get-python-version
- name: Set up Python
uses: actions/setup-python@v5
- uses: deargen/workflows/actions/apply-pip-compile@master
with:
python-version: ${{ steps.get-python-version.outputs.python_version }}
- name: Install uv
run: |
pip3 install uv
- name: Run uv pip compile and push
run: |
set +e # Do not exit shell on failure
bash scripts/compile_requirements.sh
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git add .
git commit -m "build: update requirements using uv pip compile [skip ci]"
git push
pyproject-toml-file: pyproject.toml
requirements-in-dir: deps
requirements-out-dir: deps/lock
python-platforms: x86_64-unknown-linux-gnu,aarch64-apple-darwin,x86_64-apple-darwin,x86_64-pc-windows-msvc
2 changes: 1 addition & 1 deletion .github/workflows/apply-ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
with:
ruff-select: ${{ github.event.inputs.ruff-select }}
ruff-ignore: ${{ github.event.inputs.ruff-ignore }}
ruff-version-file: deps/x86_64-unknown-linux-gnu/requirements_dev.txt
ruff-version-file: deps/lock/x86_64-unknown-linux-gnu/requirements_dev.txt
46 changes: 9 additions & 37 deletions .github/workflows/check-pip-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,19 @@ name: Check pip compile sync

on: [push, pull_request]

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

jobs:
check-pip-compile:
name: Check pip compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
echo "python_version=$(python3 scripts/get_python_version.py)" >> "$GITHUB_OUTPUT"
id: get-python-version
- name: Set up Python
uses: actions/setup-python@v5
- uses: deargen/workflows/actions/check-pip-compile@master
with:
python-version: ${{ steps.get-python-version.outputs.python_version }}
- name: Install uv
run: |
pip3 install uv
- name: Generate lockfile and print diff
run: |
set +e # Do not exit shell on failure
out=$(bash scripts/compile_requirements.sh 2> _stderr.txt)
exit_code=$?
err=$(<_stderr.txt)
if [[ -n "$out" ]]; then
# Display the raw output in the step
echo "${out}"
# Display the Markdown output in the job summary
{ echo "\`\`\`"; echo "${out}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
fi
if [[ -n "$err" ]]; then
echo "${err}"
{ echo "\`\`\`"; echo "${err}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
fi
if [[ $exit_code -eq 0 ]]; then
# When the script fails, there are changes in requirements that are not compiled yet.
# Print the suggested changes.
{ echo "\`\`\`diff"; git diff; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
# When the script fails, it means it does not have anything to compile.
exit 0
pyproject-toml-file: pyproject.toml
requirements-in-dir: deps
requirements-out-dir: deps/lock
python-platforms: x86_64-unknown-linux-gnu,aarch64-apple-darwin,x86_64-apple-darwin,x86_64-pc-windows-msvc
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
uses: deargen/workflows/.github/workflows/check-ruff.yml@master
with:
check-type: lint
ruff-version-file: deps/x86_64-unknown-linux-gnu/requirements_dev.txt
ruff-version-file: deps/lock/x86_64-unknown-linux-gnu/requirements_dev.txt
6 changes: 3 additions & 3 deletions .github/workflows/styles-only-changed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ jobs:
uses: deargen/workflows/.github/workflows/check-ruff-only-changed.yml@master
with:
check-type: format
ruff-version-file: deps/x86_64-unknown-linux-gnu/requirements_dev.txt
ruff-version-file: deps/lock/x86_64-unknown-linux-gnu/requirements_dev.txt
ruff-isort-on-changes:
uses: deargen/workflows/.github/workflows/check-ruff-only-changed.yml@master
with:
check-type: isort
ruff-version-file: deps/x86_64-unknown-linux-gnu/requirements_dev.txt
ruff-version-file: deps/lock/x86_64-unknown-linux-gnu/requirements_dev.txt
ruff-lint-on-changes:
uses: deargen/workflows/.github/workflows/check-ruff-only-changed.yml@master
with:
check-type: lint
ruff-version-file: deps/x86_64-unknown-linux-gnu/requirements_dev.txt
ruff-version-file: deps/lock/x86_64-unknown-linux-gnu/requirements_dev.txt
4 changes: 2 additions & 2 deletions .github/workflows/styles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
uses: deargen/workflows/.github/workflows/check-ruff.yml@master
with:
check-type: format
ruff-version-file: deps/x86_64-unknown-linux-gnu/requirements_dev.txt
ruff-version-file: deps/lock/x86_64-unknown-linux-gnu/requirements_dev.txt
ruff-isort:
uses: deargen/workflows/.github/workflows/check-ruff.yml@master
with:
check-type: isort
ruff-version-file: deps/x86_64-unknown-linux-gnu/requirements_dev.txt
ruff-version-file: deps/lock/x86_64-unknown-linux-gnu/requirements_dev.txt
30 changes: 2 additions & 28 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,9 @@ jobs:
source .venv/bin/activate
uv pip install -r deps/x86_64-unknown-linux-gnu/requirements_dev.txt
bash scripts/install.sh
- name: Run pytest
run: |
set +e # Do not exit shell on pytest failure
source .venv/bin/activate
python3 scripts/hf_download.py
out=$(pytest 2> stderr.txt)
exit_code=$?
err=$(<stderr.txt)
# Display the raw output in the step
echo "${out}"
echo "${err}"
# Display the Markdown output in the job summary
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
echo "${out}" >> $GITHUB_STEP_SUMMARY
echo "${err}" >> $GITHUB_STEP_SUMMARY
if [[ $exit_code -eq 5 ]]
then
echo
echo 'WARNING: No tests were run and it is considered as success' >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
exit 0
else
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
# Exit with the exit-code returned by pytest
exit ${exit_code}
fi
- name: Run pytest
uses: deargen/workflows/actions/run-pytest@master

cargo-test:
needs: pre_job
Expand Down

0 comments on commit 837ef52

Please sign in to comment.