Skip to content

Commit bc4cecb

Browse files
feat(ci): add test-omnix-template job
Signed-off-by: Cameron Smith <cameron.ray.smith@gmail.com>
1 parent c3d2a1d commit bc4cecb

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,78 @@ jobs:
164164
run: |
165165
nix run github:srid/nixci -- build
166166
167+
test-omnix-template:
168+
needs: [set-variables, nixci]
169+
if: ${{ needs.set-variables.outputs.skip_ci != 'true' }}
170+
runs-on: ubuntu-latest
171+
concurrency:
172+
group: test-omnix-template-${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref_name }}
173+
cancel-in-progress: true
174+
steps:
175+
- name: Install dependencies
176+
shell: bash
177+
run: |
178+
sudo apt-get update
179+
sudo apt-get install -yq zstd
180+
sudo apt-get clean
181+
182+
- name: Install Nix
183+
uses: DeterminateSystems/nix-installer-action@a48face58194521af687ce7df4c802b1b558e743 # ratchet:DeterminateSystems/nix-installer-action@main
184+
with:
185+
extra-conf: "system-features = nixos-test benchmark big-parallel kvm"
186+
187+
- name: Setup remote cache
188+
uses: cachix/cachix-action@be5295a636153b6ad194d3245f78f8e0b78dc704 # ratchet:cachix/cachix-action@master
189+
continue-on-error: true
190+
with:
191+
name: "${{ vars.CACHIX_CACHE_NAME }}"
192+
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
193+
extraPullNames: nix-community,pyproject-nix,sciexp,srid
194+
195+
- name: Setup tmate debug session
196+
uses: mxschmitt/action-tmate@e5c7151931ca95bad1c6f4190c730ecf8c7dde48 # ratchet:mxschmitt/action-tmate@v3
197+
if: ${{ needs.set-variables.outputs.debug == 'true' }}
198+
199+
- name: Install omnix
200+
run: nix --accept-flake-config profile install "github:juspay/omnix"
201+
202+
- name: Test template initialization
203+
run: |
204+
# Determine the correct repository reference
205+
REPO_REF="github:sciexp/python-nix-template/${{ needs.set-variables.outputs.checkout_rev }}"
206+
echo "Using repository reference: $REPO_REF"
207+
208+
# Clean any existing test directory
209+
rm -fr pnt-new
210+
211+
# Initialize the template
212+
nix --accept-flake-config run github:juspay/omnix -- init "$REPO_REF" -o pnt-new --non-interactive --params '{
213+
"package-name-kebab-case": "pnt-new",
214+
"package-name-snake-case": "pnt_new",
215+
"include-functional-package": false,
216+
"git-org": "pnt-new",
217+
"author": "Pnt New",
218+
"author-email": "new@pnt.org",
219+
"include-vscode": true,
220+
"include-github-ci": true,
221+
"include-flake-template": false
222+
}'
223+
224+
# Set up the new project
225+
cd pnt-new
226+
git init
227+
git config --local user.email "test@example.com"
228+
git config --local user.name "Test User"
229+
git commit --allow-empty -m "initial commit (empty)"
230+
git add .
231+
232+
# Fix template names and set up environment
233+
nix run .#fix-template-names -- python-nix-template
234+
uv lock
235+
236+
# Test that the project tests pass
237+
nix develop -c pytest
238+
167239
test-python:
168240
needs: [set-variables]
169241
if: ${{ needs.set-variables.outputs.skip_ci != 'true' && needs.set-variables.outputs.skip_tests != 'true' }}

0 commit comments

Comments
 (0)