Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.4.1
17 changes: 17 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,23 @@ jobs:
exit 1
fi
echo "SUCCESS"
- name: Execute with output
id: sample
uses: ./
with:
derivation-path: ./tests/integration_tests
pure: false
run: |-
echo "what=thing" >> "$GITHUB_OUTPUT"
- name: Confirm that output was propagated
shell: bash
run: |-
actual='${{ steps.sample.outputs.what }}'
if [[ "$actual" != 'thing' ]]; then
echo >&2 "The output from \`sample\` was wrong. Wanted \`thing\` but got \`${actual}\`"
exit 1
fi


all_ci_tests:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bazel-*

.direnv
node_modules/
28 changes: 28 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@cgrindel_bazel_starlib//updatesrc:defs.bzl", "updatesrc_diff_and_update")

# exports_files(["flake.lock"])

filegroup(
Expand All @@ -8,3 +10,29 @@ filegroup(
],
visibility = ["//:__subpackages__"],
)

genrule(
name = "dist",
cmd = """
set -euo pipefail
# provide a writable home dir
export HOME="$$(pwd)/NOHOME"
mkdir "$$HOME"
# index.js should not be a symlink
cat index.js > i.js && mv i.js index.js
BUN=$(location @bun//:bin/bun)
$$BUN install --no-save
$$BUN build --target=node --outfile=$@ $(location index.js)
""",
srcs = ["package.json", "bun.lockb", "index.js"],
tags = ["requires-network"],
tools = ["@nodejs//:bin/npm", "@bun//:bin/bun"],
outs = ["generated/bundle.mjs"],
visibility = ["//:__subpackages__"],
)

updatesrc_diff_and_update(
name = "update",
srcs = ["dist/bundle.mjs"],
outs = [":dist"],
)
23 changes: 23 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,26 @@ bazel_dep(
version = "0.18.1",
dev_dependency = True,
)

nix_repo = use_extension("@rules_nixpkgs_core//extensions:repository.bzl", "nix_repo")
nix_repo.file(
name = "nixpkgs",
file = ":nixpkgs.nix",
file_deps = [":flake.lock"],
)
use_repo(nix_repo, "nixpkgs")

nix_pkg = use_extension("@rules_nixpkgs_core//extensions:package.bzl", "nix_pkg")
nix_pkg.attr(
name = "nodejs",
# keep this in sync with action.yaml
attr = "nodejs_20",
repo = "@nixpkgs",
)
use_repo(nix_pkg, "nodejs")

nix_pkg.attr(
attr = "bun",
repo = "@nixpkgs",
)
use_repo(nix_pkg, "bun")
20 changes: 6 additions & 14 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,10 @@ inputs:
description: Enable debug output written to stderr.
default: false

outputs:
outputs:
description: The outputs of the nix-shell-run

runs:
using: composite
steps:
- shell: bash
env:
RNS_CWD: ${{ inputs.working-directory }}
RNS_OPTS: ${{ inputs.options }}
RNS_RUN: ${{ inputs.run }}
RNS_PURE: ${{ inputs.pure }}
RNS_DERIVATION_PATH: ${{ inputs.derivation-path }}
RNS_VERBOSE: ${{ inputs.verbose }}
# If the client specifies an empty string for the flags, we need to set the RNS_SHELL_FLAGS
# env variable to the special value false.
RNS_SHELL_FLAGS: ${{ inputs.shell-flags == '' && 'false' || inputs.shell-flags }}
run: ${GITHUB_ACTION_PATH}/tools/run_nix_shell.sh
using: node20 # keep this in sync with @nodejs in MODULE.bazel
main: dist/bundle.mjs
Binary file added bun.lockb
Binary file not shown.
Loading
Loading