mirror of
https://github.com/dwinkler1/np.git
synced 2026-02-19 22:40:57 -05:00
Improve CI robustness: use mktemp for directories and handle whitespace in sed
Co-authored-by: dwinkler1 <22460147+dwinkler1@users.noreply.github.com>
This commit is contained in:
parent
4cd5a343e6
commit
ca5642d51f
1 changed files with 26 additions and 22 deletions
48
.github/workflows/check.yml
vendored
48
.github/workflows/check.yml
vendored
|
|
@ -91,8 +91,8 @@ jobs:
|
||||||
|
|
||||||
- name: Test p-initProject creates project structure
|
- name: Test p-initProject creates project structure
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/test-project
|
TEST_DIR=$(mktemp -d)
|
||||||
cd /tmp/test-project
|
cd "$TEST_DIR"
|
||||||
nix develop $GITHUB_WORKSPACE/templates/rde --command bash -c "p-initProject"
|
nix develop $GITHUB_WORKSPACE/templates/rde --command bash -c "p-initProject"
|
||||||
# Verify directories were created
|
# Verify directories were created
|
||||||
test -d data/raw || exit 1
|
test -d data/raw || exit 1
|
||||||
|
|
@ -101,6 +101,8 @@ jobs:
|
||||||
test -f README.md || exit 1
|
test -f README.md || exit 1
|
||||||
test -f .gitignore || exit 1
|
test -f .gitignore || exit 1
|
||||||
echo "Project structure created successfully"
|
echo "Project structure created successfully"
|
||||||
|
# Cleanup
|
||||||
|
rm -rf "$TEST_DIR"
|
||||||
|
|
||||||
- name: Test p-updateDeps command is available
|
- name: Test p-updateDeps command is available
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -132,40 +134,41 @@ jobs:
|
||||||
# Create a temporary directory with Python enabled
|
# Create a temporary directory with Python enabled
|
||||||
- name: Setup test directory with Python enabled
|
- name: Setup test directory with Python enabled
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/test-python
|
TEST_DIR=$(mktemp -d)
|
||||||
cp -r templates/rde/. /tmp/test-python/
|
cp -r templates/rde/. "$TEST_DIR/"
|
||||||
cd /tmp/test-python
|
cd "$TEST_DIR"
|
||||||
# Enable Python in the config
|
# Enable Python in the config (handle variations in whitespace)
|
||||||
sed -i 's/python = false;/python = true;/' flake.nix
|
sed -i 's/python[[:space:]]*=[[:space:]]*false;/python = true;/' flake.nix
|
||||||
|
echo "TEST_PYTHON_DIR=$TEST_DIR" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build with Python enabled
|
- name: Build with Python enabled
|
||||||
run: |
|
run: |
|
||||||
cd /tmp/test-python
|
cd "$TEST_PYTHON_DIR"
|
||||||
nix build
|
nix build
|
||||||
|
|
||||||
- name: Test Python commands are available
|
- name: Test Python commands are available
|
||||||
run: |
|
run: |
|
||||||
cd /tmp/test-python
|
cd "$TEST_PYTHON_DIR"
|
||||||
nix develop --command bash -c "which p-py && which p-ipy && which p-initPython"
|
nix develop --command bash -c "which p-py && which p-ipy && which p-initPython"
|
||||||
|
|
||||||
- name: Test Python launches
|
- name: Test Python launches
|
||||||
run: |
|
run: |
|
||||||
cd /tmp/test-python
|
cd "$TEST_PYTHON_DIR"
|
||||||
nix develop --command bash -c "p-py --version"
|
nix develop --command bash -c "p-py --version"
|
||||||
|
|
||||||
- name: Test Python can execute code
|
- name: Test Python can execute code
|
||||||
run: |
|
run: |
|
||||||
cd /tmp/test-python
|
cd "$TEST_PYTHON_DIR"
|
||||||
nix develop --command bash -c "p-py -c 'print(1+1)'"
|
nix develop --command bash -c "p-py -c 'print(1+1)'"
|
||||||
|
|
||||||
- name: Test UV package manager is available
|
- name: Test UV package manager is available
|
||||||
run: |
|
run: |
|
||||||
cd /tmp/test-python
|
cd "$TEST_PYTHON_DIR"
|
||||||
nix develop --command bash -c "uv --version"
|
nix develop --command bash -c "uv --version"
|
||||||
|
|
||||||
- name: Test basedpyright LSP is available
|
- name: Test basedpyright LSP is available
|
||||||
run: |
|
run: |
|
||||||
cd /tmp/test-python
|
cd "$TEST_PYTHON_DIR"
|
||||||
nix develop --command bash -c "basedpyright --version"
|
nix develop --command bash -c "basedpyright --version"
|
||||||
|
|
||||||
test-with-julia:
|
test-with-julia:
|
||||||
|
|
@ -187,28 +190,29 @@ jobs:
|
||||||
# Create a temporary directory with Julia enabled
|
# Create a temporary directory with Julia enabled
|
||||||
- name: Setup test directory with Julia enabled
|
- name: Setup test directory with Julia enabled
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/test-julia
|
TEST_DIR=$(mktemp -d)
|
||||||
cp -r templates/rde/. /tmp/test-julia/
|
cp -r templates/rde/. "$TEST_DIR/"
|
||||||
cd /tmp/test-julia
|
cd "$TEST_DIR"
|
||||||
# Enable Julia in the config
|
# Enable Julia in the config (handle variations in whitespace)
|
||||||
sed -i 's/julia = false;/julia = true;/' flake.nix
|
sed -i 's/julia[[:space:]]*=[[:space:]]*false;/julia = true;/' flake.nix
|
||||||
|
echo "TEST_JULIA_DIR=$TEST_DIR" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build with Julia enabled
|
- name: Build with Julia enabled
|
||||||
run: |
|
run: |
|
||||||
cd /tmp/test-julia
|
cd "$TEST_JULIA_DIR"
|
||||||
nix build
|
nix build
|
||||||
|
|
||||||
- name: Test Julia commands are available
|
- name: Test Julia commands are available
|
||||||
run: |
|
run: |
|
||||||
cd /tmp/test-julia
|
cd "$TEST_JULIA_DIR"
|
||||||
nix develop --command bash -c "which p-jl && which p-initJl"
|
nix develop --command bash -c "which p-jl && which p-initJl"
|
||||||
|
|
||||||
- name: Test Julia launches
|
- name: Test Julia launches
|
||||||
run: |
|
run: |
|
||||||
cd /tmp/test-julia
|
cd "$TEST_JULIA_DIR"
|
||||||
nix develop --command bash -c "p-jl --version"
|
nix develop --command bash -c "p-jl --version"
|
||||||
|
|
||||||
- name: Test Julia can execute code
|
- name: Test Julia can execute code
|
||||||
run: |
|
run: |
|
||||||
cd /tmp/test-julia
|
cd "$TEST_JULIA_DIR"
|
||||||
nix develop --command bash -c "p-jl -e 'println(1+1)'"
|
nix develop --command bash -c "p-jl -e 'println(1+1)'"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue