Fix Nix workflow bootstrap

Co-authored-by: dichhead <330471626+dichhead@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]anddichhead authored and GitHub committed 2026-09-19 13:51:13 +00:00
1 parent 9a926badf6
commit 840f8fc957
4 files changed
+42 -46

No files matched your search

+7 -16
View File
@@ -23,41 +23,32 @@ jobs:
rust: rust:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
defaults:
run:
shell: 'nix develop --command bash --noprofile --norc -euo pipefail {0}'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./.github/actions/setup-nix - uses: ./.github/actions/setup-nix
- name: Check formatting - name: Check formatting
run: cargo fmt --all --check run: nix develop --command cargo fmt --all --check
- name: Run clippy - name: Run clippy
run: cargo clippy --locked --workspace --all-targets -- -D warnings run: nix develop --command cargo clippy --locked --workspace --all-targets -- -D warnings
- name: Run library tests - name: Run library tests
run: cargo test --locked --workspace --lib run: nix develop --command cargo test --locked --workspace --lib
web: web:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
defaults:
run:
shell: 'nix develop --command bash --noprofile --norc -euo pipefail {0}'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./.github/actions/setup-nix - uses: ./.github/actions/setup-nix
- name: Build web bundle - name: Build web bundle
run: trunk build --locked --release --public-url /app/ --dist dist/app --html-output index.html web-app.html run: nix develop --command trunk build --locked --release --public-url /app/ --dist dist/app --html-output index.html web-app.html
- name: Validate website assembly - name: Validate website assembly
run: python3 scripts/test_site.py run: nix develop --command python3 scripts/test_site.py
- name: Validate locale lookups - name: Validate locale lookups
run: python3 scripts/test_locales.py run: nix develop --command python3 scripts/test_locales.py
release-automation: release-automation:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
defaults:
run:
shell: 'nix develop --command bash --noprofile --norc -euo pipefail {0}'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./.github/actions/setup-nix - uses: ./.github/actions/setup-nix
- name: Test release automation - name: Test release automation
run: python3 scripts/test_release.py run: nix develop --command python3 scripts/test_release.py
+14 -11
View File
@@ -33,9 +33,6 @@ concurrency:
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
defaults:
run:
shell: 'nix develop --command bash --noprofile --norc -euo pipefail {0}'
outputs: outputs:
tag: ${{ steps.source.outputs.tag }} tag: ${{ steps.source.outputs.tag }}
commit: ${{ steps.source.outputs.commit }} commit: ${{ steps.source.outputs.commit }}
@@ -80,6 +77,7 @@ jobs:
env: env:
RELEASE_TAG: ${{ steps.source.outputs.tag }} RELEASE_TAG: ${{ steps.source.outputs.tag }}
run: | run: |
nix develop --command bash --noprofile --norc -euo pipefail <<'EOF'
git merge-base --is-ancestor "$RELEASE_TAG" HEAD git merge-base --is-ancestor "$RELEASE_TAG" HEAD
if [ -f scripts/release.py ]; then if [ -f scripts/release.py ]; then
python3 scripts/release.py versions --tag "$RELEASE_TAG" python3 scripts/release.py versions --tag "$RELEASE_TAG"
@@ -87,9 +85,10 @@ jobs:
VERSION=$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -1) VERSION=$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -1)
test "v$VERSION" = "$RELEASE_TAG" test "v$VERSION" = "$RELEASE_TAG"
fi fi
EOF
- name: Build web bundle - name: Build web bundle
run: trunk build --locked --release --public-url /app/ --dist dist/app --html-output index.html web-app.html run: nix develop --command trunk build --locked --release --public-url /app/ --dist dist/app --html-output index.html web-app.html
- name: Check out current website - name: Check out current website
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -99,27 +98,29 @@ jobs:
- name: Validate website - name: Validate website
working-directory: website working-directory: website
run: python3 scripts/test_site.py run: nix develop --command python3 scripts/test_site.py
- name: Assemble landing page - name: Assemble landing page
working-directory: website working-directory: website
run: sh scripts/assemble-site.sh "$GITHUB_WORKSPACE/dist" run: nix develop --command sh scripts/assemble-site.sh "$GITHUB_WORKSPACE/dist"
- name: Record website source - name: Record website source
working-directory: website working-directory: website
run: git rev-parse HEAD > "$GITHUB_WORKSPACE/dist/site-version.txt" run: nix develop --command bash --noprofile --norc -euo pipefail -c 'git rev-parse HEAD > "$GITHUB_WORKSPACE/dist/site-version.txt"'
- name: Record release version and source - name: Record release version and source
env: env:
RELEASE_TAG: ${{ steps.source.outputs.tag }} RELEASE_TAG: ${{ steps.source.outputs.tag }}
RELEASE_COMMIT: ${{ steps.source.outputs.commit }} RELEASE_COMMIT: ${{ steps.source.outputs.commit }}
run: | run: |
nix develop --command bash --noprofile --norc -euo pipefail <<'EOF'
jq -n --arg version "${RELEASE_TAG#v}" --arg commit "$RELEASE_COMMIT" \ jq -n --arg version "${RELEASE_TAG#v}" --arg commit "$RELEASE_COMMIT" \
'{version: $version, commit: $commit}' > dist/app/release.json '{version: $version, commit: $commit}' > dist/app/release.json
EOF
# GitHub Pages runs Jekyll, which ignores files; opt out so the # GitHub Pages runs Jekyll, which ignores files; opt out so the
# wasm-bindgen output is served verbatim. # wasm-bindgen output is served verbatim.
- run: touch dist/.nojekyll - run: nix develop --command touch dist/.nojekyll
# The web app can't call the Patreon API directly (CORS + the token would # The web app can't call the Patreon API directly (CORS + the token would
# be exposed in the bundle), so generate the supporters list server-side # be exposed in the bundle), so generate the supporters list server-side
@@ -129,7 +130,7 @@ jobs:
env: env:
OCS_PATREON_TOKEN: ${{ secrets.OCS_PATREON_TOKEN }} OCS_PATREON_TOKEN: ${{ secrets.OCS_PATREON_TOKEN }}
run: | run: |
python3 - <<'PY' nix develop --command python3 - <<'PY'
import json import json
import os import os
import urllib.parse import urllib.parse
@@ -243,7 +244,7 @@ jobs:
- name: Generate project growth charts - name: Generate project growth charts
env: env:
GITHUB_TOKEN: ${{ secrets.OCS_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.OCS_GITHUB_TOKEN }}
run: python3 website/scripts/generate-star-history.py --output-dir dist run: nix develop --command python3 website/scripts/generate-star-history.py --output-dir dist
# Browsers cannot reliably fetch YouTube playlist/oEmbed responses because # Browsers cannot reliably fetch YouTube playlist/oEmbed responses because
# of CORS. Build a same-origin listing and thumbnail directory for the # of CORS. Build a same-origin listing and thumbnail directory for the
@@ -251,7 +252,7 @@ jobs:
# unavailable during deployment. # unavailable during deployment.
- name: Generate videos.json - name: Generate videos.json
run: | run: |
python3 - <<'PY' nix develop --command python3 - <<'PY'
import json import json
import re import re
import shutil import shutil
@@ -314,6 +315,7 @@ jobs:
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
run: | run: |
nix develop --command bash --noprofile --norc -euo pipefail <<'EOF'
QUERY=' QUERY='
query($owner: String!, $name: String!) { query($owner: String!, $name: String!) {
repository(owner: $owner, name: $name) { repository(owner: $owner, name: $name) {
@@ -358,6 +360,7 @@ jobs:
})' \ })' \
> dist/app/discussions.json > dist/app/discussions.json
echo "discussions: $(jq 'length' dist/app/discussions.json)" echo "discussions: $(jq 'length' dist/app/discussions.json)"
EOF
- uses: actions/upload-pages-artifact@v3 - uses: actions/upload-pages-artifact@v3
with: with:
+18 -15
View File
@@ -33,9 +33,6 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
permissions: permissions:
contents: write contents: write
defaults:
run:
shell: 'nix develop --command bash --noprofile --norc -euo pipefail {0}'
steps: steps:
- name: Checkout - name: Checkout
@@ -50,15 +47,16 @@ jobs:
- name: Validate package versions - name: Validate package versions
id: version id: version
run: python3 scripts/release.py versions --tag "$RELEASE_TAG" run: nix develop --command python3 scripts/release.py versions --tag "$RELEASE_TAG"
- name: Build - name: Build
env: env:
OCS_PATREON_TOKEN: ${{ secrets.OCS_PATREON_TOKEN }} OCS_PATREON_TOKEN: ${{ secrets.OCS_PATREON_TOKEN }}
run: cargo build --locked --release run: nix develop --command cargo build --locked --release
- name: Prepare AppDir - name: Prepare AppDir
run: | run: |
nix develop --command bash --noprofile --norc -euo pipefail <<'EOF'
mkdir -p AppDir/usr/bin mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/share/applications mkdir -p AppDir/usr/share/applications
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
@@ -68,9 +66,10 @@ jobs:
cp packaging/io.github.HakanSeven12.OpenCadStudio.metainfo.xml AppDir/usr/share/metainfo/ cp packaging/io.github.HakanSeven12.OpenCadStudio.metainfo.xml AppDir/usr/share/metainfo/
rsvg-convert -w 256 -h 256 assets/logo.svg \ rsvg-convert -w 256 -h 256 assets/logo.svg \
-o AppDir/usr/share/icons/hicolor/256x256/apps/io.github.HakanSeven12.OpenCadStudio.png -o AppDir/usr/share/icons/hicolor/256x256/apps/io.github.HakanSeven12.OpenCadStudio.png
EOF
- name: Pack shared Linux payload - name: Pack shared Linux payload
run: tar -C AppDir -czf linux-payload.tar.gz usr run: nix develop --command tar -C AppDir -czf linux-payload.tar.gz usr
- name: Upload shared Linux payload - name: Upload shared Linux payload
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@@ -82,28 +81,34 @@ jobs:
- name: Download linuxdeploy - name: Download linuxdeploy
run: | run: |
nix develop --command bash --noprofile --norc -euo pipefail <<'EOF'
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage chmod +x linuxdeploy-x86_64.AppImage
EOF
- name: Build AppImage - name: Build AppImage
env: env:
APPIMAGE_EXTRACT_AND_RUN: 1 APPIMAGE_EXTRACT_AND_RUN: 1
run: | run: |
nix develop --command bash --noprofile --norc -euo pipefail <<'EOF'
./linuxdeploy-x86_64.AppImage \ ./linuxdeploy-x86_64.AppImage \
--appdir AppDir \ --appdir AppDir \
--desktop-file AppDir/usr/share/applications/io.github.HakanSeven12.OpenCadStudio.desktop \ --desktop-file AppDir/usr/share/applications/io.github.HakanSeven12.OpenCadStudio.desktop \
--icon-file AppDir/usr/share/icons/hicolor/256x256/apps/io.github.HakanSeven12.OpenCadStudio.png \ --icon-file AppDir/usr/share/icons/hicolor/256x256/apps/io.github.HakanSeven12.OpenCadStudio.png \
--output appimage --output appimage
mv Open*CAD*Studio*.AppImage OpenCADStudio.AppImage mv Open*CAD*Studio*.AppImage OpenCADStudio.AppImage
EOF
- name: Upload AppImage to release - name: Upload AppImage to release
if: env.RELEASE_TAG != '' if: env.RELEASE_TAG != ''
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
nix develop --command bash --noprofile --norc -euo pipefail <<'EOF'
ASSET=OpenCADStudio-${{ env.RELEASE_TAG }}-linux-x86_64.AppImage ASSET=OpenCADStudio-${{ env.RELEASE_TAG }}-linux-x86_64.AppImage
mv OpenCADStudio.AppImage "$ASSET" mv OpenCADStudio.AppImage "$ASSET"
gh release upload ${{ env.RELEASE_TAG }} "$ASSET" --clobber --repo ${{ github.repository }} gh release upload ${{ env.RELEASE_TAG }} "$ASSET" --clobber --repo ${{ github.repository }}
EOF
build-snap: build-snap:
needs: build-appimage needs: build-appimage
@@ -115,9 +120,6 @@ jobs:
permissions: permissions:
actions: read actions: read
contents: write contents: write
defaults:
run:
shell: 'nix develop --command bash --noprofile --norc -euo pipefail {0}'
env: env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
@@ -134,7 +136,7 @@ jobs:
- name: Validate package versions - name: Validate package versions
id: version id: version
run: python3 scripts/release.py versions --tag "$RELEASE_TAG" run: nix develop --command python3 scripts/release.py versions --tag "$RELEASE_TAG"
- name: Download shared Linux payload - name: Download shared Linux payload
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@@ -147,8 +149,10 @@ jobs:
env: env:
VERSION: ${{ steps.version.outputs.version }} VERSION: ${{ steps.version.outputs.version }}
run: | run: |
nix develop --command bash --noprofile --norc -euo pipefail <<'EOF'
sed -i "s/^version: .*/version: '$VERSION'/" snap/snapcraft.yaml sed -i "s/^version: .*/version: '$VERSION'/" snap/snapcraft.yaml
echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "version=$VERSION" >> "$GITHUB_OUTPUT"
EOF
- name: Build snap - name: Build snap
id: snapcraft id: snapcraft
@@ -160,16 +164,18 @@ jobs:
SNAP: ${{ steps.snapcraft.outputs.snap }} SNAP: ${{ steps.snapcraft.outputs.snap }}
VERSION: ${{ steps.package.outputs.version }} VERSION: ${{ steps.package.outputs.version }}
run: | run: |
nix develop --command bash --noprofile --norc -euo pipefail <<'EOF'
PACKAGE="OpenCADStudio-v${VERSION}-linux-x86_64.snap" PACKAGE="OpenCADStudio-v${VERSION}-linux-x86_64.snap"
mv "$SNAP" "$PACKAGE" mv "$SNAP" "$PACKAGE"
echo "snap=$PACKAGE" >> "$GITHUB_OUTPUT" echo "snap=$PACKAGE" >> "$GITHUB_OUTPUT"
EOF
- name: Upload snap to release - name: Upload snap to release
if: env.RELEASE_TAG != '' if: env.RELEASE_TAG != ''
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SNAP: ${{ steps.snap_package.outputs.snap }} SNAP: ${{ steps.snap_package.outputs.snap }}
run: gh release upload "${{ env.RELEASE_TAG }}" "$SNAP" --clobber run: nix develop --command gh release upload "${{ env.RELEASE_TAG }}" "$SNAP" --clobber
- name: Upload snap as workflow artifact - name: Upload snap as workflow artifact
if: env.RELEASE_TAG == '' if: env.RELEASE_TAG == ''
@@ -539,9 +545,6 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
permissions: permissions:
contents: read contents: read
defaults:
run:
shell: 'nix develop --command bash --noprofile --norc -euo pipefail {0}'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@@ -550,4 +553,4 @@ jobs:
- name: Verify native release assets and notes - name: Verify native release assets and notes
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
run: python3 scripts/release.py verify-native --tag "$RELEASE_TAG" run: nix develop --command python3 scripts/release.py verify-native --tag "$RELEASE_TAG"
+3 -4
View File
@@ -25,9 +25,6 @@ jobs:
prepare: prepare:
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
defaults:
run:
shell: 'nix develop --command bash --noprofile --norc -euo pipefail {0}'
outputs: outputs:
ready: ${{ steps.release.outputs.ready }} ready: ${{ steps.release.outputs.ready }}
tag: ${{ steps.release.outputs.tag }} tag: ${{ steps.release.outputs.tag }}
@@ -39,18 +36,20 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- uses: ./.github/actions/setup-nix - uses: ./.github/actions/setup-nix
- name: Validate release automation - name: Validate release automation
run: python3 scripts/test_release.py run: nix develop --command python3 scripts/test_release.py
- name: Prepare release and verify published notes - name: Prepare release and verify published notes
id: release id: release
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
PUBLISH: ${{ github.event_name == 'schedule' || inputs.publish }} PUBLISH: ${{ github.event_name == 'schedule' || inputs.publish }}
run: | run: |
nix develop --command bash --noprofile --norc -euo pipefail <<'EOF'
if [ "$PUBLISH" = true ]; then if [ "$PUBLISH" = true ]; then
python3 scripts/release.py prepare --publish python3 scripts/release.py prepare --publish
else else
python3 scripts/release.py prepare python3 scripts/release.py prepare
fi fi
EOF
# GITHUB_TOKEN releases do not trigger release events, so call both builds. # GITHUB_TOKEN releases do not trigger release events, so call both builds.
web: web: