mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-02 10:03:28 +00:00
Fix CI (due to python 3.12 update) + Fix migration CI check (#2306)
* Fix migration check not always failing when it should on main - Fix check due to Github using `refs/heads/gh-readonly-queue/main/` as ref when merging a PR from merge-queue to main - Add migration due to changes made in #2161 * Fix missing migration error message being showed when it shouldn't - Filter out empty migrations files from check testing if a migration is missing * Prevent inner grep from failling the whole command - Fix last grep outputting gibberish when not receiving any file * Fix xargs and grep command on macOS * auto format * Configure python 3.11 version on Github CI - Python 3.12 is the default on CI now, which breaks node-gyp and most of the native dependencies installations - Fix _new_migrations having lead and trailing spaces * Remove migration, already included in #2302
This commit is contained in:
parent
67554c89b3
commit
56cee3c64d
4
.github/actions/setup-pnpm/action.yml
vendored
4
.github/actions/setup-pnpm/action.yml
vendored
|
@ -8,6 +8,10 @@ inputs:
|
|||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
|
|
21
.github/actions/setup-rust/action.yaml
vendored
21
.github/actions/setup-rust/action.yaml
vendored
|
@ -73,12 +73,21 @@ runs:
|
|||
|
||||
# Check if a new migration should be created due to changes in the schema
|
||||
cargo prisma migrate dev -n test --create-only --skip-generate
|
||||
if git ls-files --others --exclude-standard | grep -q '^prisma/migrations/'; then
|
||||
echo "::error file=core/prisma/schema.prisma,title=Missing migration::New migration should be generated due to changes in prisma schema"
|
||||
# Fail action if we are on main or a release tag, to avoid releasing a app with broken db
|
||||
if [ "$GITHUB_REF" == "refs/heads/main" ] || [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
||||
exit 1
|
||||
fi
|
||||
_new_migrations="$(
|
||||
git ls-files --others --exclude-standard \
|
||||
| { grep '^prisma/migrations/' || true; } \
|
||||
| xargs sh -euxc '[ "$#" -lt 2 ] || grep -L "$@" || true' sh 'This is an empty migration' \
|
||||
| wc -l \
|
||||
| awk '{$1=$1};1'
|
||||
)"
|
||||
if [ "$_new_migrations" -gt 0 ]; then
|
||||
echo "::error file=core/prisma/schema.prisma,title=Missing migration::New migration should be generated due to changes in prisma schema"
|
||||
case "$GITHUB_REF" in
|
||||
"refs/heads/main" | "refs/heads/gh-readonly-queue/main/"* | "refs/tags/"*)
|
||||
# Fail action if we are on main or a release tag, to avoid releasing an app with a broken db
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
- name: Save Prisma codegen
|
||||
|
|
|
@ -169,6 +169,27 @@ Once that has completed, run `xcode-select --install` in the terminal to install
|
|||
|
||||
Also ensure that Rosetta is installed, as a few of our dependencies require it. You can install Rosetta with `softwareupdate --install-rosetta --agree-to-license`.
|
||||
|
||||
#### `ModuleNotFoundError: No module named 'distutils'`
|
||||
|
||||
If you run into this issue, or some other error involving `node-gyp`:
|
||||
```
|
||||
File "pnpm@8.15.6/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
|
||||
import gyp # noqa: E402
|
||||
^^^^^^^^^^
|
||||
File "pnpm@8.15.6/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
|
||||
import gyp.input
|
||||
File "pnpm@8.15.6/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
|
||||
from distutils.version import StrictVersion
|
||||
```
|
||||
|
||||
Some pnpm dependencies require compilation steps that depend on Python to execute.
|
||||
However, a recent change in Python version 3.12 broke the utility used to bridge these compilation steps to node/npm/pnpm.
|
||||
|
||||
Currently, there is no definitive solution to this issue due to it being fairly new. But there are two workarounds:
|
||||
|
||||
1. Downgrade your system Python version to 3.11 or lower.
|
||||
2. Update pnpm to version v9.0.0-rc.0 (Release Candidate, not fully stable yet).
|
||||
|
||||
### Credits
|
||||
|
||||
This CONTRIBUTING.md file was inspired by the [github/docs CONTRIBUTING.md](https://github.com/github/docs/blob/main/CONTRIBUTING.md) file, and we extend our gratitude to the original author.
|
||||
|
|
Loading…
Reference in a new issue