Skip to content
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

Drop Ruby as a build dependency #740

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could disable the requirement for this in yamllint if we wanted

# You can add one username per supported platform and one custom link.
custom: "https://paypal.me/purpleidea"
github: purpleidea
Expand Down
5 changes: 3 additions & 2 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# These settings are synced to GitHub by https://probot.github.io/apps/settings/

repository:
Expand Down Expand Up @@ -77,7 +78,7 @@ labels:
# oldname: Help Wanted

# Collaborators: give specific users access to this repository.
#collaborators:
# collaborators:
# - username: purpleidea
# # Note: Only valid on organization-owned repositories.
# # The permission to grant the collaborator. Can be one of:
Expand All @@ -91,7 +92,7 @@ labels:

# NOTE: The APIs needed for teams are not supported yet by GitHub Apps
# https://developer.github.com/v3/apps/available-endpoints/
#teams:
# teams:
# - name: core
# permission: admin
# - name: docs
Expand Down
78 changes: 34 additions & 44 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
# Docs: https://help.github.com/en/articles/workflow-syntax-for-github-actions

# If the name is omitted, it uses the filename instead.
#name: Test
# name: Test
on:
# Run on all pull requests.
pull_request:
#branches:
#- master
# branches:
# - master

# Run on all pushes.
push:
# Run daily at 4am.
schedule:
- cron: 0 4 * * *

jobs:
maketest:
name: Test (${{ matrix.test_block }}) on ${{ matrix.os }} with golang ${{ matrix.golang_version }}
Expand All @@ -23,46 +23,36 @@ jobs:
matrix:
# TODO: Add tip when it's supported: https://github.com/actions/setup-go/issues/21
os:
- ubuntu-latest
# macos tests are currently failing in CI
#- macos-latest
- ubuntu-latest
# macos tests are currently failing in CI
# - macos-latest
golang_version:
# TODO: add 1.22.x and tip
# minimum required and latest published go_version
- "1.21"
# TODO: add 1.22.x and tip
# minimum required and latest published go_version
- "1.21"
test_block:
- basic
- shell
- race
- basic
- shell
- race
fail-fast: false

steps:
# Do not shallow fetch. The path can't be absolute, so we need to move it
# to the expected location later.
- name: Clone mgmt
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
path: ./go/src/github.com/purpleidea/mgmt

- name: Install Go ${{ matrix.golang_version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.golang_version }}

# Install & configure ruby, fixes gem permissions error
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: head

- name: Install dependencies
working-directory: ./go/src/github.com/purpleidea/mgmt
run: |
make deps

- name: Run test
working-directory: ./go/src/github.com/purpleidea/mgmt
run: |
TEST_BLOCK="${{ matrix.test_block }}" make test
# Do not shallow fetch. The path can't be absolute, so we need to move it
# to the expected location later.
- name: Clone mgmt
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
path: ./go/src/github.com/purpleidea/mgmt
- name: Install Go ${{ matrix.golang_version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.golang_version }}
- name: Install dependencies
working-directory: ./go/src/github.com/purpleidea/mgmt
run: |
make deps
- name: Run test
working-directory: ./go/src/github.com/purpleidea/mgmt
run: |-
TEST_BLOCK="${{ matrix.test_block }}" make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ tmp/
*_stringer.go
mgmt
mgmt.static
Pipfile.lock
# crossbuild artifacts
build/mgmt-*
mgmt.iml
Expand Down
34 changes: 18 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
language: go
os:
- linux
Expand All @@ -20,34 +21,35 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then travis_retry travis_retry sudo apt update; fi
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
- git fetch --unshallow

install: 'make deps'
matrix:
fast_finish: false
allow_failures:
- go: 1.22.x
- go: tip
- os: osx
- go: 1.22.x
- go: tip
- os: osx
# include only one build for osx for a quicker build as the nr. of these runners are sparse
include:
- name: "basic tests"
go: 1.21.x
env: TEST_BLOCK=basic
- name: "shell tests"
go: 1.21.x
env: TEST_BLOCK=shell
- name: "race tests"
go: 1.21.x
env: TEST_BLOCK=race
- go: 1.22.x
- go: tip
- os: osx
- name: "basic tests"
go: 1.21.x
env: TEST_BLOCK=basic
- name: "shell tests"
go: 1.21.x
env: TEST_BLOCK=shell
- name: "race tests"
go: 1.21.x
env: TEST_BLOCK=race
- go: 1.22.x
- go: tip
- os: osx
script: 'TEST_BLOCK="$TEST_BLOCK" make test'

