Skip to content
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
4 changes: 0 additions & 4 deletions .github/workflows/release-rubygem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ jobs:
with:
ruby-version: 4.0.6
working-directory: ruby
- name: Synchronize CiEnvironments.json
working-directory: ruby
run: bundle exec rake ci_environments
- run: ./scripts/fail-if-dirty
- uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0
- uses: cucumber/action-publish-rubygem@4e79bb9aed597c835e8438f57c04d0996ab80d72 # v2.0.0
with:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/test-codegen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: test-codegen

permissions: {}

on:
push:
branches:
- main
- renovate/**
pull_request:
branches:
- main

jobs:
test-codegen:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: generate code for all languages
run: |
make clean-ci-environment
make copy-ci-environment

- name: check the repo is still clean after generation
run: |
git status --porcelain
git diff HEAD
[ -z "$(git status --porcelain)" ]
3 changes: 0 additions & 3 deletions .github/workflows/test-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,3 @@ jobs:
- name: Run go vet
working-directory: go
run: go vet ./...
- name: Run go test
working-directory: go
run: make test
1 change: 0 additions & 1 deletion .github/workflows/test-java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ jobs:
working-directory: java
- run: mvn test
working-directory: java
- run: ./scripts/fail-if-dirty
1 change: 0 additions & 1 deletion .github/workflows/test-javascript.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,3 @@ jobs:
working-directory: javascript
- run: npm run lint
working-directory: javascript
- run: ./scripts/fail-if-dirty
1 change: 0 additions & 1 deletion .github/workflows/test-ruby.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ jobs:
working-directory: ruby
- run: bundle exec rake
working-directory: ruby
- run: ./scripts/fail-if-dirty
9 changes: 4 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

Thank you for considering contributing to Cucumber ci-environment!

## Code of Conduct
Please read [cucumber/.github/CONTRIBUTING.md](https://github.com/cucumber/.github/blob/main/CONTRIBUTING.md) first.

Everyone interacting in this codebase and issue tracker is expected to follow
the Cucumber [code of conduct](https://cucumber.io/conduct).

## Adding support for new CI servers
# Adding support for new CI servers

If you want to see support for a new CI server, please submit a pull request.

Expand All @@ -18,6 +15,8 @@ Here are the steps:
`CiEnvironments.json`.
* Add an approval test in `testdata/YourCi.txt` and `testdata/YourCi.txt.json`.

* Copy the `CiEnvironments.json` to the other projects by running `make copy-ci-environment`.

Then build and run the tests for all implementations:

cd java && mvn clean install
Expand Down
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
languages = go java javascript python ruby

.DEFAULT_GOAL = help

help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make <target>\n\nWhere <target> is one of:\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

copy-ci-environment: $(patsubst %,copy-ci-environment-%,$(languages)) ## Copy CiEnvironment.json to all supported languages
.PHONY: copy-ci-environment

copy-ci-environment-%: %
$(MAKE) --directory=$< copy-ci-environment
.PHONY: generate-%

clean-ci-environment: $(patsubst %,clean-ci-environment-%,$(languages)) ## Clean CiEnvironment.json
.PHONY: clean-ci-environment

clean-ci-environment-%: %
$(MAKE) --directory=$< clean-ci-environment
.PHONY: clean-ci-environment-%
138 changes: 74 additions & 64 deletions go/CiEnvironments.json
Original file line number Diff line number Diff line change
@@ -1,150 +1,160 @@
[
{
"name": "Azure Pipelines",
"url": "${BUILD_BUILDURI}",
"buildNumber": "${BUILD_BUILDNUMBER}",
"git": {
"branch": "${BUILD_SOURCEBRANCH/refs/heads/(.*)/\\1}",
"remote": "${BUILD_REPOSITORY_URI}",
"revision": "${BUILD_SOURCEVERSION}",
"branch": "${BUILD_SOURCEBRANCH/refs\/heads\/(.*)/\\1}",
"tag": "${BUILD_SOURCEBRANCH/refs\/tags\/(.*)/\\1}"
}
"tag": "${BUILD_SOURCEBRANCH/refs/tags/(.*)/\\1}"
},
"name": "Azure Pipelines",
"url": "${BUILD_BUILDURI}"
},
{
"name": "Bamboo",
"url": "${bamboo_buildResultsUrl}",
"buildNumber": "${bamboo_buildNumber}",
"git": {
"branch": "${bamboo_planRepository_branch}",
"remote": "${bamboo_planRepository_repositoryUrl}",
"revision": "${bamboo_planRepository_revision}",
"branch": "${bamboo_planRepository_branch}"
}
"revision": "${bamboo_planRepository_revision}"
},
"name": "Bamboo",
"url": "${bamboo_buildResultsUrl}"
},
{
"name": "Buddy",
"url": "${BUDDY_EXECUTION_URL}",
"buildNumber": "${BUDDY_EXECUTION_ID}",
"git": {
"branch": "${BUDDY_EXECUTION_BRANCH}",
"remote": "${BUDDY_SCM_URL}",
"revision": "${BUDDY_EXECUTION_REVISION}",
"branch": "${BUDDY_EXECUTION_BRANCH}",
"tag": "${BUDDY_EXECUTION_TAG}"
}
},
"name": "Buddy",
"url": "${BUDDY_EXECUTION_URL}"
},
{
"name": "Bitrise",
"url": "${BITRISE_BUILD_URL}",
"buildNumber": "${BITRISE_BUILD_NUMBER}",
"git": {
"branch": "${BITRISE_GIT_BRANCH}",
"remote": "${GIT_REPOSITORY_URL}",
"revision": "${BITRISE_GIT_COMMIT}",
"branch": "${BITRISE_GIT_BRANCH}",
"tag": "${BITRISE_GIT_TAG}"
}
},
"name": "Bitrise",
"url": "${BITRISE_BUILD_URL}"
},
{
"name": "CircleCI",
"url": "${CIRCLE_BUILD_URL}",
"buildNumber": "${CIRCLE_BUILD_NUM}",
"git": {
"branch": "${CIRCLE_BRANCH}",
"remote": "${CIRCLE_REPOSITORY_URL}",
"revision": "${CIRCLE_SHA1}",
"branch": "${CIRCLE_BRANCH}",
"tag": "${CIRCLE_TAG}"
}
},
"name": "CircleCI",
"url": "${CIRCLE_BUILD_URL}"
},
{
"name": "CodeFresh",
"url": "${CF_BUILD_URL}",
"buildNumber": "${CF_BUILD_ID}",
"git": {
"branch": "${CF_BRANCH}",
"remote": "${CF_COMMIT_URL/(.*)\\/commit.+$/\\1}.git",
"revision": "${CF_REVISION}",
"branch": "${CF_BRANCH}"
}
"revision": "${CF_REVISION}"
},
"name": "CodeFresh",
"url": "${CF_BUILD_URL}"
},
{
"name": "CodeShip",
"url": "${CI_BUILD_URL}",
"buildNumber": "${CI_BUILD_NUMBER}",
"git": {
"branch": "${CI_BRANCH}",
"remote": "${CI_PULL_REQUEST/(.*)\\/pull\\/\\d+/\\1.git}",
"revision": "${CI_COMMIT_ID}",
"branch": "${CI_BRANCH}"
}
"revision": "${CI_COMMIT_ID}"
},
"name": "CodeShip",
"url": "${CI_BUILD_URL}"
},
{
"name": "GitHub Actions",
"url": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}",
"buildNumber": "${GITHUB_RUN_ID}",
"git": {
"branch": "${GITHUB_HEAD_REF}",
"remote": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git",
"revision": "${GITHUB_SHA}",
"branch": "${GITHUB_HEAD_REF}",
"tag": "${GITHUB_REF/refs\/tags\/(.*)/\\1}"
}
"tag": "${GITHUB_REF/refs/tags/(.*)/\\1}"
},
"name": "GitHub Actions",
"url": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
},
{
"name": "GitLab",
"url": "${CI_JOB_URL}",
"buildNumber": "${CI_JOB_ID}",
"git": {
"branch": "${CI_COMMIT_BRANCH}",
"remote": "${CI_REPOSITORY_URL}",
"revision": "${CI_COMMIT_SHA}",
"branch": "${CI_COMMIT_BRANCH}",
"tag": "${CI_COMMIT_TAG}"
}
},
"name": "GitLab",
"url": "${CI_JOB_URL}"
},
{
"name": "GoCD",
"url": "${GO_SERVER_URL}/pipelines/${GO_PIPELINE_NAME}/${GO_PIPELINE_COUNTER}/${GO_STAGE_NAME}/${GO_STAGE_COUNTER}",
"buildNumber": "${GO_PIPELINE_NAME}/${GO_PIPELINE_COUNTER}/${GO_STAGE_NAME}/${GO_STAGE_COUNTER}",
"git": {
"branch": "${GO_SCM_*_PR_BRANCH/.*:(.*)/\\1}",
"remote": "${GO_SCM_*_PR_URL/(.*)\\/pull\\/\\d+/\\1.git}",
"revision": "${GO_REVISION}",
"branch": "${GO_SCM_*_PR_BRANCH/.*:(.*)/\\1}"
}
"revision": "${GO_REVISION}"
},
"name": "GoCD",
"url": "${GO_SERVER_URL}/pipelines/${GO_PIPELINE_NAME}/${GO_PIPELINE_COUNTER}/${GO_STAGE_NAME}/${GO_STAGE_COUNTER}"
},
{
"name": "Jenkins",
"url": "${BUILD_URL}",
"buildNumber": "${BUILD_NUMBER}",
"git": {
"branch": "${GIT_LOCAL_BRANCH}",
"remote": "${GIT_URL}",
"revision": "${GIT_COMMIT}",
"branch": "${GIT_LOCAL_BRANCH}"
}
"revision": "${GIT_COMMIT}"
},
"name": "Jenkins",
"url": "${BUILD_URL}"
},
{
"buildNumber": "${JB_SPACE_EXECUTION_NUMBER}",
"git": {
"branch": "${JB_SPACE_GIT_BRANCH}",
"remote": "https://${JB_SPACE_API_URL}/p/${JB_SPACE_PROJECT_KEY}/repositories/${JB_SPACE_GIT_REPOSITORY_NAME}",
"revision": "${JB_SPACE_GIT_REVISION}"
},
"name": "JetBrains Space",
"url": "${JB_SPACE_EXECUTION_URL}"
},
{
"name": "Semaphore",
"url": "${SEMAPHORE_ORGANIZATION_URL}/jobs/${SEMAPHORE_JOB_ID}",
"buildNumber": "${SEMAPHORE_JOB_ID}",
"git": {
"branch": "${SEMAPHORE_GIT_BRANCH}",
"remote": "${SEMAPHORE_GIT_URL}",
"revision": "${SEMAPHORE_GIT_SHA}",
"branch": "${SEMAPHORE_GIT_BRANCH}",
"tag": "${SEMAPHORE_GIT_TAG_NAME}"
}
},
"name": "Semaphore",
"url": "${SEMAPHORE_ORGANIZATION_URL}/jobs/${SEMAPHORE_JOB_ID}"
},
{
"name": "Travis CI",
"url": "${TRAVIS_BUILD_WEB_URL}",
"buildNumber": "${TRAVIS_JOB_NUMBER}",
"git": {
"branch": "${TRAVIS_BRANCH}",
"remote": "https://github.com/${TRAVIS_REPO_SLUG}.git",
"revision": "${TRAVIS_COMMIT}",
"branch": "${TRAVIS_BRANCH}",
"tag": "${TRAVIS_TAG}"
}
},
"name": "Travis CI",
"url": "${TRAVIS_BUILD_WEB_URL}"
},
{
"name": "Wercker",
"url": "${WERCKER_RUN_URL}",
"buildNumber": "${WERCKER_RUN_URL/.*\\/([^\\/]+)$/\\1}",
"git": {
"branch": "${WERCKER_GIT_BRANCH}",
"remote": "https://${WERCKER_GIT_DOMAIN}/${WERCKER_GIT_OWNER}/${WERCKER_GIT_REPOSITORY}.git",
"revision": "${WERCKER_GIT_COMMIT}",
"branch": "${WERCKER_GIT_BRANCH}"
}
"revision": "${WERCKER_GIT_COMMIT}"
},
"name": "Wercker",
"url": "${WERCKER_RUN_URL}"
}
]
27 changes: 17 additions & 10 deletions go/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
copy-template:
cp ../CiEnvironments.json CiEnvironments.json

test: copy-template
@echo "running all tests"
@go install ./...
@go fmt ./...
@go run honnef.co/go/tools/cmd/staticcheck@v0.3.2 github.com/cucumber/ci-environment/go
go vet ./...
go test ./...
SHELL := /usr/bin/env bash

CI_ENVIRONMENTS_JSON = CiEnvironments.json

help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make <target>\n\nWhere <target> is one of:\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: help

copy-ci-environment: $(CI_ENVIRONMENTS_JSON) ## Copy CiEnvironments.json and/or generate derived files
.PHONY: copy-ci-environment

clean-ci-environment: ## Remove CiEnvironments.json and any derived files
rm -f $(GHERKIN_LANGUAGES_JSON)
.PHONY: clean-ci-environment

$(CI_ENVIRONMENTS_JSON):
cp ../CiEnvironments.json $@
13 changes: 13 additions & 0 deletions java/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SHELL := /usr/bin/env bash

help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make <target>\n\nWhere <target> is one of:\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: help

copy-ci-environment: ## Copy CiEnvironments.json and/or generate derived files
echo "Nothing to do"
.PHONY: copy-ci-environment

clean-ci-environment: ## Remove CiEnvironments.json and any derived files
echo "Nothing to do"
.PHONY: clean-ci-environment
13 changes: 13 additions & 0 deletions javascript/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SHELL := /usr/bin/env bash

help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make <target>\n\nWhere <target> is one of:\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: help

copy-ci-environment: ## Copy CiEnvironments.json and/or generate derived files
echo "Nothing to do"
.PHONY: copy-ci-environment

clean-ci-environment: ## Remove CiEnvironments.json and any derived files
echo "Nothing to do"
.PHONY: clean-ci-environment
Loading
Loading