Use `.env` file instead of `.envrc` (#1132)

#1131 shows that `direnv` installation is _most_ of the CI overhead
introduced by #1105.

Instead of using `direnv`, let's just use a simple `.env` file that can
be loaded with `source` or [`direnv`'s `dotenv`
directive](https://direnv.net/man/direnv-stdlib.1.html#codedotenv-ltdotenvpathgtcode).
This commit is contained in:
Zanie Blue 2024-01-26 14:00:05 -06:00 committed by GitHub
parent 5cc4e5d31e
commit 0cdde8949f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 13 deletions

2
.env Normal file
View File

@ -0,0 +1,2 @@
PATH=$PWD/bin:$PATH
PUFFIN_PYTHON_PATH=$PWD/bin

3
.envrc
View File

@ -1,3 +0,0 @@
PATH=$PWD/bin:$PATH
export PUFFIN_PYTHON_PATH=$PWD/bin

View File

@ -56,9 +56,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: "Install required Python versions" - name: "Install required Python versions"
run: | run: |
sudo apt install direnv
scripts/bootstrap/install.sh scripts/bootstrap/install.sh
direnv allow .envrc
- name: "Install Rust toolchain" - name: "Install Rust toolchain"
run: rustup show run: rustup show
- uses: rui314/setup-mold@v1 - uses: rui314/setup-mold@v1
@ -71,7 +69,8 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' }} save-if: ${{ github.ref == 'refs/heads/main' }}
- name: "Tests" - name: "Tests"
run: | run: |
direnv exec . cargo nextest run --all --all-features --status-level skip --failure-output immediate-final --no-fail-fast -j 12 source .env
cargo nextest run --all --all-features --status-level skip --failure-output immediate-final --no-fail-fast -j 12
# TODO(konstin): Merge with the cargo-test job once the tests pass # TODO(konstin): Merge with the cargo-test job once the tests pass
windows: windows:

View File

@ -43,21 +43,20 @@ Install required Python versions with the bootstrapping script:
scripts/bootstrap/install.sh scripts/bootstrap/install.sh
``` ```
Then add the Python binaries to your path: The installed Python binaries will be available in `<repo>/bin` and must be added to your path to be used. We
provide a `.env` file with the proper environment variables for development. You may activate it with:
``` ```
export PATH=$PWD/bin:$PATH source .env
``` ```
We also strongly recommend setting the `PUFFIN_PYTHON_PATH` variable during development; this will prevent your Or, if you use `direnv` to manage your environment:
system Python versions from being found during tests:
``` ```
export PUFFIN_PYTHON_PATH=$PWD/bin echo "dotenv" >> .envrc
direnv allow
``` ```
If you use [direnv](https://direnv.net/), these variables will be exported automatically after you run `direnv allow`.
## Testing ## Testing
To run the tests we recommend [nextest](https://nexte.st/). Make sure to run the tests with `--all-features`, otherwise you'll miss most of our integration tests. To run the tests we recommend [nextest](https://nexte.st/). Make sure to run the tests with `--all-features`, otherwise you'll miss most of our integration tests.