diff --git a/.github/workflows/test-build.yaml b/.github/workflows/test-build.yaml index bfe2ceb7e..132af5360 100644 --- a/.github/workflows/test-build.yaml +++ b/.github/workflows/test-build.yaml @@ -40,6 +40,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable @@ -62,7 +64,9 @@ jobs: - name: Build archive shell: bash run: | - VERSION="${GITHUB_REF#refs/tags/}" + # Get latest version + # https://stackoverflow.com/a/69708418 + VERSION="$(git describe --tags "$(git rev-list --tags --max-count=1)")" if [ "${{ matrix.os }}" = "windows-latest" ]; then ARCHIVE="glistix-$VERSION-${{ matrix.target }}.zip" @@ -105,12 +109,14 @@ jobs: retention-days: 3 build-test-wasm: - name: build-release-wasm + name: build-test-wasm runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install Rust toolchain uses: actions-rs/toolchain@v1 @@ -128,7 +134,9 @@ jobs: - name: Build wasm archive run: | - VERSION="${GITHUB_REF#refs/tags/}" + # Get latest version + # https://stackoverflow.com/a/69708418 + VERSION="$(git describe --tags "$(git rev-list --tags --max-count=1)")" ARCHIVE="glistix-$VERSION-browser.tar.gz" tar -C compiler-wasm/pkg/ -czvf $ARCHIVE . diff --git a/compiler-wasm/src/lib.rs b/compiler-wasm/src/lib.rs index 6702f2d1f..f8a527181 100644 --- a/compiler-wasm/src/lib.rs +++ b/compiler-wasm/src/lib.rs @@ -116,8 +116,10 @@ pub fn compile_package(project_id: usize, target: &str) -> Result<(), String> { let target = match target.to_lowercase().as_str() { "erl" | "erlang" => Target::Erlang, "js" | "javascript" => Target::JavaScript, + "nix" => Target::Nix, _ => { - let msg = format!("Unknown target `{target}`, expected `erlang` or `javascript`"); + let msg = + format!("Unknown target `{target}`, expected `erlang`, `javascript` or `nix`"); return Err(msg); } }; @@ -150,6 +152,17 @@ pub fn read_compiled_erlang(project_id: usize, module_name: &str) -> Option Option { + let fs = get_filesystem(project_id); + let path = format!("/build/{}.nix", module_name); + fs.read(&Utf8PathBuf::from(path)).ok() +} + /// Clear any stored warnings. This is performed automatically when before compilation. /// #[wasm_bindgen]