diff --git a/.rwx/build-tasks.mjs b/.rwx/build-tasks.mjs deleted file mode 100644 index 8a8c3ff6..00000000 --- a/.rwx/build-tasks.mjs +++ /dev/null @@ -1,312 +0,0 @@ -import { glob } from "glob"; -import fs from "fs/promises"; -import path from "path"; -import yaml from "yaml"; - -const BUILD_DIR = process.env.BUILD_DIR; -const GIT_DIFF_FILE = process.env.GIT_DIFF_FILE; -const RWX_DYNAMIC_TASKS = process.env.RWX_DYNAMIC_TASKS; - -if (!BUILD_DIR || !GIT_DIFF_FILE || !RWX_DYNAMIC_TASKS) { - console.error("Must set BUILD_DIR and GIT_DIFF_FILE and RWX_DYNAMIC_TASKS"); - process.exit(1); -} - -let packages = []; -const leafDirs = new Set(); -const leavesToBuild = new Set(); -const DEFAULT_BASE_LAYER = { - image: "ubuntu:24.04", - config: "rwx/base 1.0.0", - arch: "x86_64", -}; - -async function exists(pathname) { - try { - await fs.stat(pathname); - return true; - } catch { - return false; - } -} - -for (const file of (await glob("*/*/rwx-package.yml")).sort()) { - const name = path.dirname(file); - const key = name.replace("/", "-"); - let buildDependencies = []; - if (await exists(path.join(name, "build/dependencies.yml"))) { - buildDependencies = yaml.parse( - await fs.readFile(path.join(name, "build/dependencies.yml"), { - encoding: "utf8", - }), - ); - } - - let config; - if (await exists(path.join(name, "rwx-ci-cd.config.yml"))) { - config = yaml.parse( - await fs.readFile(path.join(name, "rwx-ci-cd.config.yml"), { - encoding: "utf8", - }), - ); - } - - packages.push({ - name, - key, - dir: name, - artifactFile: `${BUILD_DIR}/${key}.yml`, - buildDependencies, - config, - }); - leafDirs.add(name); -} - -let buildAll = false; -const filesNotToTriggerBuildAll = ["cspell.yaml"]; - -for (const line of (await fs.readFile(GIT_DIFF_FILE, "utf8")).split("\n")) { - if (line === "") { - continue; - } - - const foundNonLeafFile = () => { - console.log(`Found non-leaf file in diff: ${line}`); - buildAll = true; - }; - - if (line.split("/").length >= 2) { - const leafName = line.split("/").slice(0, 2).join("/"); - if (leafDirs.has(leafName)) { - leavesToBuild.add(leafName); - } else { - foundNonLeafFile(); - break; - } - } else { - if (filesNotToTriggerBuildAll.includes(line)) { - continue; - } else { - foundNonLeafFile(); - break; - } - } -} - -if (buildAll) { - console.log("Building all packages"); -} else { - console.log("Only building packages with changes:"); - leavesToBuild.forEach((leaf) => console.log(leaf)); - - packages = packages.filter((leaf) => leavesToBuild.has(leaf.name)); -} - -const stringifyBase = (base) => - `${base.image}-${base.arch}`.replaceAll(/[^a-zA-Z0-9-]/g, "-"); - -const generateTestsTask = async (leaf) => { - const artifacts = []; - const leafBuildDir = `${BUILD_DIR}/${leaf.key}`; - - let leafTestTasks = []; - const commands = []; - const testConfigs = leaf.config?.tests ?? []; - if ( - testConfigs.length === 0 && - (await exists(path.join(leaf.dir, "rwx-ci-cd.template.yml"))) - ) { - testConfigs.push({ - key: stringifyBase(DEFAULT_BASE_LAYER), - template: "rwx-ci-cd.template.yml", - base: DEFAULT_BASE_LAYER, - }); - } - - for (const testConfig of testConfigs) { - const outputPath = path.join(leafBuildDir, `${testConfig.key}.yml`); - - // Generate an embedded run file artifact. - commands.push(`cat <<'EOF' > "${outputPath}"`); - if (testConfig.base) { - commands.push(yaml.stringify({ base: testConfig.base }, null, 2)); - } - commands.push( - yaml.stringify({ - "tool-cache": { - vault: "rwx-packages-main", - }, - }), - ); - commands.push(`tasks:`); - commands.push(`EOF`); - commands.push( - `envsubst '$LEAF_DIGEST' < "${path.join(leaf.dir, testConfig.template)}" | sed -e 's/^/ /' | tee -a "${outputPath}"`, - ); - - artifacts.push({ - key: testConfig.key, - path: outputPath, - }); - - // Add the embedded run to the package's test tasks. - commands.push(`cat <<'EOF' >> "$RWX_DYNAMIC_TASKS/${leaf.key}.yml"`); - commands.push(`- key: test-${testConfig.key}`); - commands.push( - ` call: \\\${{ tasks.generate-tests.artifacts.${testConfig.key} }}`, - ); - commands.push(""); - commands.push(`EOF`); - - commands.push(""); - - leafTestTasks.push(`test-${testConfig.key}`); - } - - return { - key: "generate-tests", - use: "upload", - filter: [leaf.dir, "publish-tasks.template.yml"], - run: ` - mkdir -p "${leafBuildDir}" - - ${commands.join("\n")} - - export LEAF_TEST_TASKS="${leafTestTasks.join(",")}" - envsubst '$LEAF_TEST_TASKS' < publish-tasks.template.yml | tee -a $RWX_DYNAMIC_TASKS/${leaf.key}.yml - `, - outputs: { artifacts }, - env: { - LEAF_DIGEST: "${{ tasks.upload.values.leaf-digest }}", - }, - }; -}; - -const generateLeafRun = async (leaf) => { - return { - base: DEFAULT_BASE_LAYER, - tasks: [ - { - key: "packages", - run: ` - sudo apt-get update - sudo apt-get install gettext-base jq zip - sudo apt-get clean - `, - }, - { - key: "code", - call: "git/clone 2.0.0", - with: { - "preserve-git-dir": true, - repository: "https://github.com/rwx-cloud/packages.git", - ref: "${{ init.sha }}", - "github-token": "${{ github['rwx-cloud'].token }}", - }, - }, - { - key: "timestamp", - use: "code", - run: ` - latest_timestamp=$(git ls-files -z ${leaf.dir} | xargs -0 -n1 -I{} -- git log -1 --date=format:"%Y%m%d%H%M" --format="%ad" {} | sort | tail -n 1) - echo -n "$latest_timestamp" | tee $RWX_VALUES/timestamp - `, - }, - ...leaf.buildDependencies, - { - key: "build", - use: [ - "packages", - "code", - ...leaf.buildDependencies.map((dep) => dep.key), - ], - filter: [leaf.dir], - run: ` - cd ${leaf.dir} - if [[ -f build/run.sh ]]; then - echo "Running leaf build script" - ./build/run.sh - else - echo "Leaf has no build script" - fi - `, - }, - { - key: "zip", - use: "build", - filter: [leaf.dir], - run: ` - timestamp="\${{ tasks.timestamp.values.timestamp }}" - echo "Setting timestamp on files to $timestamp" - find ${leaf.dir} -exec touch -t "$timestamp" {} \\; - cd ${leaf.dir} && zip -X -r ../../${leaf.key}.zip . - `, - }, - { - key: "upload", - use: "zip", - filter: [`${leaf.key}.zip`], - env: { - RWX_ACCESS_TOKEN: { - "cache-key": "excluded", - value: - "${{ vaults.mint_leaves_development.secrets.RWX_ACCESS_TOKEN }}", - }, - }, - run: ` - curl \ - --request POST \ - --fail-with-body \ - --header "Authorization: Bearer $RWX_ACCESS_TOKEN" \ - --header 'Accept: application/json' \ - -F 'file=@${leaf.key}.zip' \ - https://cloud.rwx.com/mint/api/leaves | tee leaves-result.json - - leaf_digest=$(cat leaves-result.json | jq -r '.digest') - echo -n "$leaf_digest" > "$RWX_VALUES/leaf-digest" - `, - }, - await generateTestsTask(leaf), - ], - }; -}; - -const artifacts = []; -const leafRuns = []; - -for (const leaf of packages) { - const content = yaml.stringify(await generateLeafRun(leaf)); - await fs.writeFile(leaf.artifactFile, content, "utf8"); - - leafRuns.push({ - key: leaf.key, - call: `\${{ tasks.generate-leaf-runs.artifacts.${leaf.key} }}`, - init: { - "publish-leaves": "${{ init.publish-leaves }}", - sha: "${{ init.sha }}", - }, - }); - - artifacts.push({ - key: leaf.key, - path: leaf.artifactFile, - }); -} - -await fs.writeFile(`${BUILD_DIR}/leaf-runs.yaml`, yaml.stringify(leafRuns)); - -// this is needed since artifacts cannot otherwise be declared dynamically -const generateTask = { - key: "generate-leaf-runs", - use: "build-leaf-runs", - run: ` - ${artifacts.map((a) => `touch ${a.path}`).join("\n")} - cp ${BUILD_DIR}/leaf-runs.yaml $RWX_DYNAMIC_TASKS - `, - outputs: { artifacts }, -}; - -await fs.writeFile( - `${RWX_DYNAMIC_TASKS}/generate-task.yaml`, - yaml.stringify([generateTask]), -); diff --git a/.rwx/ci.yml b/.rwx/ci.yml index 3f803387..52284b0f 100644 --- a/.rwx/ci.yml +++ b/.rwx/ci.yml @@ -5,7 +5,7 @@ on: qualified-base-ref: origin/${{ event.github.pull_request.pull_request.base.ref }} unqualified-base-ref: ${{ event.github.pull_request.pull_request.base.ref }} branch: ${{ event.git.branch }} - publish-leaves: false + publish: false sha: ${{ event.git.sha }} push: if: ${{ event.git.branch == 'main' }} @@ -13,7 +13,7 @@ on: qualified-base-ref: ${{ event.github.push.before }} unqualified-base-ref: ${{ event.github.push.before }} branch: ${{ event.git.branch }} - publish-leaves: true + publish: true sha: ${{ event.git.sha }} concurrency-pools: @@ -22,17 +22,14 @@ concurrency-pools: capacity: 1 on-overflow: cancel-running +tool-cache: + vault: rwx-packages-main + base: image: ubuntu:24.04 config: rwx/base 1.0.0 tasks: - - key: system-packages - run: | - sudo apt-get update - sudo apt-get install gettext-base jq zip - sudo apt-get clean - - key: checkout call: git/clone 2.0.3 with: @@ -89,16 +86,32 @@ tasks: - "**/README.md" - "**/rwx-package.yml" - - key: build-leaf-runs - use: npm-install + - key: detect-changes + use: [checkout] run: | - mkdir build git fetch origin $UNQUALIFIED_BASE_REF - git diff --name-only $QUALIFIED_BASE_REF $SHA > $GIT_DIFF_FILE - node .rwx/build-tasks.mjs + changed_files=$(git diff --name-only $QUALIFIED_BASE_REF $SHA) + + packages="[]" + for pkg_file in $(ls */*/rwx-package.yml | sort); do + dir=$(dirname "$pkg_file") + if echo "$changed_files" | grep -q "^${dir}/"; then + packages=$(echo "$packages" | jq -c --arg d "$dir" '. + [{"directory": $d}]') + fi + done + + echo "Changed packages: $packages" + echo -n "$packages" > $RWX_VALUES/packages env: QUALIFIED_BASE_REF: ${{ init.qualified-base-ref }} UNQUALIFIED_BASE_REF: ${{ init.unqualified-base-ref }} - BUILD_DIR: build - GIT_DIFF_FILE: build/git-diff.txt SHA: ${{ init.sha }} + + - key: packages + call: ${{ run.dir }}/package.yml + parallel: + values: ${{ tasks.detect-changes.values.packages }} + init: + directory: ${{ parallel.directory }} + sha: ${{ init.sha }} + publish: ${{ init.publish }} diff --git a/.rwx/mint-utils.sh b/.rwx/mint-utils.sh deleted file mode 100755 index 97d280cb..00000000 --- a/.rwx/mint-utils.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env bash -# mint-utils version 1.0.4 - -detected_os="" -detected_os_version="" -detected_os_codename="" -detected_arch="" -detected_package_manager="" - -function mint__detect_os_arch { - if [ -f /etc/os-release ]; then - . /etc/os-release - - detected_os="$ID" - detected_os_version="$VERSION_ID" - detected_os_codename="$VERSION_CODENAME" - - case "$ID" in - ubuntu|debian) - detected_package_manager="apt" - ;; - esac - fi - - detected_arch=$(uname -m) -} - -function mint_os_name { - if [ -z "$detected_os" ]; then - mint__detect_os_arch - fi - echo "$detected_os" -} - -function mint_os_version { - if [ -z "$detected_os_version" ]; then - mint__detect_os_arch - fi - echo "$detected_os_version" -} - -# Output the name and version of the operating system as expected by Mint's `base.os` field. -function mint_os_name_version { - echo "$(mint_os_name) $(mint_os_version)" -} - -function mint_os_codename { - if [ -z "$detected_os_codename" ]; then - mint__detect_os_arch - fi - echo "$detected_os_codename" -} - -function mint_arch { - if [ -z "$detected_arch" ]; then - mint__detect_os_arch - fi - echo "$detected_arch" -} - -function mint_arch_amd { - local arch - arch="$(mint_arch)" - if [ "$arch" = "x86_64" ]; then - echo "amd64" - else - echo "$arch" - fi -} - -function mint_os_package_manager { - if [ -z "$detected_package_manager" ]; then - mint__detect_os_arch - fi - echo "$detected_package_manager" -} - -function mint_os_version_gte { - local compare_version="$1" - printf '%s\n' "$compare_version" "$(mint_os_version)" | sort -Vsc >/dev/null 2>&1 -} - -function mint_os_version_lte { - local compare_version="$1" - printf '%s\n' "$compare_version" "$(mint_os_version)" | sort -Vsc -r >/dev/null 2>&1 -} - -# Convert a string something usable as a Mint key. -# -# Replaces all non-alphanumeric characters with hyphens, compressing multiple hyphens into one. -function mint_keyify { - echo -n "$*" | tr -c -s '[:alnum:]' '-' -} - -# Check if an array contains a given element. -# -# Usage: mint_contains two one two three -function mint_contains { - local needle="$1" - local elements=("${@:2}") - for item in "${elements[@]}"; do - if [ "$item" = "$needle" ]; then - return 0 - fi - done - return 1 -} - -function mint_os_name_in { - mint_contains "$(mint_os_name)" "$@" -} - -function mint_os_package_manager_in { - mint_contains "$(mint_os_package_manager)" "$@" -} diff --git a/.rwx/package.yml b/.rwx/package.yml new file mode 100644 index 00000000..0cdf4e99 --- /dev/null +++ b/.rwx/package.yml @@ -0,0 +1,96 @@ +on: + cli: + init: + sha: ${{ event.git.sha }} + publish: false + +base: + image: ubuntu:24.04 + config: rwx/base 1.0.0 + +tasks: + - key: code + call: git/clone 2.0.3 + with: + repository: https://github.com/rwx-cloud/packages.git + ref: ${{ init.sha }} + preserve-git-dir: true + + - key: timestamp + use: code + run: | + latest_timestamp=$(git ls-files -z $DIRECTORY | xargs -0 -n1 -I{} -- git log -1 --date=format:"%Y%m%d%H%M" --format="%ad" {} | sort | tail -n 1) + echo -n "$latest_timestamp" | tee $RWX_VALUES/timestamp + filter: + - .git + - ${{ init.directory }} + env: + DIRECTORY: ${{ init.directory }} + + - key: build + use: code + run: | + cd $DIRECTORY + if [[ -f build/run.sh ]]; then + echo "Running build script" + ./build/run.sh + else + echo "No build script" + fi + filter: + - ${{ init.directory }} + env: + DIRECTORY: ${{ init.directory }} + + - key: package + use: [build] + call: 4ad359d09e34defc6da32ad46013c07cba6ae9a8b18b58351d095ce90beadcd9 + with: + directory: ${{ init.directory }} + rwx-access-token: ${{ vaults.mint_leaves_development.secrets.RWX_ACCESS_TOKEN }} + timestamp: ${{ tasks.timestamp.values.timestamp }} + + - key: generate-test + use: [code] + run: | + if [[ -f "$DIRECTORY/rwx-test-base.json" ]]; then + cat "$DIRECTORY/rwx-test-base.json" | tee $RWX_VALUES/base-images + else + echo '[{"image": "ubuntu:24.04", "config": "rwx/base 1.0.0", "arch": "x86_64"}]' | tee $RWX_VALUES/base-images + fi + cp "$DIRECTORY/rwx-test.yml" test-run.yml + filter: + - ${{ init.directory }} + env: + DIRECTORY: ${{ init.directory }} + outputs: + artifacts: + - key: test-run + path: test-run.yml + + - key: test + call: ${{ tasks.generate-test.artifacts.test-run }} + parallel: + values: ${{ tasks.generate-test.values.base-images }} + init: + package-digest: ${{ tasks.package.values.digest }} + base-image: ${{ parallel.image }} + base-config: ${{ parallel.config }} + base-arch: ${{ parallel.arch }} + + - key: publish + if: ${{ init.publish }} + after: test + run: | + curl \ + --request POST \ + --fail-with-body \ + --header "Authorization: Bearer $RWX_ACCESS_TOKEN" \ + --header 'Accept: application/json' \ + --header 'Content-Type: application/json' \ + --data '{ "digest": "${{ tasks.package.values.digest }}" }' \ + https://cloud.rwx.com/mint/api/leaves/publish + env: + RWX_ACCESS_TOKEN: + cache-key: excluded + value: ${{ vaults.mint_leaves_development.secrets.RWX_ACCESS_TOKEN }} diff --git a/README.md b/README.md index ba791cb0..7d0dd2af 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ These are packages for [RWX](https://www.rwx.com/). For documentation on calling packages in task definitions see: -https://www.rwx.com/docs/mint/call-packages +https://www.rwx.com/docs/call-packages For the full list of packages see: -https://www.rwx.com/docs/mint/packages +https://www.rwx.com/docs/packages diff --git a/erlang/install/README.md b/erlang/install/README.md index 8dbd71b1..84f533ab 100644 --- a/erlang/install/README.md +++ b/erlang/install/README.md @@ -5,7 +5,7 @@ To install Erlang: ```yaml tasks: - key: erlang - call: erlang/install 1.1.2 + call: erlang/install 1.1.3 with: erlang-version: 28.1 ``` diff --git a/erlang/install/rwx-ci-cd.config.yml b/erlang/install/rwx-ci-cd.config.yml deleted file mode 100644 index 4f4ebd99..00000000 --- a/erlang/install/rwx-ci-cd.config.yml +++ /dev/null @@ -1,14 +0,0 @@ -tests: - - key: ubuntu-22-04-x86-64 - template: rwx-ci-cd.ubuntu-22-04.yml - base: - image: ubuntu:22.04 - config: rwx/base 1.0.0 - arch: x86_64 - - - key: ubuntu-24-04-x86-64 - template: rwx-ci-cd.ubuntu-24-04.yml - base: - image: ubuntu:24.04 - config: rwx/base 1.0.0 - arch: x86_64 diff --git a/erlang/install/rwx-ci-cd.ubuntu-22-04.yml b/erlang/install/rwx-ci-cd.ubuntu-22-04.yml deleted file mode 100644 index 7187efcd..00000000 --- a/erlang/install/rwx-ci-cd.ubuntu-22-04.yml +++ /dev/null @@ -1,23 +0,0 @@ -- key: install-26-2-3 - call: $LEAF_DIGEST - with: - erlang-version: 26.2.3 - -- key: install-26-2-3--assert - use: install-26-2-3 - run: | - cat "/usr/lib/erlang/releases/26/OTP_VERSION" | tee /dev/stderr | grep "^26\.2\.3$" - - erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell | tee /dev/stderr | grep "^26\.2\.3$" - -- key: install-28-1 - call: $LEAF_DIGEST - with: - erlang-version: '28.1' - -- key: install-28-1--assert - use: install-28-1 - run: | - cat "/usr/lib/erlang/releases/28/OTP_VERSION" | tee /dev/stderr | grep "^28\.1$" - - erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell | tee /dev/stderr | grep "^28\.1$" diff --git a/erlang/install/rwx-ci-cd.ubuntu-24-04.yml b/erlang/install/rwx-ci-cd.ubuntu-24-04.yml deleted file mode 100644 index f6aa6bd8..00000000 --- a/erlang/install/rwx-ci-cd.ubuntu-24-04.yml +++ /dev/null @@ -1,11 +0,0 @@ -- key: install-28-1 - call: $LEAF_DIGEST - with: - erlang-version: '28.1' - -- key: install-28-1--assert - use: install-28-1 - run: | - cat "/usr/lib/erlang/releases/28/OTP_VERSION" | tee /dev/stderr | grep "^28\.1$" - - erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell | tee /dev/stderr | grep "^28\.1$" diff --git a/erlang/install/rwx-package.yml b/erlang/install/rwx-package.yml index 5c1f8fe5..2669e6ef 100644 --- a/erlang/install/rwx-package.yml +++ b/erlang/install/rwx-package.yml @@ -1,5 +1,5 @@ name: erlang/install -version: 1.1.2 +version: 1.1.3 description: Install Erlang, a programming language used to build massively scalable soft real-time systems with requirements on high availability source_code_url: https://github.com/rwx-cloud/packages/tree/main/erlang/install issue_tracker_url: https://github.com/rwx-cloud/packages/issues diff --git a/erlang/install/rwx-test-base.json b/erlang/install/rwx-test-base.json new file mode 100644 index 00000000..33b17a5e --- /dev/null +++ b/erlang/install/rwx-test-base.json @@ -0,0 +1,12 @@ +[ + { + "image": "ubuntu:22.04", + "config": "rwx/base 1.0.0", + "arch": "x86_64" + }, + { + "image": "ubuntu:24.04", + "config": "rwx/base 1.0.0", + "arch": "x86_64" + } +] diff --git a/erlang/install/rwx-test.yml b/erlang/install/rwx-test.yml new file mode 100644 index 00000000..66bd1a09 --- /dev/null +++ b/erlang/install/rwx-test.yml @@ -0,0 +1,29 @@ +base: + image: ${{ init.base-image }} + config: ${{ init.base-config }} + +tasks: + - key: install-26-2-3 + call: ${{ init.package-digest }} + if: ${{ init.base-image != "ubuntu:24.04" }} + with: + erlang-version: 26.2.3 + + - key: install-26-2-3--assert + use: install-26-2-3 + run: | + cat "/usr/lib/erlang/releases/26/OTP_VERSION" | tee /dev/stderr | grep "^26\.2\.3$" + + erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell | tee /dev/stderr | grep "^26\.2\.3$" + + - key: install-28-1 + call: ${{ init.package-digest }} + with: + erlang-version: '28.1' + + - key: install-28-1--assert + use: install-28-1 + run: | + cat "/usr/lib/erlang/releases/28/OTP_VERSION" | tee /dev/stderr | grep "^28\.1$" + + erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell | tee /dev/stderr | grep "^28\.1$" diff --git a/golang/install/README.md b/golang/install/README.md index 30cdb167..e67e462b 100644 --- a/golang/install/README.md +++ b/golang/install/README.md @@ -5,7 +5,7 @@ To install the latest version of go: ```yaml tasks: - key: go - call: golang/install 1.2.0 + call: golang/install 1.2.1 ``` To install a specific version: @@ -13,7 +13,7 @@ To install a specific version: ```yaml tasks: - key: go - call: golang/install 1.2.0 + call: golang/install 1.2.1 with: go-version: "1.21.5" ``` diff --git a/golang/install/rwx-ci-cd.config.yml b/golang/install/rwx-ci-cd.config.yml deleted file mode 100644 index 86aa4abf..00000000 --- a/golang/install/rwx-ci-cd.config.yml +++ /dev/null @@ -1,28 +0,0 @@ -tests: - - key: ubuntu-22-04-x86-64 - template: rwx-ci-cd.template.yml - base: - image: ubuntu:22.04 - config: rwx/base 1.0.0 - arch: x86_64 - - - key: ubuntu-22-04-arm64 - template: rwx-ci-cd.template.yml - base: - image: ubuntu:22.04 - config: rwx/base 1.0.0 - arch: arm64 - - - key: ubuntu-24-04-x86-64 - template: rwx-ci-cd.template.yml - base: - image: ubuntu:24.04 - config: rwx/base 1.0.0 - arch: x86_64 - - - key: ubuntu-24-04-arm64 - template: rwx-ci-cd.template.yml - base: - image: ubuntu:24.04 - config: rwx/base 1.0.0 - arch: arm64 diff --git a/golang/install/rwx-ci-cd.template.yml b/golang/install/rwx-ci-cd.template.yml deleted file mode 100644 index aa45a085..00000000 --- a/golang/install/rwx-ci-cd.template.yml +++ /dev/null @@ -1,41 +0,0 @@ -- key: install-1-20 - call: $LEAF_DIGEST - with: - go-version: "1.20" - -- key: install-1-20--assert - use: install-1-20 - run: go version | grep 1.20 - -- key: install-old-version - call: $LEAF_DIGEST - with: - go-version: "1.8" - -- key: install-old-version--assert - use: install-old-version - run: go version | grep 1.8 - -- key: install-patch-version - call: $LEAF_DIGEST - with: - go-version: "1.20.14" - -- key: install-patch-version--assert - use: install-patch-version - run: go version | grep 1.20.14 - -- key: install-1-23-4 - call: $LEAF_DIGEST - with: - go-version: "1.23.4" - -- key: install-1-23-4--assert - use: install-1-23-4 - run: go version | grep "1\.23\.4" - -- key: can-install-tools-and-use-them - use: install-1-23-4 - run: | - go install gotest.tools/gotestsum@latest - gotestsum --version diff --git a/golang/install/rwx-package.yml b/golang/install/rwx-package.yml index 1d740465..1bafce49 100644 --- a/golang/install/rwx-package.yml +++ b/golang/install/rwx-package.yml @@ -1,5 +1,5 @@ name: golang/install -version: 1.2.0 +version: 1.2.1 description: Install the Go programming language source_code_url: https://github.com/rwx-cloud/packages/tree/main/golang/install issue_tracker_url: https://github.com/rwx-cloud/packages/issues diff --git a/golang/install/rwx-test-base.json b/golang/install/rwx-test-base.json new file mode 100644 index 00000000..093a55cc --- /dev/null +++ b/golang/install/rwx-test-base.json @@ -0,0 +1,22 @@ +[ + { + "image": "ubuntu:22.04", + "config": "rwx/base 1.0.0", + "arch": "x86_64" + }, + { + "image": "ubuntu:22.04", + "config": "rwx/base 1.0.0", + "arch": "arm64" + }, + { + "image": "ubuntu:24.04", + "config": "rwx/base 1.0.0", + "arch": "x86_64" + }, + { + "image": "ubuntu:24.04", + "config": "rwx/base 1.0.0", + "arch": "arm64" + } +] diff --git a/golang/install/rwx-test.yml b/golang/install/rwx-test.yml new file mode 100644 index 00000000..961cc97e --- /dev/null +++ b/golang/install/rwx-test.yml @@ -0,0 +1,47 @@ +base: + image: ${{ init.base-image }} + config: ${{ init.base-config }} + arch: ${{ init.base-arch }} + +tasks: + - key: install-1-20 + call: ${{ init.package-digest }} + with: + go-version: "1.20" + + - key: install-1-20--assert + use: install-1-20 + run: go version | grep 1.20 + + - key: install-old-version + call: ${{ init.package-digest }} + with: + go-version: "1.8" + + - key: install-old-version--assert + use: install-old-version + run: go version | grep 1.8 + + - key: install-patch-version + call: ${{ init.package-digest }} + with: + go-version: "1.20.14" + + - key: install-patch-version--assert + use: install-patch-version + run: go version | grep 1.20.14 + + - key: install-1-23-4 + call: ${{ init.package-digest }} + with: + go-version: "1.23.4" + + - key: install-1-23-4--assert + use: install-1-23-4 + run: go version | grep "1\.23\.4" + + - key: can-install-tools-and-use-them + use: install-1-23-4 + run: | + go install gotest.tools/gotestsum@latest + gotestsum --version diff --git a/publish-tasks.template.yml b/publish-tasks.template.yml deleted file mode 100644 index d7c66791..00000000 --- a/publish-tasks.template.yml +++ /dev/null @@ -1,16 +0,0 @@ -- key: publish - if: ${{ init.publish-leaves }} - after: [upload,$LEAF_TEST_TASKS] - run: | - curl \ - --request POST \ - --fail-with-body \ - --header "Authorization: Bearer $RWX_ACCESS_TOKEN" \ - --header 'Accept: application/json' \ - --header 'Content-Type: application/json' \ - --data '{ "digest": "${{ tasks.upload.values.leaf-digest }}" }' \ - https://cloud.rwx.com/mint/api/leaves/publish - env: - RWX_ACCESS_TOKEN: - cache-key: excluded - value: ${{ vaults.mint_leaves_development.secrets.RWX_ACCESS_TOKEN }} diff --git a/rwx/greeting/rwx-ci-cd.template.yml b/rwx/greeting/rwx-ci-cd.template.yml deleted file mode 100644 index 16341f46..00000000 --- a/rwx/greeting/rwx-ci-cd.template.yml +++ /dev/null @@ -1,4 +0,0 @@ -- key: greeting--test - call: $LEAF_DIGEST - with: - name: world diff --git a/rwx/greeting/rwx-package.yml b/rwx/greeting/rwx-package.yml index 779a9495..701c2bfd 100644 --- a/rwx/greeting/rwx-package.yml +++ b/rwx/greeting/rwx-package.yml @@ -1,5 +1,5 @@ name: rwx/greeting -version: 1.0.5 +version: 1.0.6 description: Says hello, for testing and demonstration purposes source_code_url: https://github.com/rwx-cloud/packages/tree/main/rwx/greeting issue_tracker_url: https://github.com/rwx-cloud/packages/issues diff --git a/rwx/greeting/rwx-test.yml b/rwx/greeting/rwx-test.yml new file mode 100644 index 00000000..02d97f0d --- /dev/null +++ b/rwx/greeting/rwx-test.yml @@ -0,0 +1,9 @@ +base: + image: ${{ init.base-image }} + config: ${{ init.base-config }} + +tasks: + - key: test + call: ${{ init.package-digest }} + with: + name: world