diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..7c3e064 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,70 @@ +# Simple workflow for running tests on all branches and deploying only from main +name: Test and Deploy to GitHub Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: + - "**" # Match all branches + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + # Job to run tests before deploying + test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "npm" + - name: Install dependencies + run: npm ci + - name: Run tests + run: npm run test + + # Deploy job, only runs if tests pass + deploy: + needs: test # Ensures tests pass before deploying + if: github.ref == 'refs/heads/main' # Deploy only from main + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "npm" + - name: Install dependencies + run: npm ci + - name: Build + run: npm run build + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload dist folder + path: "./dist" + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/src/simulation/SimulationCanvas.tsx b/src/simulation/SimulationCanvas.tsx index cc57b79..1b09f2b 100644 --- a/src/simulation/SimulationCanvas.tsx +++ b/src/simulation/SimulationCanvas.tsx @@ -118,7 +118,7 @@ fn fs_main(@builtin(position) fragCoord: vec4) -> @location(0) vec4 { const extraSymbols = [60, 62, 123, 125, 43, 45, 44, 46, 91, 93]; for (let i = 0; i < props.dimensions ** 2; i++) for (let j = 0; j < tapeLength; j++) { - // if (Math.random() < 0.8) continue; + if (Math.random() < 0.8) continue; const randomIndex = Math.floor(Math.random() * tapeLength); initialTape[i * tapeLength + randomIndex] = extraSymbols[Math.floor(Math.random() * extraSymbols.length)]; diff --git a/vite.config.ts b/vite.config.ts index 9ff59a1..e8e4644 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,12 +1,13 @@ -import { defineConfig } from 'vite'; -import solidPlugin from 'vite-plugin-solid'; +import { defineConfig } from "vite"; +import solidPlugin from "vite-plugin-solid"; export default defineConfig({ + base: "/webgpu-self-replicating-programs/", plugins: [solidPlugin()], server: { port: 3000, }, build: { - target: 'esnext', + target: "esnext", }, });