From c4bfce0adc08e42709e8b02f1e987791bb98f6e9 Mon Sep 17 00:00:00 2001 From: Thanabodee Charoenpiriyakij Date: Mon, 12 May 2025 00:40:48 +0700 Subject: [PATCH 1/4] ci: using Dagger gha module Signed-off-by: Thanabodee Charoenpiriyakij --- .github/.formatter.exs | 5 + .github/.gitattributes | 1 + .github/.gitignore | 9 ++ .github/README.md | 26 ++++ .github/dagger.json | 14 +++ .github/lib/ci.ex | 23 ++++ .github/mix.exs | 25 ++++ .github/mix.lock | 5 + .github/workflows/.gitattributes | 1 + .github/workflows/ci.gen.yml | 207 +++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 18 --- 11 files changed, 316 insertions(+), 18 deletions(-) create mode 100644 .github/.formatter.exs create mode 100644 .github/.gitattributes create mode 100644 .github/.gitignore create mode 100644 .github/README.md create mode 100644 .github/dagger.json create mode 100644 .github/lib/ci.ex create mode 100644 .github/mix.exs create mode 100644 .github/mix.lock create mode 100644 .github/workflows/.gitattributes create mode 100644 .github/workflows/ci.gen.yml delete mode 100644 .github/workflows/test.yaml diff --git a/.github/.formatter.exs b/.github/.formatter.exs new file mode 100644 index 0000000..bf34c42 --- /dev/null +++ b/.github/.formatter.exs @@ -0,0 +1,5 @@ +# Used by "mix format" +[ + import_deps: [:dagger], + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/.github/.gitattributes b/.github/.gitattributes new file mode 100644 index 0000000..7599232 --- /dev/null +++ b/.github/.gitattributes @@ -0,0 +1 @@ +/dagger_sdk/** linguist-generated diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..14a2fd2 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1,9 @@ +/dagger_sdk +/_build +/cover +/deps +/doc +/erl_crash.dump +/*.ez +/template-*.tar +/tmp diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 0000000..aa0df85 --- /dev/null +++ b/.github/README.md @@ -0,0 +1,26 @@ +# Ci + +This is a README for you module. Feel free to edit it. + +## Quickstart + +Once this module is initialized, it can run an example from generated module by: + +``` +$ dagger call container-echo --string-arg=hello stdout +Hello +``` + +## The project structure + +The module is just a regular Elixir application. The structure is looks like: + +``` +. +├── lib +│   └── ci.ex +├── mix.exs +└── README.md +``` + +The `lib` is the Elixir source code while the `ci.ex` is the main Dagger module. diff --git a/.github/dagger.json b/.github/dagger.json new file mode 100644 index 0000000..a7a385c --- /dev/null +++ b/.github/dagger.json @@ -0,0 +1,14 @@ +{ + "name": "ci", + "engineVersion": "v0.18.6", + "sdk": { + "source": "elixir" + }, + "dependencies": [ + { + "name": "gha", + "source": "github.com/dagger/dagger/modules/gha@v0.18.6", + "pin": "48a88b9b11cf606920579d885c1c3d1eeafe9aca" + } + ] +} diff --git a/.github/lib/ci.ex b/.github/lib/ci.ex new file mode 100644 index 0000000..b2fd431 --- /dev/null +++ b/.github/lib/ci.ex @@ -0,0 +1,23 @@ +defmodule Ci do + @moduledoc false + + use Dagger.Mod.Object, name: "Ci" + + defn generate() :: Dagger.Directory.t() do + dag() + |> Dagger.Client.gha() + |> Dagger.Gha.with_workflow(test()) + |> Dagger.Gha.generate() + end + + defp test() do + dag() + |> Dagger.Client.gha() + |> Dagger.Gha.workflow("ci", on_pull_request: true, on_pull_request_branches: ["main"]) + |> Dagger.GhaWorkflow.with_job( + dag() + |> Dagger.Client.gha() + |> Dagger.Gha.job("check", "check") + ) + end +end diff --git a/.github/mix.exs b/.github/mix.exs new file mode 100644 index 0000000..536ac84 --- /dev/null +++ b/.github/mix.exs @@ -0,0 +1,25 @@ +defmodule Template.MixProject do + use Mix.Project + + def project do + [ + app: :ci, + version: "0.1.0", + elixir: "~> 1.17", + start_permanent: Mix.env() == :prod, + deps: deps() + ] + end + + def application do + [ + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:dagger, path: "./dagger_sdk"} + ] + end +end diff --git a/.github/mix.lock b/.github/mix.lock new file mode 100644 index 0000000..dd63d66 --- /dev/null +++ b/.github/mix.lock @@ -0,0 +1,5 @@ +%{ + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "nestru": {:hex, :nestru, "1.0.1", "f02321db91b898da3d598c274f2ccba2c41ec5c50c942eabe900474dbfe4bce3", [:mix], [], "hexpm", "e4fbbd6d64b1c8cb37ef590a891f0b6b17b0b880c1c5ce2ac98de02c0ad7417e"}, + "nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"}, +} diff --git a/.github/workflows/.gitattributes b/.github/workflows/.gitattributes new file mode 100644 index 0000000..da393b8 --- /dev/null +++ b/.github/workflows/.gitattributes @@ -0,0 +1 @@ +*.gen.yml linguist-generated \ No newline at end of file diff --git a/.github/workflows/ci.gen.yml b/.github/workflows/ci.gen.yml new file mode 100644 index 0000000..8ac9bbf --- /dev/null +++ b/.github/workflows/ci.gen.yml @@ -0,0 +1,207 @@ +# This file was generated. See https://daggerverse.dev/mod/github.com/dagger/dagger/modules/gha +name: ci +"on": + pull_request: + branches: + - main + workflow_dispatch: {} +jobs: + check: + runs-on: [] + name: check + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: scripts/install-dagger.sh + id: install-dagger + run: | + #!/bin/bash + + set -o pipefail + # Fallback to /usr/local for backwards compatability + prefix_dir="${RUNNER_TEMP:-/usr/local}" + + # Ensure the dir is writable otherwise fallback to tmpdir + if [[ ! -d "$prefix_dir" ]] || [[ ! -w "$prefix_dir" ]]; then + prefix_dir="$(mktemp -d)" + fi + printf '%s/bin' "$prefix_dir" >>$GITHUB_PATH + + if [ -f "$DAGGER_VERSION_FILE" ]; then + DAGGER_VERSION=$(cat "$DAGGER_VERSION_FILE" | jq -r .engineVersion) + fi + + # If the dagger version is 'latest', set the version back to an empty + # string. This allows the install script to detect and install the latest + # version itself + if [[ "$DAGGER_VERSION" == "latest" ]]; then + DAGGER_VERSION= + fi + + # The install.sh script creates path ${prefix_dir}/bin + curl -fsS https://dl.dagger.io/dagger/install.sh | BIN_DIR=${prefix_dir}/bin DAGGER_VERSION=$DAGGER_VERSION sh + env: + DAGGER_VERSION: "" + shell: bash + - name: scripts/warm-engine.sh + id: warm-engine + run: | + #!/bin/bash + + # Detect if a dev engine is available, if so: use that + # We don't rely on PATH because the GHA runner messes with that + if [[ -n "$_EXPERIMENTAL_DAGGER_CLI_BIN" ]]; then + ls -lh $(dirname $_EXPERIMENTAL_DAGGER_CLI_BIN) + export PATH=$(dirname "$_EXPERIMENTAL_DAGGER_CLI_BIN"):$PATH + fi + if [[ -n "$USE_DEV_ENGINE" ]]; then + # use runner host baked into the cli for dev jobs + unset _EXPERIMENTAL_DAGGER_RUNNER_HOST + fi + + # Run a simple query to "warm up" the engine + dagger version + dagger core version + shell: bash + - name: scripts/exec.sh + id: exec + run: | + #!/bin/bash --noprofile --norc -e -o pipefail + + if [[ -n "$DEBUG" && "$DEBUG" != "0" ]]; then + set -x + env + which dagger + pwd + ls -l + ps aux + fi + + # Detect if a dev engine is available, if so: use that + # We don't rely on PATH because the GHA runner messes with that + if [[ -n "$_EXPERIMENTAL_DAGGER_CLI_BIN" ]]; then + export PATH=$(dirname "$_EXPERIMENTAL_DAGGER_CLI_BIN"):$PATH + fi + # use runner host baked into the cli for dev jobs + if [[ -n "$USE_DEV_ENGINE" ]]; then + unset _EXPERIMENTAL_DAGGER_RUNNER_HOST + fi + + GITHUB_STEP_SUMMARY="${GITHUB_STEP_SUMMARY:=github-summary.md}" + export NO_COLOR="${NO_COLOR:=1}" # Disable colors in dagger logs + + # Ensure the command is provided as an environment variable + if [ -z "$COMMAND" ]; then + echo "Error: Please set the COMMAND environment variable." + exit 1 + fi + + tmp=$(mktemp -d) + ( + cd $tmp + + # Create named pipes (FIFOs) for stdout and stderr + mkfifo stdout.fifo stderr.fifo + + # Set up tee to capture and display stdout and stderr + if [ -n "$NO_OUTPUT" ]; then + tee stdout.txt < stdout.fifo > /dev/null & + tee stderr.txt < stderr.fifo > /dev/null & + else + tee stdout.txt < stdout.fifo & + tee stderr.txt < stderr.fifo >&2 & + fi + ) + + # Append values to .env + if [[ -n "$DOTENV" ]]; then + echo >> .env + echo "$DOTENV" >> .env + fi + + # Run the command, capturing stdout and stderr in the FIFOs + set +e + eval "$COMMAND" > $tmp/stdout.fifo 2> $tmp/stderr.fifo + EXIT_CODE=$? + set -e + # Wait for all background jobs to finish + wait + + # Extra trace URL + TRACE_URL=$(sed -En 's/^Full trace at (.*)/\1/p' < $tmp/stderr.txt) + + { + cat <<'.' + ## Dagger trace + + . + + if [[ "$TRACE_URL" == *"rotate dagger.cloud token for full url"* ]]; then + cat <<. + Cloud token must be rotated. Please follow these steps: + + 1. Go to [Dagger Cloud](https://dagger.cloud) + 2. Click on your profile icon in the bottom left corner + 3. Click on "Organization Settings" + 4. Click on "Regenerate token" + 5. Update the [\`DAGGER_CLOUD_TOKEN\` secret in your GitHub repository settings](https://github.com/${GITHUB_REPOSITORY:?Error: GITHUB_REPOSITORY is not set}/settings/secrets/actions/DAGGER_CLOUD_TOKEN) + . + elif [ -n "$TRACE_URL" ]; then + echo "[$TRACE_URL]($TRACE_URL)" + else + echo "No trace available. To setup: [https://dagger.cloud/traces/setup](https://dagger.cloud/traces/setup)" + fi + + cat <<'.' + + ## Dagger version + + ``` + . + + dagger version + + cat <<'.' + ``` + + ## Pipeline command + + ```bash + . + + echo "DAGGER_MODULE=$DAGGER_MODULE \\" + echo " $COMMAND" + + cat <<'.' + ``` + + ## Pipeline output + + ``` + . + + cat $tmp/stdout.txt + + cat <<'.' + ``` + + ## Pipeline logs + + ``` + . + + tail -n 1000 $tmp/stderr.txt + + cat <<'.' + ``` + . + + } >"${GITHUB_STEP_SUMMARY}" + + echo "stdout_file=$tmp/stdout.txt" >>"$GITHUB_OUTPUT" + echo "stderr_file=$tmp/stderr.txt" >>"$GITHUB_OUTPUT" + + exit $EXIT_CODE + env: + COMMAND: dagger call -q check + shell: bash diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 7dcaab0..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: check - -on: - pull_request: - branches: [main] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: check - uses: dagger/dagger-for-github@v7 - with: - verb: call - args: check From dd7f478ce2e67188bd4bb0443697ee31f25da58c Mon Sep 17 00:00:00 2001 From: Thanabodee Charoenpiriyakij Date: Mon, 12 May 2025 01:20:31 +0700 Subject: [PATCH 2/4] ci: overhaul root module Signed-off-by: Thanabodee Charoenpiriyakij --- .../{dagster_pipes_elixir => }/.formatter.exs | 1 + .dagger/.gitignore | 8 ++++ .dagger/README.md | 3 ++ .dagger/config/config.exs | 3 ++ .dagger/dagster_pipes_elixir/.gitignore | 26 ----------- .dagger/dagster_pipes_elixir/README.md | 3 -- .../test/dagster_pipes_elixir_test.exs | 8 ---- .../dagster_pipes_elixir/test/test_helper.exs | 1 - .../lib/dagster_pipes_elixir.ex | 44 +++++++++++++++---- .dagger/{dagster_pipes_elixir => }/mix.exs | 9 ++-- .dagger/{dagster_pipes_elixir => }/mix.lock | 1 + .github/lib/ci.ex | 4 +- .github/workflows/ci.gen.yml | 6 +-- .gitignore | 1 + dagger.json | 6 ++- 15 files changed, 65 insertions(+), 59 deletions(-) rename .dagger/{dagster_pipes_elixir => }/.formatter.exs (81%) create mode 100644 .dagger/README.md create mode 100644 .dagger/config/config.exs delete mode 100644 .dagger/dagster_pipes_elixir/.gitignore delete mode 100644 .dagger/dagster_pipes_elixir/README.md delete mode 100644 .dagger/dagster_pipes_elixir/test/dagster_pipes_elixir_test.exs delete mode 100644 .dagger/dagster_pipes_elixir/test/test_helper.exs rename .dagger/{dagster_pipes_elixir => }/lib/dagster_pipes_elixir.ex (72%) rename .dagger/{dagster_pipes_elixir => }/mix.exs (61%) rename .dagger/{dagster_pipes_elixir => }/mix.lock (71%) diff --git a/.dagger/dagster_pipes_elixir/.formatter.exs b/.dagger/.formatter.exs similarity index 81% rename from .dagger/dagster_pipes_elixir/.formatter.exs rename to .dagger/.formatter.exs index 7c24ba5..bf34c42 100644 --- a/.dagger/dagster_pipes_elixir/.formatter.exs +++ b/.dagger/.formatter.exs @@ -1,3 +1,4 @@ +# Used by "mix format" [ import_deps: [:dagger], inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] diff --git a/.dagger/.gitignore b/.dagger/.gitignore index eb6e5fc..14a2fd2 100644 --- a/.dagger/.gitignore +++ b/.dagger/.gitignore @@ -1 +1,9 @@ /dagger_sdk +/_build +/cover +/deps +/doc +/erl_crash.dump +/*.ez +/template-*.tar +/tmp diff --git a/.dagger/README.md b/.dagger/README.md new file mode 100644 index 0000000..ae93d1e --- /dev/null +++ b/.dagger/README.md @@ -0,0 +1,3 @@ +# DagsterPipesElixir + +CI/CD for dagster-pipes-elixir. diff --git a/.dagger/config/config.exs b/.dagger/config/config.exs new file mode 100644 index 0000000..6c93c22 --- /dev/null +++ b/.dagger/config/config.exs @@ -0,0 +1,3 @@ +import Config + +config :dagger, client: Dagger.Core.GraphQLClient.Req diff --git a/.dagger/dagster_pipes_elixir/.gitignore b/.dagger/dagster_pipes_elixir/.gitignore deleted file mode 100644 index 4ba2d94..0000000 --- a/.dagger/dagster_pipes_elixir/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -# The directory Mix will write compiled artifacts to. -/_build/ - -# If you run "mix test --cover", coverage assets end up here. -/cover/ - -# The directory Mix downloads your dependencies sources to. -/deps/ - -# Where third-party dependencies like ExDoc output generated docs. -/doc/ - -# Ignore .fetch files in case you like to edit your project deps locally. -/.fetch - -# If the VM crashes, it generates a dump, let's ignore it too. -erl_crash.dump - -# Also ignore archive artifacts (built via "mix archive.build"). -*.ez - -# Ignore package tarball (built via "mix hex.build"). -dagster_pipes_elixir-*.tar - -# Temporary files, for example, from tests. -/tmp/ diff --git a/.dagger/dagster_pipes_elixir/README.md b/.dagger/dagster_pipes_elixir/README.md deleted file mode 100644 index a2e43ec..0000000 --- a/.dagger/dagster_pipes_elixir/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# DagsterPipesElixir - -A CI/CD module for DagsterPipes Elixir. diff --git a/.dagger/dagster_pipes_elixir/test/dagster_pipes_elixir_test.exs b/.dagger/dagster_pipes_elixir/test/dagster_pipes_elixir_test.exs deleted file mode 100644 index b9f93f4..0000000 --- a/.dagger/dagster_pipes_elixir/test/dagster_pipes_elixir_test.exs +++ /dev/null @@ -1,8 +0,0 @@ -defmodule DagsterPipesElixirTest do - use ExUnit.Case - doctest DagsterPipesElixir - - test "greets the world" do - assert DagsterPipesElixir.hello() == :world - end -end diff --git a/.dagger/dagster_pipes_elixir/test/test_helper.exs b/.dagger/dagster_pipes_elixir/test/test_helper.exs deleted file mode 100644 index 869559e..0000000 --- a/.dagger/dagster_pipes_elixir/test/test_helper.exs +++ /dev/null @@ -1 +0,0 @@ -ExUnit.start() diff --git a/.dagger/dagster_pipes_elixir/lib/dagster_pipes_elixir.ex b/.dagger/lib/dagster_pipes_elixir.ex similarity index 72% rename from .dagger/dagster_pipes_elixir/lib/dagster_pipes_elixir.ex rename to .dagger/lib/dagster_pipes_elixir.ex index 439102a..7cdbc09 100644 --- a/.dagger/dagster_pipes_elixir/lib/dagster_pipes_elixir.ex +++ b/.dagger/lib/dagster_pipes_elixir.ex @@ -5,12 +5,39 @@ defmodule DagsterPipesElixir do use Dagger.Mod.Object, name: "DagsterPipesElixir" + object do + field :source, Dagger.Directory.t() + field :container, Dagger.Container.t() + end + + defn init( + source: + {Dagger.Directory.t(), + default_path: ".", + ignore: [ + "**/*", + "!dagster_pipes/mix.exs", + "!dagster_pipes/mix.lock", + "!dagster_pipes/test.sh", + "!dagster_pipes/lib/**/*.ex", + "!dagster_pipes/test/**/*.ex", + "!dagster_pipes/test/test_helper.exs", + "!dagster_pipes/test/test.exs", + "!dagster_pipes/test/**/*_test.exs", + "!integration_tests/pipes.toml", + "!integration_tests/pyproject.toml", + "!integration_tests/uv.lock", + "!integration_tests/tests/**/*.py" + ]} + ) :: DagsterPipesElixir.t() do + %DagsterPipesElixir{source: source, container: elixir() |> with_source(source)} + end + @doc """ Run unit test in `dagster_pipes` project. """ - defn unit_test(source: {Dagger.Directory.t(), default_path: "."}) :: Dagger.Void.t() do - elixir() - |> with_source(source) + defn unit_test(self) :: Dagger.Void.t() do + self.container |> Dagger.Container.with_workdir("dagster_pipes") |> Dagger.Container.with_env_variable("MIX_ENV", "test") |> Dagger.Container.with_exec(~w"mix deps.get") @@ -23,9 +50,8 @@ defmodule DagsterPipesElixir do @doc """ Run integration tests provided by Dagster. """ - defn integration_test(source: {Dagger.Directory.t(), default_path: "."}) :: Dagger.Void.t() do - elixir() - |> with_source(source) + defn integration_test(self) :: Dagger.Void.t() do + self.container |> Dagger.Container.with_workdir("integration_tests") |> Dagger.Container.with_env_variable("PATH", "/root/.local/bin:$PATH", expand: true) |> Dagger.Container.with_env_variable("UV_LINK_MODE", "copy") @@ -36,11 +62,11 @@ defmodule DagsterPipesElixir do |> Dagger.Container.sync() end - defn check(source: {Dagger.Directory.t(), default_path: "."}) :: Dagger.Void.t() do + defn check(self) :: Dagger.Void.t() do results = [ - Task.async(fn -> unit_test(source) end), - Task.async(fn -> integration_test(source) end) + Task.async(fn -> unit_test(self) end), + Task.async(fn -> integration_test(self) end) ] |> Task.await_many(:infinity) diff --git a/.dagger/dagster_pipes_elixir/mix.exs b/.dagger/mix.exs similarity index 61% rename from .dagger/dagster_pipes_elixir/mix.exs rename to .dagger/mix.exs index 67f31fe..b886668 100644 --- a/.dagger/dagster_pipes_elixir/mix.exs +++ b/.dagger/mix.exs @@ -1,11 +1,11 @@ -defmodule DagsterPipesElixir.MixProject do +defmodule Template.MixProject do use Mix.Project def project do [ app: :dagster_pipes_elixir, version: "0.1.0", - elixir: "~> 1.16", + elixir: "~> 1.17", start_permanent: Mix.env() == :prod, deps: deps() ] @@ -13,13 +13,14 @@ defmodule DagsterPipesElixir.MixProject do def application do [ - extra_applications: [:logger], + extra_applications: [:logger] ] end defp deps do [ - {:dagger, path: "../dagger_sdk"} + {:dagger, path: "./dagger_sdk"}, + {:req, "~> 0.5"} ] end end diff --git a/.dagger/dagster_pipes_elixir/mix.lock b/.dagger/mix.lock similarity index 71% rename from .dagger/dagster_pipes_elixir/mix.lock rename to .dagger/mix.lock index 429bf34..dd63d66 100644 --- a/.dagger/dagster_pipes_elixir/mix.lock +++ b/.dagger/mix.lock @@ -1,4 +1,5 @@ %{ "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "nestru": {:hex, :nestru, "1.0.1", "f02321db91b898da3d598c274f2ccba2c41ec5c50c942eabe900474dbfe4bce3", [:mix], [], "hexpm", "e4fbbd6d64b1c8cb37ef590a891f0b6b17b0b880c1c5ce2ac98de02c0ad7417e"}, "nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"}, } diff --git a/.github/lib/ci.ex b/.github/lib/ci.ex index b2fd431..4f6afa8 100644 --- a/.github/lib/ci.ex +++ b/.github/lib/ci.ex @@ -13,11 +13,11 @@ defmodule Ci do defp test() do dag() |> Dagger.Client.gha() - |> Dagger.Gha.workflow("ci", on_pull_request: true, on_pull_request_branches: ["main"]) + |> Dagger.Gha.workflow("ci", on_pull_request: true) |> Dagger.GhaWorkflow.with_job( dag() |> Dagger.Client.gha() - |> Dagger.Gha.job("check", "check") + |> Dagger.Gha.job("check", "init check") ) end end diff --git a/.github/workflows/ci.gen.yml b/.github/workflows/ci.gen.yml index 8ac9bbf..c25d077 100644 --- a/.github/workflows/ci.gen.yml +++ b/.github/workflows/ci.gen.yml @@ -1,9 +1,7 @@ # This file was generated. See https://daggerverse.dev/mod/github.com/dagger/dagger/modules/gha name: ci "on": - pull_request: - branches: - - main + pull_request: {} workflow_dispatch: {} jobs: check: @@ -203,5 +201,5 @@ jobs: exit $EXIT_CODE env: - COMMAND: dagger call -q check + COMMAND: dagger call -q init check shell: bash diff --git a/.gitignore b/.gitignore index 3a038c7..c51ae70 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /.ropeproject .elixir-tools __pycache__ +.lexical diff --git a/dagger.json b/dagger.json index e727ba5..ea71852 100644 --- a/dagger.json +++ b/dagger.json @@ -1,6 +1,8 @@ { "name": "dagster-pipes-elixir", - "engineVersion": "v0.15.2", - "sdk": "elixir", + "engineVersion": "v0.18.6", + "sdk": { + "source": "elixir" + }, "source": ".dagger" } From 76fe1c953633b52f2e419d7e29224ab5b5c2ec25 Mon Sep 17 00:00:00 2001 From: Thanabodee Charoenpiriyakij Date: Mon, 12 May 2025 01:25:12 +0700 Subject: [PATCH 3/4] ci: fix runner is missing Signed-off-by: Thanabodee Charoenpiriyakij --- .github/lib/ci.ex | 4 ++-- .github/workflows/ci.gen.yml | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/lib/ci.ex b/.github/lib/ci.ex index 4f6afa8..b219c90 100644 --- a/.github/lib/ci.ex +++ b/.github/lib/ci.ex @@ -13,11 +13,11 @@ defmodule Ci do defp test() do dag() |> Dagger.Client.gha() - |> Dagger.Gha.workflow("ci", on_pull_request: true) + |> Dagger.Gha.workflow("ci", on_pull_request: true, on_pull_request_branches: ["main"]) |> Dagger.GhaWorkflow.with_job( dag() |> Dagger.Client.gha() - |> Dagger.Gha.job("check", "init check") + |> Dagger.Gha.job("check", "init check", runner: ["ubuntu-latest"]) ) end end diff --git a/.github/workflows/ci.gen.yml b/.github/workflows/ci.gen.yml index c25d077..9e0864f 100644 --- a/.github/workflows/ci.gen.yml +++ b/.github/workflows/ci.gen.yml @@ -1,11 +1,14 @@ # This file was generated. See https://daggerverse.dev/mod/github.com/dagger/dagger/modules/gha name: ci "on": - pull_request: {} + pull_request: + branches: + - main workflow_dispatch: {} jobs: check: - runs-on: [] + runs-on: + - ubuntu-latest name: check steps: - name: Checkout From 476b563d9456659bfad2323030601e43a9b13557 Mon Sep 17 00:00:00 2001 From: Thanabodee Charoenpiriyakij Date: Mon, 12 May 2025 01:42:09 +0700 Subject: [PATCH 4/4] ci: add dagger cloud token Signed-off-by: Thanabodee Charoenpiriyakij --- .github/lib/ci.ex | 5 ++++- .github/workflows/ci.gen.yml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/lib/ci.ex b/.github/lib/ci.ex index b219c90..237ca9e 100644 --- a/.github/lib/ci.ex +++ b/.github/lib/ci.ex @@ -17,7 +17,10 @@ defmodule Ci do |> Dagger.GhaWorkflow.with_job( dag() |> Dagger.Client.gha() - |> Dagger.Gha.job("check", "init check", runner: ["ubuntu-latest"]) + |> Dagger.Gha.job("check", "init check", + runner: ["ubuntu-latest"], + secrets: ["DAGGER_CLOUD_TOKEN"] + ) ) end end diff --git a/.github/workflows/ci.gen.yml b/.github/workflows/ci.gen.yml index 9e0864f..5bdfb28 100644 --- a/.github/workflows/ci.gen.yml +++ b/.github/workflows/ci.gen.yml @@ -205,4 +205,5 @@ jobs: exit $EXIT_CODE env: COMMAND: dagger call -q init check + DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }} shell: bash