Skip to content
Merged

Demo #781

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
14 changes: 13 additions & 1 deletion .github/workflows/docker-build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ jobs:
docker-build:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@v5
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -23,4 +32,7 @@ jobs:
context: ./img/${{ inputs.img }}
builder: ${{ steps.buildx.outputs.name }}
push: false
cache-from: type=gha
cache-from: |
type=registry,ref=ghcr.io/${{ github.repository_owner }}/crie-dep-${{ inputs.img }}:latest
type=gha
cache-to: type=gha,mode=max
22 changes: 11 additions & 11 deletions .github/workflows/docker-push-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ on:
img:
required: true
type: string
secrets:
DOCKER_HUB_USERNAME:
required: true
DOCKER_HUB_ACCESS_TOKEN:
required: true
jobs:
docker-push:
runs-on: ubuntu-latest
Expand All @@ -33,11 +28,12 @@ jobs:
[ "$VERSION" == "main" ] && VERSION=latest

echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Login to Docker Hub
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -50,6 +46,10 @@ jobs:
platforms: linux/amd64,linux/arm64
context: ./img/${{ inputs.img }}
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/crie-dep-${{ inputs.img }}:${{ env.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
ghcr.io/${{ github.repository_owner }}/crie-dep-${{ inputs.img }}:${{ env.VERSION }}
ghcr.io/${{ github.repository_owner }}/crie-dep-${{ inputs.img }}:latest
cache-from: |
type=registry,ref=ghcr.io/${{ github.repository_owner }}/crie-dep-${{ inputs.img }}:latest
type=gha
cache-to: type=gha,mode=max
5 changes: 1 addition & 4 deletions .github/workflows/img-apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@ jobs:
img-apk-push:
uses: ./.github/workflows/docker-push-template.yml
with:
img: 'apk'
secrets:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
img: 'apk'
3 changes: 0 additions & 3 deletions .github/workflows/img-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,3 @@ jobs:
uses: ./.github/workflows/docker-push-template.yml
with:
img: 'go'
secrets:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
5 changes: 1 addition & 4 deletions .github/workflows/img-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@ jobs:
img-npm-push:
uses: ./.github/workflows/docker-push-template.yml
with:
img: 'npm'
secrets:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
img: 'npm'
5 changes: 1 addition & 4 deletions .github/workflows/img-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@ jobs:
img-pip-push:
uses: ./.github/workflows/docker-push-template.yml
with:
img: 'pip'
secrets:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
img: 'pip'
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: release
permissions:
contents: read
contents: write
on:
push:
tags:
Expand Down
10 changes: 0 additions & 10 deletions .idea/runConfigurations/crie.xml

This file was deleted.

13 changes: 13 additions & 0 deletions .idea/runConfigurations/crie_help.xml

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

24 changes: 12 additions & 12 deletions cmd/crie/cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func SetCrie(proj *project.Config, langs *language.Languages) {
if proj.Ignore != nil && len(proj.Ignore) > 0 {
ignore = regexp.MustCompile(strings.Join(proj.Ignore, "|"))
}

crieRun = crie.RunConfiguration{Options: proj.Lint, Ignore: ignore, Languages: languages}
}

Expand Down Expand Up @@ -64,7 +64,7 @@ var LsCmd = &cobra.Command{
var ChkCmd = &cobra.Command{
Use: "chk",
Aliases: []string{"check"},
Short: "Run checkers",
Short: "Run linters that only check code",
Long: `Check all code standards for coding conventions`,
Run: func(cmd *cobra.Command, args []string) {
err := crieRun.Run("chk")
Expand All @@ -91,16 +91,16 @@ Find the file extensions that dont have an associated regex match within crieRun
// InitCmd command will create a project project file for crieRun
var InitCmd = &cobra.Command{
Use: "init",
Short: "Create an optional project file",
Long: `Create an optional project file`,
Short: "Create optional config files",
Long: `Create an optional project file and an extra optional language override file`,

RunE: func(_ *cobra.Command, _ []string) error {

err := language.NewLanguageConfigFile(viper.GetString("Language.Config"))
err := language.NewLanguageConfigFile(viper.GetString("Language.Conf"))
if err != nil {
return err
}
fmt.Printf("new language file created: %s\nused to overide crie internal language settings (optional / can be deleted)\n", viper.GetString("languageConfigPath"))
fmt.Printf("new language file created: %s\nused to overide crie internal language settings (optional / can be deleted)\n", viper.GetString("Language.Conf"))

fmt.Println()

Expand All @@ -109,11 +109,11 @@ var InitCmd = &cobra.Command{
if err != nil {
return err
}
err = projectConfig.NewProjectConfigFile(viper.GetString("Project.Config"))
err = projectConfig.NewProjectConfigFile(viper.GetString("Project.Conf"))
if err != nil {
return err
}
fmt.Printf("new project file created: %s\nthis will be treated as your project defaults (overiden by flags and env)\n", viper.GetString("projectConfigPath"))
fmt.Printf("new project file created: %s\nthis will be treated as your project defaults (overiden by flags and env)\n", viper.GetString("Project.Conf"))
return nil
},
}
Expand All @@ -122,7 +122,7 @@ var InitCmd = &cobra.Command{
var ConfCmd = &cobra.Command{
Use: "conf",
Aliases: []string{"config", "cnf"},
Short: "Print what crie has parsed from flags, env, the project file, and then defaults",
Short: "Print configuration settings",
Long: "Print what crie has parsed from flags, env, the project file, and then defaults",
RunE: func(_ *cobra.Command, _ []string) error {
var projectConfig project.Config
Expand All @@ -144,8 +144,8 @@ var ConfCmd = &cobra.Command{
var SchemaCmd = &cobra.Command{
Use: "schema",
Aliases: []string{"sch"},
Short: "Print jsonschema's of the crie cli configs",
Long: `Print jsonschema's' of the crie cli configs`,
Short: "Print JSON schemas for config files",
Long: `Print JSON schemas for config files`,
}

// SchemaLangCmd is the jsonschema generator for the crie languages configuration
Expand Down Expand Up @@ -196,7 +196,7 @@ func stage(stageName string) {
var LntCmd = &cobra.Command{
Use: "lnt",
Aliases: []string{"lint", "all"},
Short: "Run everything",
Short: "Runs both fmt and then chk",
Long: `Runs both format and then check`,
Run: func(_ *cobra.Command, _ []string) {
stage("fmt")
Expand Down
40 changes: 20 additions & 20 deletions cmd/crie/config/language/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ languages:
bin: black
type: cli
start: ["--quiet"]
img: "docker.io/tyhal/crie-dep-pip:latest"
img: "ghcr.io/tyhal/crie-dep-pip:latest"
chk:
bin: pylint
type: cli
img: "docker.io/tyhal/crie-dep-pip:latest"
img: "ghcr.io/tyhal/crie-dep-pip:latest"
proto:
match: ['\.proto$']
fmt:
bin: protolint
type: cli
img: "docker.io/tyhal/crie-dep-go:latest"
img: "ghcr.io/tyhal/crie-dep-go:latest"
chk:
bin: protolint
type: cli
img: "docker.io/tyhal/crie-dep-go:latest"
img: "ghcr.io/tyhal/crie-dep-go:latest"
bash:
match: ['\.bash$']
fmt:
Expand Down Expand Up @@ -53,7 +53,7 @@ languages:
chk:
bin: yamllint
type: cli
img: "docker.io/tyhal/crie-dep-pip:latest"
img: "ghcr.io/tyhal/crie-dep-pip:latest"
fmt:
type: cli
bin: yamlfmt
Expand All @@ -77,90 +77,90 @@ languages:
bin: standard
type: cli
start: ["--fix"]
img: "docker.io/tyhal/crie-dep-npm:latest"
img: "ghcr.io/tyhal/crie-dep-npm:latest"
chk:
bin: standard
type: cli
img: "docker.io/tyhal/crie-dep-npm:latest"
img: "ghcr.io/tyhal/crie-dep-npm:latest"
golang:
match: ['\.go$']
fmt:
bin: gofmt
type: cli
start: ["-l", "-w"]
img: "docker.io/tyhal/crie-dep-go:latest"
img: "ghcr.io/tyhal/crie-dep-go:latest"
chk:
bin: golint
type: cli
start: ["-set_exit_status"]
img: "docker.io/tyhal/crie-dep-go:latest"
img: "ghcr.io/tyhal/crie-dep-go:latest"
markdown:
match: ['\.md$']
fmt:
bin: remark
type: cli
start: ["--use", "remark-preset-lint-recommended"]
end: ["-o"]
img: "docker.io/tyhal/crie-dep-npm:latest"
img: "ghcr.io/tyhal/crie-dep-npm:latest"
chk:
bin: vale
type: cli
start: ["--config=/etc/vale/.vale.ini"]
img: "docker.io/tyhal/crie-dep-go:latest"
img: "ghcr.io/tyhal/crie-dep-go:latest"
asciidoctor:
match: ['\.adoc$']
chk:
bin: vale
type: cli
start: ["--config=/etc/vale/.vale.ini"]
img: "docker.io/tyhal/crie-dep-go:latest"
img: "ghcr.io/tyhal/crie-dep-go:latest"
json:
match: ['\.json$', '\.JSON$']
fmt:
bin: jsonlint
type: cli
start: ["-i", "-s", "-c", "-q"]
img: "docker.io/tyhal/crie-dep-npm:latest"
img: "ghcr.io/tyhal/crie-dep-npm:latest"
chk:
bin: jsonlint
type: cli
start: ["-q"]
img: "docker.io/tyhal/crie-dep-npm:latest"
img: "ghcr.io/tyhal/crie-dep-npm:latest"
cpp:
match: ['\.cc$', '\.cpp$']
fmt:
bin: clang-format
type: cli
start: ["-style=file", "-i"]
img: "docker.io/tyhal/crie-dep-apk:latest"
img: "ghcr.io/tyhal/crie-dep-apk:latest"
chk:
bin: cppcheck
type: cli
start: ["--enable=all", "--language=c++", "--suppress=operatorEqRetRefThis", "--suppress=operatorEq", "--suppress=noExplicitConstructor", "--suppress=unRegexedSuppression", "--suppress=missingInclude", "--suppress=unusedFunction", "--suppress=noConstructor", "--suppress=unmatchedSuppression", "--suppress=missingIncludeSystem", "--inline-suppr", "--error-exitcode=1"]
img: "docker.io/tyhal/crie-dep-apk:latest"
img: "ghcr.io/tyhal/crie-dep-apk:latest"
cppheaders:
match: ['\.h$', '\.hpp$']
fmt:
bin: clang-format
type: cli
start: ["-style=file", "-i"]
img: "docker.io/tyhal/crie-dep-apk:latest"
img: "ghcr.io/tyhal/crie-dep-apk:latest"
c:
match: ['\.c$']
fmt:
bin: clang-format
type: cli
start: ["-style=file", "-i"]
img: "docker.io/tyhal/crie-dep-apk:latest"
img: "ghcr.io/tyhal/crie-dep-apk:latest"
chk:
bin: cppcheck
type: cli
start: ["--enable=all", "--language=c", "--suppress=unRegexedSuppression", "--suppress=missingInclude", "--suppress=unusedFunction", "--suppress=unmatchedSuppression", "--suppress=missingIncludeSystem", "--inline-suppr", "--error-exitcode=1"]
img: "docker.io/tyhal/crie-dep-apk:latest"
img: "ghcr.io/tyhal/crie-dep-apk:latest"
cmake:
match: ['CMakeLists.txt$', '\.cmake$']
chk:
bin: cmakelint
type: cli
start: ["--config=/home/standards/.config/cmakelintrc"]
img: "docker.io/tyhal/crie-dep-pip:latest"
img: "ghcr.io/tyhal/crie-dep-pip:latest"
Loading