# the "secure" channel value is the result of running: ./misc/travis-encrypt.sh
# with a value of: irc.freenode.net#mgmtconfig to eliminate noise from forks...
notifications:
irc:
#channels:
# channels:
# - secure: htcuWAczm3C1zKC9vUfdRzhIXM1vtF+q0cLlQFXK1IQQlk693/pM30Mmf2L/9V2DVDeps+GyLdip0ARXD1DZEJV0lK+Ca1qbHdFP1r4Xv6l5+jaDb5Y88YU5LI8K758QShiZJojuQ1aO2j8xmmt9V0/5y5QwlpPeHbKYBOFPBX3HvlT9DhvwZNKGhBb4qJOEaPVOwq9IkN3DyQ456MHcJ3q3vF9Lb440uTuLsJNof2AbYZH8ZIHCSG2N8tBj2qhJOpWQboYtQJzE2pRaGkGBL4kYcHZSZMXX8sl4cBM1vx/IRUkvBxJUpLJz2gn/eRI+/gr59juZE2K0+FOLlx9dLnX626Y9xSViopBI6JsIoHJDqNC7aGaF2qaYulGYN65VNKVqmghjgt6JLmmiKeH10hYrJMMvt2rms8l4+5iwmCwXvhH/WU9edzk2p5wqERMnostJFEJib0zI3yzLoF0sdJs+veKtagzfayY2d2l7hlmt951IpqqVWldVgWUcQKVvi8gmRarbwFlK+5D7BEnkUDcLNly/cqf7BgEeX6YfF+FiR4pgfOhYvGCD+2q91NgWQXHBCxbyN0be1TVdkXD94f0Lkn94VyEJJ+PkPlG+rPgFwGcjqN4oEGkJeJmES2If05q2Ms1dJLwYQDL3+Py4lNMSdSWj24TzlFVhtwHepuw=
template:
- "%{repository} (%{commit}: %{author}): %{message}"
Expand Down
9 changes: 9 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
extends: default
rules:
line-length: disable
indentation:
indent-sequences: consistent
truthy:
# for the on: in github workflows. yes, really
check-keys: false
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ gofmt:
find . -maxdepth 9 -type f -name '*.go' -not -path './old/*' -not -path './tmp/*' -not -path './vendor/*' -exec goimports -w {} \;

yamlfmt:
find . -maxdepth 3 -type f -name '*.yaml' -not -path './old/*' -not -path './tmp/*' -not -path './omv.yaml' -exec ruby -e "require 'yaml'; x=YAML.load_file('{}').to_yaml.each_line.map(&:rstrip).join(10.chr)+10.chr; File.open('{}', 'w').write x" \;
find . -maxdepth 3 -type f -name '*.yaml' -not -path './old/*' -not -path './tmp/*' -not -path './omv.yaml' | xargs pipenv run yamlfix -c yamlfix.toml

format: gofmt yamlfmt ## format yaml and golang code

Expand Down
14 changes: 14 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
yamlfix = "*"
pymarkdownlnt = "*"
yamllint = "*"

[dev-packages]

[requires]
python_version = "3"
14 changes: 7 additions & 7 deletions docs/language-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,13 +569,13 @@ cause a conflict with another identifier.
### Stages

The mgmt compiler runs in a number of stages. In order of execution they are:
* [Lexing](#lexing)
* [Parsing](#parsing)
* [Interpolation](#interpolation)
* [Scope propagation](#scope-propagation)
* [Type unification](#type-unification)
* [Function graph generation](#function-graph-generation)
* [Function engine creation and validation](#function-engine-creation-and-validation)
- [Lexing](#lexing)
- [Parsing](#parsing)
- [Interpolation](#interpolation)
- [Scope propagation](#scope-propagation)
- [Type unification](#type-unification)
- [Function graph generation](#function-graph-generation)
- [Function engine creation and validation](#function-engine-creation-and-validation)

All of the above needs to be done every time the source code changes. After this
point, the [function engine runs](#function-engine-running-and-interpret) and
Expand Down
7 changes: 4 additions & 3 deletions examples/lang/modules/badexample1/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
main: "main/hello.mcl" # this is not the default, the default is "main.mcl"
files: "files/" # these are some extra files we can use (is the default)
path: "path/" # where to look for modules, defaults to using a global
---
main: "main/hello.mcl" # this is not the default, the default is "main.mcl"
files: "files/" # these are some extra files we can use (is the default)
path: "path/" # where to look for modules, defaults to using a global
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
main: "main.mcl"
files: "files/" # these are some extra files we can use (is the default)
files: "files/" # these are some extra files we can use (is the default)
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
main: "main.mcl"
files: "files/" # these are some extra files we can use (is the default)
files: "files/" # these are some extra files we can use (is the default)
4 changes: 2 additions & 2 deletions examples/yaml/hostname.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
graph: mygraph
resources:
hostname:
- name: Hostname Watcher @ TestHost
hostname: test.hostname.example.com
- name: Hostname Watcher @ TestHost
hostname: test.hostname.example.com
edges: []
9 changes: 5 additions & 4 deletions examples/yaml/pippet1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
graph: mygraph
resources:
pippet:
- name: File[mylink]
type: file
title: mylink
params: "{ path: /tmp/pippet1_link, ensure: link, target: /tmp/pippet1_target }"
- name: File[mylink]
type: file
title: mylink
params: "{ path: /tmp/pippet1_link, ensure: link, target: /tmp/pippet1_target\
\ }"
Loading
Loading