diff --git a/.github/workflows/build_ruby.yml b/.github/workflows/build_ruby.yml index ef26f63..ddb117b 100644 --- a/.github/workflows/build_ruby.yml +++ b/.github/workflows/build_ruby.yml @@ -47,7 +47,12 @@ jobs: - name: Output CHANGELOG run: cargo run --bin ruby_changelog -- --version "${{inputs.ruby_version}}" - name: Build Ruby - run: cargo run --bin ruby_build -- --version ${{inputs.ruby_version}} --base-image ${{matrix.base_image}} --arch ${{matrix.arch}} + run: cargo run --bin ruby_build -- --version ${{inputs.ruby_version}} --base-image ${{matrix.base_image}} --arch ${{matrix.arch}} --inventory "${{ matrix.base_image }}{{ matrix.arch }}-inventory.toml" + - name: Store inventory + id: store_inventory + run: | + echo "${{ matrix.base_image }}{{ matrix.arch }}=" > $GITHUB_OUTPUT + cat "${{ matrix.base_image }}{{ matrix.arch }}-inventory.toml | jq -r . >> $GITHUB_OUTPUT" - name: Check Ruby run: cargo run --bin ruby_check -- --version ${{inputs.ruby_version}} --base-image ${{matrix.base_image}} --arch ${{matrix.arch}} | tee $GITHUB_STEP_SUMMARY - name: Upload Ruby runtime archive to S3 dry run diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37d07fd..7cd6aa9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,3 +121,31 @@ jobs: git diff --unified=0 remotes/origin/${{ github.base_ref }} ${{matrix.inventory}} | grep '^+' | grep -v '^+++' | cut -c2- > check_inventory.toml - name: Check manifest URLs run: cargo run --bin inventory_check -- check_inventory.toml + + test-dependent-job: + runs-on: ubuntu-24.04 + strategy: + matrix: + arch: ["amd64", "arm64"] + base_image: ["heroku-20", "heroku-22", "heroku-24"] + steps: + - name: Store inventory + id: store_inventory + run: | + echo "${{ matrix.base_image }}${{ matrix.arch }}=" > $GITHUB_OUTPUT + cat "${{ matrix.base_image }}${{ matrix.arch }}-inventory.toml | jq -r . >> $GITHUB_OUTPUT" + + after-test-dependent-job: + runs-on: ubuntu-24.04 + needs: test-dependent-job + steps: + - name: Output GITHUB_OUTPUT + run: echo ${{needs.test-dependent-job.outputs}} + - name: Combine results + run: | + echo "Combining results..." + for key in $(jq -r 'keys[]' <<< "${{ toJson(needs.test-dependent-job.outputs) }}"); do + value=$(jq -r --arg key "$key" '.[$key]' <<< "${{ toJson(needs.test-dependent-job.outputs) }}") + echo "$value" >> combined.txt + echo "" >> combined.txt + done diff --git a/ruby_executable/src/bin/ruby_build.rs b/ruby_executable/src/bin/ruby_build.rs index 359e905..6134420 100644 --- a/ruby_executable/src/bin/ruby_build.rs +++ b/ruby_executable/src/bin/ruby_build.rs @@ -34,6 +34,9 @@ struct RubyArgs { #[arg(long = "base-image")] base_image: BaseImage, + + #[arg(long = "inventory", default_value = "ruby_inventory.yml")] + inventory: PathBuf, } fn ruby_dockerfile_contents(base_image: &BaseImage) -> String { @@ -62,10 +65,16 @@ fn ruby_build(args: &RubyArgs) -> Result<(), Box> { arch, version, base_image, + inventory, } = args; let mut log = Print::new(std::io::stderr()).h1("Building Ruby"); - let inventory = source_dir().join("ruby_inventory.toml"); + + let inventory = if inventory.is_absolute() { + inventory.clone() + } else { + source_dir().join(inventory) + }; let volume_cache_dir = source_dir().join("cache"); let volume_output_dir = source_dir().join("output"); diff --git a/shared/src/bin/inventory_update.rs b/shared/src/bin/inventory_update.rs new file mode 100644 index 0000000..6758d4a --- /dev/null +++ b/shared/src/bin/inventory_update.rs @@ -0,0 +1,5 @@ +//! A CLI to combine two inventory files on disk with + +// cargo run --bin inventory_update -- --update path/to/file --with path/to/other/file + +fn main() {}