8000 all: tidy up pre v1 by myitcv · Pull Request #3 · cue-lang/setup-cue · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

all: tidy up pre v1 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 31, 2021
Merged
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
49 changes: 0 additions & 49 deletions .github/workflows/build-and-test.yaml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/build-and-test.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions action.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package action

action: {
name: "Setup CUE environment"
icon: "terminal"
description: "Setup a Go environment and add it to the PATH."
inputs: version: {
description: #"The CUE version to setup. Must be a valid semantic version string like "v0.4.0" or "latest""#
required: true
default: "latest"
}
outputs: "cue-path": description: "Path to the cached CUE binary"
branding: color: "blue"
runs: {
using: "node12"
main: "dist/index.js"
}
}
19 changes: 11 additions & 8 deletions action.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions action_tool.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package action

import (
"encoding/yaml"
"tool/file"
)

// genaction exports the action configuration to action.yml
//
// When the as-yet-unpublished embeding example is implemented,
// this command will become superfluous and could be replaced
// by a cue export call.
command: genaction: file.Create & {
filename: "action.yml"
contents: """
# Generated by cue cmd genaction; do not edit

\(yaml.Marshal(action))
"""
}
83 changes: 83 additions & 0 deletions ci_tool.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package action

import (
"encoding/yaml"
"strings"
"path"
"tool/http"
"tool/file"
"tool/exec"
)

_goos: *"unix" | string @tag(os,var=os)

#repoRoot: exec.Run & {
cmd: "git rev-parse --show-toplevel"
stdout: string
}

// vendorgithubschema "vendors" 'cue import'-ed versions of the GitHub
// action and workflow schemas into cue.mod/pkg
//
// Under the proposal for CUE packagemanagement, this command is
// redundant.
command: vendorgithubschema: {
repoRoot: #repoRoot

getActionJSONSchema: http.Get & {
// Tip link for humans:
// https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-action.json
url: "https://raw.githubusercontent.com/SchemaStore/schemastore/6f19577c833450268973126ee095d42b8f515515/src/schemas/json/github-action.json"
}

importActionJSONSchema: exec.Run & {
stdin: getActionJSONSchema.response.body
cmd: "cue import -f -p github -l #Action: jsonschema: - -o -"
stdout: string
}

vendorGitHubActionSchema: file.Create & {
_path: path.FromSlash("cue.mod/pkg/json.schemastore.org/github/github-action.cue", "unix")
filename: path.Join([strings.TrimSpace(repoRoot.stdout), _path], _goos)
contents: importActionJSONSchema.stdout
}

getWorkflowJSONSchema: http.Get & {
// Tip link for humans:
// https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json
url: "https://raw.githubusercontent.com/SchemaStore/schemastore/6fe4707b9d1c5d45cfc8d5b6d56968e65d2bdc38/src/schemas/json/github-workflow.json"
}

importWorkflowJSONSchema: exec.Run & {
stdin: getWorkflowJSONSchema.response.body
cmd: "cue import -f -p github -l #Workflow: jsonschema: - -o -"
stdout: string
}

vendorGitHubWorkflowSchema: file.Create & {
_path: path.FromSlash("cue.mod/pkg/json.schemastore.org/github/github-workflow.cue", "unix")
filename: path.Join([strings.TrimSpace(repoRoot.stdout), _path], _goos)
contents: importWorkflowJSONSchema.stdout
}
}

// genworkflows exports workflow configurations to .yml files.
//
// When the as-yet-unpublished embeding example is implemented,
// this command will become superfluous and could be replaced
// by a cue export call.
command: genworkflows: {
repoRoot: #repoRoot

for _, w in workflows {
"\(w.filename)": file.Create & {
_path: path.FromSlash(".github/workflows", "unix")
filename: path.Join([strings.TrimSpace(repoRoot.stdout), _path, w.filename], _goos)
contents: """
# Generated by cue cmd genworkflows; do not edit

\(yaml.Marshal(w.workflow))
"""
}
}
}
1 change: 1 addition & 0 deletions cue.mod/module.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module: "github.com/cue-lang/setup-cue"
Loading
0