diff --git a/.github/workflows/run-wasm.yml b/.github/workflows/run-wasm.yml index 26437a1..781bfe6 100644 --- a/.github/workflows/run-wasm.yml +++ b/.github/workflows/run-wasm.yml @@ -2,22 +2,38 @@ name: Run WASM Script on: push: - branches: [ main ] + branches: [ add-github-action ] pull_request: - branches: [ main ] + branches: [ add-github-action ] jobs: run-wasm: runs-on: ubuntu-latest - container: - image: nixos/nix:latest steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + - uses: actions/checkout@v4 - - name: Enable flakes - run: | - mkdir -p ~/.config/nix - echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf + - name: Install Nix + uses: cachix/install-nix-action@v24 + with: + extra_nix_config: | + experimental-features = nix-command flakes + + - name: Cache Nix store + uses: nix-community/cache-nix-action@v5 + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}- - name: Run script in flake environment run: | diff --git a/.gitignore b/.gitignore index 0483491..c33954f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ dist-newstyle/ -flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e113f9d --- /dev/null +++ b/flake.lock @@ -0,0 +1,131 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "ghc-wasm-meta": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "host": "gitlab.haskell.org", + "lastModified": 1769511593, + "narHash": "sha256-zHh+dPvGHX6ZIk5XQm20y2Qg31tXeqX5REe06pBvMiU=", + "owner": "haskell-wasm", + "repo": "ghc-wasm-meta", + "rev": "e950d94ea9a091d64ee38ff735e52d46191e76af", + "type": "gitlab" + }, + "original": { + "host": "gitlab.haskell.org", + "owner": "haskell-wasm", + "repo": "ghc-wasm-meta", + "type": "gitlab" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1769318308, + "narHash": "sha256-Mjx6p96Pkefks3+aA+72lu1xVehb6mv2yTUUqmSet6Q=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1cd347bf3355fce6c64ab37d3967b4a2cb4b878c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1769707876, + "narHash": "sha256-gwGTs9ROMNco2z7lbg80RsyqocyFPM4kNlnpPrTCdvY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "70cd18d925af5d6de5ef6d300dd2a2d88ee4d084", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "ghc-wasm-meta": "ghc-wasm-meta", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/run-wasm.sh b/run-wasm.sh index 2fde28c..7f05795 100755 --- a/run-wasm.sh +++ b/run-wasm.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +wasm32-wasi-cabal update wasm32-wasi-cabal build all wasmtime --wasm exceptions $(find dist-newstyle/build/wasm32-wasi -name "minimal-example.wasm" -type f | head -n 1)