Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cucumber/ci-environment
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.0.2
Choose a base ref
...
head repository: cucumber/ci-environment
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.0.3
Choose a head ref

Commits on Oct 18, 2021

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    ca0c687 View commit details
  2. Update URLs in gemspec (#1800)

    This changes a few of the URLs in the gemspec to point to the correct bug tracker, changelog and source code URLs.
    mvz authored Oct 18, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0e37a7c View commit details

Commits on Oct 19, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f70056c View commit details

Commits on Oct 21, 2021

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    d42c7d0 View commit details

Commits on Oct 22, 2021

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    da0a341 View commit details
  2. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    3403323 View commit details
  3. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    d1cc283 View commit details

Commits on Oct 25, 2021

  1. Copy the full SHA
    74d8639 View commit details

Commits on Oct 26, 2021

  1. Copy the full SHA
    902deff View commit details

Commits on Nov 5, 2021

  1. Copy the full SHA
    01c42dc View commit details
  2. Add renovate.json

    aurelien-reeves committed Nov 5, 2021
    Copy the full SHA
    dc490fa View commit details

Commits on Nov 10, 2021

  1. Copy the full SHA
    584e881 View commit details
  2. Update dependency @types/node to v16 (#3)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Nov 10, 2021
    Copy the full SHA
    333e2df View commit details
  3. Update dependency eslint to v8 (#8)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Nov 10, 2021
    Copy the full SHA
    400c7d4 View commit details

Commits on Nov 11, 2021

  1. Copy the full SHA
    e26d333 View commit details
  2. Copy the full SHA
    80963f8 View commit details

Commits on Nov 12, 2021

  1. [javascript] Generate ciDict.ts from ciDict.json (#5)

    * Generate ciDict.ts from ciDict.json
    
    For future conversion into hybrid esm/cjs package, we need to convert
    ciDict.json into a typescript file.
    aurelien-reeves authored Nov 12, 2021
    Copy the full SHA
    925d3b3 View commit details

Commits on Nov 15, 2021

  1. Clean-up old files used when the package was in the monorepo (#11)

    * Clean-up old files used when the package was in the monorepo
    
    * Use relative path rather than symlink to ciDict.json
    
    * Update README to remove mention to rsync
    
    * Dispatch documentation through CONTRIBUTING and ARCHITECTURE documents
    aurelien-reeves authored Nov 15, 2021
    Copy the full SHA
    294fd81 View commit details
  2. Add a release workflow (#12)

    * Add a release workflow
    
    * Test the release workflow
    
    * Make the test of the release workflow to pass
    
    * Use reusable workflows
    
    * Reuse workflows from actual branch
    
    * Add a dedicated reusable release-ruby.yml workflow
    
    * Move 'needs' from release-ruby workflow to main release workflow
    
    * Create dedicated workflows for releasing each implementation
    
    * Fix release-java workflow
    
    * Rename release-github workflow
    
    * Create a workflow for pre-release checks
    
    * Add versions when re-using prerelease-checks workflow
    
    * Finalize the release workflows
    aurelien-reeves authored Nov 15, 2021
    Copy the full SHA
    6126842 View commit details
  3. Copy the full SHA
    afd8faa View commit details
  4. Release 6.0.3

    mattwynne committed Nov 15, 2021
    Copy the full SHA
    38055ac View commit details
Showing with 6,381 additions and 922 deletions.
  1. +18 −0 .github/renovate.json
  2. +18 −0 .github/workflows/prerelease-checks.yml
  3. +25 −0 .github/workflows/release-github.yml
  4. +37 −0 .github/workflows/release-java.yml
  5. +34 −0 .github/workflows/release-javascript.yml
  6. +29 −0 .github/workflows/release-ruby.yml
  7. +39 −0 .github/workflows/test-java.yml
  8. +40 −0 .github/workflows/test-javascript.yml
  9. +37 −0 .github/workflows/test-ruby.yml
  10. +11 −0 ARCHITECTURE.md
  11. +65 −104 CHANGELOG.md
  12. +31 −0 CONTRIBUTING.md
  13. +3 −32 README.md
  14. +1 −0 RELEASING.md
  15. +0 −2 java/.gitignore
  16. +0 −4 java/.rsync
  17. +15 −0 java/.versions/rules.xml
  18. +0 −16 java/Makefile
  19. +0 −74 java/default.mk
  20. +8 −1 java/pom.xml
  21. +3 −2 java/src/main/java/io/cucumber/createmeta/CreateMeta.java
  22. +0 −142 java/src/main/resources/io/cucumber/createmeta/ciDict.json
  23. +59 −0 java/src/test/java/io/cucumber/createmeta/acceptance/CreateMetaTest.java
  24. +47 −0 javascript/.eslintrc.json
  25. +0 −3 javascript/.gitignore
  26. +6 −0 javascript/.prettierrc.json
  27. +0 −4 javascript/.rsync
  28. +0 −17 javascript/Makefile
  29. +5 −0 javascript/ciDict.ts.header
  30. +0 −87 javascript/default.mk
  31. +5,534 −0 javascript/package-lock.json
  32. +18 −4 javascript/package.json
  33. +0 −142 javascript/src/ciDict.json
  34. +146 −0 javascript/src/ciDict.ts
  35. +23 −9 javascript/src/createMeta.ts
  36. +3 −2 javascript/src/printMeta.ts
  37. +31 −0 javascript/test/acceptance/createMetaTest.ts
  38. +9 −12 javascript/test/createMetaTest.ts
  39. +1 −0 javascript/test/evaluateVariableExpressionTest.ts
  40. +2 −1 javascript/test/removeUserInfoFromUrlTest.ts
  41. +23 −0 javascript/tsconfig.base.json
  42. +7 −2 javascript/tsconfig.build.json
  43. +17 −1 javascript/tsconfig.json
  44. +6 −0 package-lock.json
  45. +0 −1 ruby/.gitignore
  46. +0 −4 ruby/.rsync
  47. +1 −1 ruby/Gemfile
  48. +0 −16 ruby/Makefile
  49. +3 −3 ruby/cucumber-create-meta.gemspec
  50. +0 −93 ruby/default.mk
  51. +0 −142 ruby/lib/cucumber/ciDict.json
  52. +1 −1 ruby/lib/cucumber/create_meta.rb
  53. +25 −0 ruby/spec/acceptance/create_meta_spec.rb
18 changes: 18 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": [
"config:base",
":preserveSemverRanges",
":rebaseStalePrs",
":disableDependencyDashboard"
],
"labels": [":robot: dependencies"],
"prHourlyLimit": 0,
"packageRules": [
{
"depTypeList": ["devDependencies", "dependencies"],
"updateTypes": ["minor", "patch"],
"automerge": true,
"automergeType": "branch"
}
]
}
18 changes: 18 additions & 0 deletions .github/workflows/prerelease-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Pre-release checks

on:
workflow_call:

jobs:

check-commit-ancestor:
name: Check commit ancestor
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Check commit has been pushed on origin/main
run: |
git fetch --quiet origin main
git merge-base --is-ancestor HEAD origin/main
25 changes: 25 additions & 0 deletions .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release create-meta on github

on:
push:
branches:
- release/*

jobs:

pre-release-check:
uses: cucumber/create-meta/.github/workflows/prerelease-checks.yml@main

create-github-release:
name: Create GitHub Release and Git tag
needs: [pre-release-check]
runs-on: ubuntu-latest
environment: Release
permissions:
contents: write

steps:
- uses: actions/checkout@v2
- uses: cucumber/action-create-github-release@v1.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/release-java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release create-meta maven package

on:
push:
branches:
- release/*

jobs:

pre-release-check:
uses: cucumber/create-meta/.github/workflows/prerelease-checks.yml@main

test-java:
uses: cucumber/create-meta/.github/workflows/test-java.yml@main

publish-mvn:
name: Publish Maven Package
needs: [pre-release-check, test-java]
runs-on: ubuntu-latest
environment: Release

steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'

- uses: cucumber/action-publish-mvn@v1.0.0
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
nexus-username: cukebot
nexus-password: ${{ secrets.SONATYPE_PASSWORD }}
working-directory: java
34 changes: 34 additions & 0 deletions .github/workflows/release-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release create-meta npm module

on:
push:
branches:
- release/*

jobs:

pre-release-check:
uses: cucumber/create-meta/.github/workflows/prerelease-checks.yml@main

test-javascript:
uses: cucumber/create-meta/.github/workflows/test-javascript.yml@main

publish-npm:
name: Publish NPM module
needs: [pre-release-check, test-javascript]
runs-on: ubuntu-latest
environment: Release

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '17'
cache: 'npm'
cache-dependency-path: javascript/package-lock.json

- uses: cucumber/action-publish-npm@v1.0.0
with:
npm-token: ${{ secrets.NPM_TOKEN }}
working-directory: javascript
29 changes: 29 additions & 0 deletions .github/workflows/release-ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release create-meta ruby gem

on:
push:
branches:
- release/*

jobs:

pre-release-check:
uses: cucumber/create-meta/.github/workflows/prerelease-checks.yml@main

test-ruby:
uses: cucumber/create-meta/.github/workflows/test-ruby.yml@main

publish-rubygem:
name: Publish Ruby Gem
needs: [pre-release-check, test-ruby]
runs-on: ubuntu-latest
environment: Release

steps:
- uses: actions/checkout@v2

- name: Publish ruby gem
uses: cucumber/action-publish-rubygem@v1.0.0
with:
working_directory: ruby
rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}
39 changes: 39 additions & 0 deletions .github/workflows/test-java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: test-java

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_call:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
java: ['11', '16']
include:
- os: windows-latest
java: '16'
- os: macos-latest
java: '16'

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- run: mvn install
working-directory: java
- run: mvn test
working-directory: java
- run: ./scripts/check-jar.sh
working-directory: java
40 changes: 40 additions & 0 deletions .github/workflows/test-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: test-javascript

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_call:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node-version: ['12.x', '14.x', '16.x']
include:
- os: windows-latest
node-version: '16.x'
- os: macos-latest
node-version: '16.x'

steps:
- name: set git core.autocrlf to 'input'
run: git config --global core.autocrlf input
- uses: actions/checkout@v2
- name: with Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: javascript/package-lock.json
- run: npm install-test
working-directory: javascript
- run: npm run eslint
working-directory: javascript
37 changes: 37 additions & 0 deletions .github/workflows/test-ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: test-ruby

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_call:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
ruby: ['2.5', '2.6', '2.7', '3.0']
include:
- os: windows-latest
ruby: '3.0'
- os: macos-latest
ruby: '3.0'

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
working-directory: ruby
- name: bundle exec rspec
working-directory: ruby
run: bundle exec rspec
11 changes: 11 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Architecture

## CI definitions

The `ciDict.json` file contains definitions of various CI servers. Each property of a CI
server definition is an expression that evaluates a value from one or more environment variables.

The expression syntax for environment variables can use the form `${variable/pattern/replacement}`,
similar to [bash parameter substitution](https://tldp.org/LDP/abs/html/parameter-substitution.html),
but inspired from [sed's s command](https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html)
which provides support for capture group back-references in the replacement.
169 changes: 65 additions & 104 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,165 +1,126 @@
# CHANGE LOG
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

----
## [Unreleased]

### Added

### Changed

### Deprecated

### Removed

## [6.0.3] - 2021-11-15
### Fixed
- [JavaScript] Removed tag property from git object if it is undefined
([PR#4](https://github.com/cucumber/create-meta/pull/4))

## [6.0.2] - 2021-10-18

### Fixed

- [Ruby] Generate cucumber messages rather than plain ruby hashes
([PR#1772](https://github.com/cucumber/common/pull/1772))
([PR#1772](https://github.com/cucumber/common/pull/1772))

## [6.0.1] - 2021-07-19

### Changed

* Upgrade `cucumber-messages` to v17.0.1
- Upgrade `cucumber-messages` to v17.0.1

## [6.0.0] - 2021-07-08

### Added

* Detect and populate `Ci#buildNumber` for all supported CI servers.
([#1632](https://github.com/cucumber/common/pull/1632)
[#1606](https://github.com/cucumber/common/issues/1606)
[aslakhellesoy])
- Detect and populate `Ci#buildNumber` for all supported CI servers.
([#1632](https://github.com/cucumber/common/pull/1632)
[#1606](https://github.com/cucumber/common/issues/1606)
[aslakhellesoy](https://github.com/aslakhellesoy))

### Changed
* [Java] Removed implicit utility class constructors and made classes final

### Removed

* Removed support for TeamCity since it doesn't seem to expose enough environment variables.
- [Java] Removed implicit utility class constructors and made classes final

### Fixed
- Improve detection of Bamboo environment variables
- Improve detection of Azure environment variables
- Fix `Git#remote` for CodeFresh

* Improve detection of Bamboo environment variables
* Improve detection of Azure environment variables
* Fix `Git#remote` for CodeFresh
### Removed
- Removed support for TeamCity since it doesn't seem to expose enough environment variables.

## [5.0.0] - 2021-05-17

### Added

* Added support for [Jenkins](https://www.jenkins.io/) (via the [Git plugin](https://plugins.jenkins.io/git/))
([#1253](https://github.com/cucumber/common/issues/1253)
[#1553](https://github.com/cucumber/common/pull/1553)
[aslakhellesoy])
* Added support for [Bitrise](https://www.bitrise.io/)
([#1490](https://github.com/cucumber/common/issues/1490)
[#1553](https://github.com/cucumber/common/pull/1553)
[aslakhellesoy])
* Added support for [CodeFresh](https://codefresh.io/)
([#1553](https://github.com/cucumber/common/pull/1553)
[aslakhellesoy])
* Added support for [CodeShip](https://www.cloudbees.com/products/codeship)
([#1553](https://github.com/cucumber/common/pull/1553)
[aslakhellesoy])
- Added support for [Jenkins](https://www.jenkins.io/) (via the [Git plugin](https://plugins.jenkins.io/git/))
([#1253](https://github.com/cucumber/common/issues/1253)
[#1553](https://github.com/cucumber/common/pull/1553)
[aslakhellesoy](https://github.com/aslakhellesoy))
- Added support for [Bitrise](https://www.bitrise.io/)
([#1490](https://github.com/cucumber/common/issues/1490)
[#1553](https://github.com/cucumber/common/pull/1553)
[aslakhellesoy](https://github.com/aslakhellesoy))
- Added support for [CodeFresh](https://codefresh.io/)
([#1553](https://github.com/cucumber/common/pull/1553)
[aslakhellesoy](https://github.com/aslakhellesoy))
- Added support for [CodeShip](https://www.cloudbees.com/products/codeship)
([#1553](https://github.com/cucumber/common/pull/1553)
[aslakhellesoy](https://github.com/aslakhellesoy))

### Changed

* Upgrade messages to 16.0.0
- Upgrade messages to 16.0.0

### Fixed

* Fixed detection of Semaphore build url.
* Fixed detection of GoCD build url.
- Fixed detection of Semaphore build url.
- Fixed detection of GoCD build url.

## [4.0.0] - 2021-03-29

### Changed

* Upgrade messages to 15.0.0
- Upgrade messages to 15.0.0

## [3.0.0] - 2021-02-09

### Changed

* Upgrade messages to 14.0.1
- Upgrade messages to 14.0.1

## [2.0.4] - 2020-10-29

### Fixed

* Handle null values in ci dict
([#1228](https://github.com/cucumber/cucumber/issues/1228)
[#1229](https://github.com/cucumber/cucumber/pull/1229)
[kgeilmann])
- Handle null values in ci dict
([#1228](https://github.com/cucumber/cucumber/issues/1228)
[#1229](https://github.com/cucumber/cucumber/pull/1229)
[kgeilmann](https://github.com/kgeilmann))

## [2.0.2] - 2020-09-03

### Security fixes

* remove credentials in git remote [#1168](https://github.com/cucumber/cucumber/pull/1168)

## [2.0.1] - 2020-08-18

### Fixed

* Ruby: Add the ci property to meta message
- Ruby: Add the ci property to meta message

## [2.0.0] - 2020-08-07

### Changed

* Update `messages` to 13.0.1
- Update `messages` to 13.0.1

### Fixed

* Java: Use `java.vm.name` instead of `java.vendor` (which is `N/A` on OpenJDK)
* Java: Use `java.vm.version` instead of `java.version`
* Support GitHub Enterprise by using `GITHUB_SERVER_URL` to construct URLs
- Java: Use `java.vm.name` instead of `java.vendor` (which is `N/A` on OpenJDK)
- Java: Use `java.vm.version` instead of `java.version`
- Support GitHub Enterprise by using `GITHUB_SERVER_URL` to construct URLs

## [1.2.0] - 2020-07-31

### Changed

* Updated `messages` to v12.4.0
- Updated `messages` to v12.4.0

## [1.1.0] - 2020-07-30

### Changed

* Updated `messages` to v12.3.2
- Updated `messages` to v12.3.2

## [1.0.0] - 2020-06-29

### Added

* First release

<!-- Releases -->
[Unreleased]: https://github.com/cucumber/cucumber/compare/create-meta/v6.0.2...main
[6.0.2]: https://github.com/cucumber/cucumber/compare/create-meta/v6.0.1...create-meta/v6.0.2
[6.0.1]: https://github.com/cucumber/cucumber/compare/create-meta/v6.0.0...create-meta/v6.0.1
[6.0.0]: https://github.com/cucumber/cucumber/compare/create-meta/v5.0.0...create-meta/v6.0.0
[5.0.0]: https://github.com/cucumber/cucumber/compare/create-meta/v4.0.0...create-meta/v5.0.0
[4.0.0]: https://github.com/cucumber/cucumber/compare/create-meta/v3.0.0...create-meta/v4.0.0
[3.0.0]: https://github.com/cucumber/cucumber/compare/create-meta/v2.0.4...create-meta/v3.0.0
[2.0.4]: https://github.com/cucumber/cucumber/compare/create-meta/v2.0.2...create-meta/v2.0.4
[2.0.2]: https://github.com/cucumber/cucumber/compare/create-meta/v2.0.1...create-meta/v2.0.2
[2.0.1]: https://github.com/cucumber/cucumber/compare/create-meta/v2.0.0...create-meta/v2.0.1
[2.0.0]: https://github.com/cucumber/cucumber/compare/create-meta/v1.2.0...create-meta/v2.0.0
[1.2.0]: https://github.com/cucumber/cucumber/compare/create-meta/v1.1.0...create-meta/v1.2.0
[1.1.0]: https://github.com/cucumber/cucumber/compare/create-meta/v1.0.0...create-meta/v1.1.0
[1.0.0]: https://github.com/cucumber/cucumber/releases/tag/create-meta/v1.0.0

<!-- Contributors in alphabetical order -->
- First release

[Unreleased]: https://github.com/cucumber/create-meta/compare/v6.0.3...main
[6.0.3]: https://github.com/cucumber/create-meta/compare/v6.0.2...main
[6.0.2]: https://github.com/cucumber/create-meta/compare/v6.0.1...v6.0.2
[6.0.1]: https://github.com/cucumber/create-meta/compare/v6.0.0...v6.0.1
[6.0.0]: https://github.com/cucumber/create-meta/compare/v5.0.0...v6.0.0
[5.0.0]: https://github.com/cucumber/create-meta/compare/v4.0.0...v5.0.0
[4.0.0]: https://github.com/cucumber/create-meta/compare/v3.0.0...v4.0.0
[3.0.0]: https://github.com/cucumber/create-meta/compare/v2.0.4...v3.0.0
[2.0.4]: https://github.com/cucumber/create-meta/compare/v2.0.2...v2.0.4
[2.0.2]: https://github.com/cucumber/create-meta/compare/v2.0.1...v2.0.2
[2.0.1]: https://github.com/cucumber/create-meta/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/cucumber/create-meta/compare/v1.2.0...v2.0.0
[1.2.0]: https://github.com/cucumber/create-meta/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/cucumber/create-meta/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/cucumber/cucumber/releases/tag/v1.0.0
in alphabetical order -->
[aslakhellesoy]: https://github.com/aslakhellesoy
[kgeilmann]: https://github.com/kgeilmann
[vincent-psarga]: https://github.com/vincent-psarga
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contributing

Thank you for considering contributing to Cucumber create-meta!

## Code of Conduct

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

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

Here are the steps:

* Modify the file `ciDict.json`, using environment variables to extract information.
See [ARCHITECTURE.md](./ARCHITECTURE.md#ci-definitions) for more information on
`ciDict.json`.
* Add an approval test in `testdata/YourCi.txt` and `testdata/YourCi.txt.json`.

Then build and run the tests for all implementations:

cd java && mvn test
cd ../javascript && npm test
cd ../ruby && bundle exec rspec

If all tests pass, commit your code and send us a pull request. Bonus points if you
also update `CHANGELOG.md` and `README.md`.

You might want to look at the source code for [danger](https://github.com/danger/danger/tree/master/lib/danger/ci_source)
to understand how various CI server environment variables should be interpreted.
35 changes: 3 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# createMeta

Utility function for creating system-specific `Meta` messages.

## CI
## Supported CI systems

The `ci` field of the `Meta` message contains values from environment variables
defined by the following supported CI and build servers:
@@ -22,34 +21,6 @@ defined by the following supported CI and build servers:
* [Travis CI](https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables)
* [Wercker](https://devcenter.wercker.com/administration/environment-variables/available-env-vars/)

### Adding support for new CI servers

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

Here are the steps:

* Modify the top level `ciDict.json`, using environment variables to extract information.
* Add an approval test in `testdata/YourCi.txt` and `testdata/YourCi.txt.json`.
* Make copies of the modified files to all the implementations:

# From a bash shell
source ../scripts/functions.sh && rsync_files

Then build and run the tests:

make clean && make

If all tests pass, commit your code and send us a pull request. Bonus points if you
also update `CHANGELOG.md` and `README.md`.

You might want to look at the source code for [danger](https://github.com/danger/danger/tree/master/lib/danger/ci_source)
to understand how various CI server environment variables should be interpreted.

## CI definitions

The `ciDict.json` file contains definitions of various CI servers. Each property of a CI
server definition is an expression that evaluates a value from one or more environment variables.
## Adding new CI system / contributing

The expression syntax for environment variables can use the form `${variable/pattern/replacement}`,
similar to [bash parameter substitution](https://tldp.org/LDP/abs/html/parameter-substitution.html),
but inspired from [sed's s command](https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html) which provides support for capture group back-references in the replacement.
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for more information.
1 change: 1 addition & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See [.github/RELEASING](https://github.com/cucumber/.github/blob/main/RELEASING.md).
2 changes: 0 additions & 2 deletions java/.gitignore
Original file line number Diff line number Diff line change
@@ -12,5 +12,3 @@ dependency-reduced-pom.xml
.tested*
.compared
.built
# Approval tests
acceptance/
4 changes: 0 additions & 4 deletions java/.rsync

This file was deleted.

15 changes: 15 additions & 0 deletions java/.versions/rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
comparisonMethod="maven"
xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0"
xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 https://www.mojohaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<ignoreVersions>
<ignoreVersion type="regex">.*(-|.)(A|a)lpha-?[\da-z]+</ignoreVersion>
<ignoreVersion type="regex">.*(-|.)(B|b)(ETA|eta)-?[\da-z]+</ignoreVersion>
<ignoreVersion type="regex">.*-b[\d.]+</ignoreVersion>
<ignoreVersion type="regex">.*-pr\d+</ignoreVersion>
<ignoreVersion type="regex">.*[-.]rc-?\d+</ignoreVersion>
<ignoreVersion type="regex">.*[-.]RC-?\d+</ignoreVersion>
<ignoreVersion type="regex">.*-M\d+</ignoreVersion>
<ignoreVersion type="regex">.*-milestone\d+</ignoreVersion>
</ignoreVersions>
</ruleset>
16 changes: 0 additions & 16 deletions java/Makefile

This file was deleted.

74 changes: 0 additions & 74 deletions java/default.mk

This file was deleted.

9 changes: 8 additions & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
</parent>

<artifactId>create-meta</artifactId>
<version>6.0.2</version>
<version>6.0.3-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Cucumber create meta</name>
<description>Produce the meta message for Cucumber-JVM</description>
@@ -68,6 +68,13 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
5 changes: 3 additions & 2 deletions java/src/main/java/io/cucumber/createmeta/CreateMeta.java
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.FileInputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
@@ -23,10 +24,10 @@

public final class CreateMeta {
private static final JsonObject CI_DICT;
private static final String JSON_PATH = "/io/cucumber/createmeta/ciDict.json";
private static final String JSON_PATH = "../ciDict.json";

static {
try (Reader reader = new InputStreamReader(CreateMeta.class.getResourceAsStream(JSON_PATH), UTF_8)) {
try (Reader reader = new InputStreamReader(new FileInputStream(JSON_PATH), UTF_8)) {
CI_DICT = Json.parse(reader).asObject();
} catch (IOException e) {
throw new RuntimeException("Unable to parse " + JSON_PATH, e);
142 changes: 0 additions & 142 deletions java/src/main/resources/io/cucumber/createmeta/ciDict.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package io.cucumber.createmeta.acceptance;

import io.cucumber.messages.types.Ci;
import io.cucumber.messages.types.Meta;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import java.io.File;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.nio.file.Path;
import java.nio.file.Paths;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

import static io.cucumber.createmeta.CreateMeta.createMeta;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static java.nio.file.Files.newDirectoryStream;

class CreateMetaTest {
private final ObjectMapper mapper = new ObjectMapper()
.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);

@Test
void it_creates_meta_with_right_ci_info() throws IOException, FileNotFoundException{
List<Path> paths = new ArrayList<>();
newDirectoryStream(Paths.get("..", "testdata")).forEach(paths::add);

for(Path path: paths) {
if (path.toString().endsWith(".txt")) {
BufferedReader in = new BufferedReader(new FileReader(path.toString()));
String line;
HashMap<String, String> env = new HashMap<>();

while ((line = in.readLine()) != null) {
String[] parts = line.split("=");

if (parts.length == 1) {
env.put(parts[0], "");
} else {
env.put(parts[0], parts[1]);
}
}

Meta meta = createMeta("cucumber-jvm", "1.2.3", env);

Ci expectedCi = mapper.readValue(new File(path.toString() + ".json"), Ci.class);

assertEquals(expectedCi, meta.getCi());
}
}
}
}
47 changes: 47 additions & 0 deletions javascript/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"env": {
"browser": false,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": [
"import",
"simple-import-sort",
"node",
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:import/typescript",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"rules": {
"import/no-cycle": "error",
"node/no-extraneous-import": "error",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error"
},
"overrides": [
{
"files": ["test/**"],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off"
}
}
]
}
3 changes: 0 additions & 3 deletions javascript/.gitignore
Original file line number Diff line number Diff line change
@@ -3,16 +3,13 @@ dist/
.nyc_output/
coverage/
node_modules/
yarn.lock
package-lock.json
*.log
.deps
.tested*
.linted
.built*
.compared
.codegen
acceptance/
storybook-static
*-go
*.iml
6 changes: 6 additions & 0 deletions javascript/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"semi": false,
"singleQuote": true,
"printWidth": 100
}
4 changes: 0 additions & 4 deletions javascript/.rsync

This file was deleted.

17 changes: 0 additions & 17 deletions javascript/Makefile

This file was deleted.

5 changes: 5 additions & 0 deletions javascript/ciDict.ts.header
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This file is auto-generated using npm run build-ci-dict

import { CiDict } from './types'

export const ciDict: CiDict =
87 changes: 0 additions & 87 deletions javascript/default.mk

This file was deleted.

5,534 changes: 5,534 additions & 0 deletions javascript/package-lock.json

Large diffs are not rendered by default.

22 changes: 18 additions & 4 deletions javascript/package.json
Original file line number Diff line number Diff line change
@@ -5,9 +5,13 @@
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"scripts": {
"pretest": "npm run build-ci-dict",
"test": "mocha",
"prepublishOnly": "tsc --build tsconfig.build.json",
"print-meta": "ts-node --require source-map-support/register --require tsconfig-paths/register ./src/printMeta.ts"
"print-meta": "ts-node --require source-map-support/register --require tsconfig-paths/register ./src/printMeta.ts",
"eslint-fix": "eslint --ext ts,tsx --max-warnings 0 --fix src test",
"eslint": "eslint --ext ts,tsx --max-warnings 0 src test",
"build-ci-dict": "cat ciDict.ts.header > src/ciDict.ts && cat ../ciDict.json >> src/ciDict.ts && eslint --fix src/ciDict.ts"
},
"repository": {
"type": "git",
@@ -23,12 +27,22 @@
},
"homepage": "https://github.com/cucumber/cucumber",
"devDependencies": {
"@types/glob": "7.1.4",
"@types/glob": "7.2.0",
"@types/mocha": "9.0.0",
"@types/node": "14.17.27",
"@types/node": "16.11.7",
"@typescript-eslint/eslint-plugin": "5.3.1",
"@typescript-eslint/parser": "5.3.1",
"eslint": "8.2.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-simple-import-sort": "7.0.0",
"mocha": "9.1.3",
"prettier": "2.4.1",
"source-map-support": "0.5.20",
"ts-node": "10.3.0",
"ts-node": "10.4.0",
"tsconfig-paths": "3.11.0",
"typescript": "4.4.4"
},
"dependencies": {
142 changes: 0 additions & 142 deletions javascript/src/ciDict.json

This file was deleted.

146 changes: 146 additions & 0 deletions javascript/src/ciDict.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
// This file is auto-generated using npm run build-ci-dict

import { CiDict } from './types'

export const ciDict: CiDict = {
'Azure Pipelines': {
url: '${BUILD_BUILDURI}',
buildNumber: '${BUILD_BUILDNUMBER}',
git: {
remote: '${BUILD_REPOSITORY_URI}',
revision: '${BUILD_SOURCEVERSION}',
branch: '${BUILD_SOURCEBRANCH/refs/heads/(.*)/\\1}',
tag: '${BUILD_SOURCEBRANCH/refs/tags/(.*)/\\1}',
},
},
Bamboo: {
url: '${bamboo_buildResultsUrl}',
buildNumber: '${bamboo_buildNumber}',
git: {
remote: '${bamboo_planRepository_repositoryUrl}',
revision: '${bamboo_planRepository_revision}',
branch: '${bamboo_planRepository_branch}',
tag: null,
},
},
Buddy: {
url: '${BUDDY_EXECUTION_URL}',
buildNumber: '${BUDDY_EXECUTION_ID}',
git: {
remote: '${BUDDY_SCM_URL}',
revision: '${BUDDY_EXECUTION_REVISION}',
branch: '${BUDDY_EXECUTION_BRANCH}',
tag: '${BUDDY_EXECUTION_TAG}',
},
},
Bitrise: {
url: '${BITRISE_BUILD_URL}',
buildNumber: '${BITRISE_BUILD_NUMBER}',
git: {
remote: '${GIT_REPOSITORY_URL}',
revision: '${BITRISE_GIT_COMMIT}',
branch: '${BITRISE_GIT_BRANCH}',
tag: '${BITRISE_GIT_TAG}',
},
},
CircleCI: {
url: '${CIRCLE_BUILD_URL}',
buildNumber: '${CIRCLE_BUILD_NUM}',
git: {
remote: '${CIRCLE_REPOSITORY_URL}',
revision: '${CIRCLE_SHA1}',
branch: '${CIRCLE_BRANCH}',
tag: '${CIRCLE_TAG}',
},
},
CodeFresh: {
url: '${CF_BUILD_URL}',
buildNumber: '${CF_BUILD_ID}',
git: {
remote: '${CF_COMMIT_URL/(.*)\\/commit.+$/\\1}.git',
revision: '${CF_REVISION}',
branch: '${CF_BRANCH}',
tag: null,
},
},
CodeShip: {
url: '${CI_BUILD_URL}',
buildNumber: '${CI_BUILD_NUMBER}',
git: {
remote: '${CI_PULL_REQUEST/(.*)\\/pull\\/\\d+/\\1.git}',
revision: '${CI_COMMIT_ID}',
branch: '${CI_BRANCH}',
tag: null,
},
},
'GitHub Actions': {
url: '${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}',
buildNumber: '${GITHUB_RUN_ID}',
git: {
remote: '${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git',
revision: '${GITHUB_SHA}',
branch: '${GITHUB_REF/refs/heads/(.*)/\\1}',
tag: '${GITHUB_REF/refs/tags/(.*)/\\1}',
},
},
GitLab: {
url: '${CI_JOB_URL}',
buildNumber: '${CI_JOB_ID}',
git: {
remote: '${CI_REPOSITORY_URL}',
revision: '${CI_COMMIT_SHA}',
branch: '${CI_COMMIT_BRANCH}',
tag: '${CI_COMMIT_TAG}',
},
},
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: {
remote: '${GO_SCM_*_PR_URL/(.*)\\/pull\\/\\d+/\\1.git}',
revision: '${GO_REVISION}',
branch: '${GO_SCM_*_PR_BRANCH/.*:(.*)/\\1}',
tag: null,
},
},
Jenkins: {
url: '${BUILD_URL}',
buildNumber: '${BUILD_NUMBER}',
git: {
remote: '${GIT_URL}',
revision: '${GIT_COMMIT}',
branch: '${GIT_LOCAL_BRANCH}',
tag: null,
},
},
Semaphore: {
url: '${SEMAPHORE_ORGANIZATION_URL}/jobs/${SEMAPHORE_JOB_ID}',
buildNumber: '${SEMAPHORE_JOB_ID}',
git: {
remote: '${SEMAPHORE_GIT_URL}',
revision: '${SEMAPHORE_GIT_SHA}',
branch: '${SEMAPHORE_GIT_BRANCH}',
tag: '${SEMAPHORE_GIT_TAG_NAME}',
},
},
'Travis CI': {
url: '${TRAVIS_BUILD_WEB_URL}',
buildNumber: '${TRAVIS_JOB_NUMBER}',
git: {
remote: 'https://github.com/${TRAVIS_REPO_SLUG}.git',
revision: '${TRAVIS_COMMIT}',
branch: '${TRAVIS_BRANCH}',
tag: '${TRAVIS_TAG}',
},
},
Wercker: {
url: '${WERCKER_RUN_URL}',
buildNumber: '${WERCKER_RUN_URL/.*\\/([^\\/]+)$/\\1}',
git: {
remote: 'https://${WERCKER_GIT_DOMAIN}/${WERCKER_GIT_OWNER}/${WERCKER_GIT_REPOSITORY}.git',
revision: '${WERCKER_GIT_COMMIT}',
branch: '${WERCKER_GIT_BRANCH}',
tag: null,
},
},
}
32 changes: 23 additions & 9 deletions javascript/src/createMeta.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import os from 'os'
import { parse as parseUrl, format as formatUrl } from 'url'
import * as messages from '@cucumber/messages'
import defaultCiDict from './ciDict.json'
import os from 'os'
import { format as formatUrl, parse as parseUrl } from 'url'

import { ciDict as defaultCiDict } from './ciDict'
import evaluateVariableExpression from './evaluateVariableExpression'
import { CiDict, CiSystem, Env } from './types'

type GitInfo = {
remote: string
revision: string
branch: string
tag?: string
}

export default function createMeta(
toolName: string,
toolVersion: string,
@@ -77,15 +85,21 @@ function createCi(ciName: string, ciSystem: CiSystem, envDict: Env): messages.Ci
}

const branch = evaluateVariableExpression(ciSystem.git.branch, envDict)
const tag = evaluateVariableExpression(ciSystem.git.tag, envDict)
const git: GitInfo = {
remote: removeUserInfoFromUrl(evaluateVariableExpression(ciSystem.git.remote, envDict)),
revision: evaluateVariableExpression(ciSystem.git.revision, envDict),
branch: branch,
}

if (tag) {
git['tag'] = tag
}

return {
name: ciName,
url,
buildNumber,
git: {
remote: removeUserInfoFromUrl(evaluateVariableExpression(ciSystem.git.remote, envDict)),
revision: evaluateVariableExpression(ciSystem.git.revision, envDict),
branch: branch,
tag: evaluateVariableExpression(ciSystem.git.tag, envDict),
},
git: git,
}
}
5 changes: 3 additions & 2 deletions javascript/src/printMeta.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { promises as fs } from 'fs'
import { detectCI } from './createMeta'
import ciDict from './ciDict.json'
import { Writable } from 'stream'

import { ciDict } from './ciDict'
import { detectCI } from './createMeta'

export async function main(envPath: string, stdout: Writable) {
const envData = await fs.readFile(envPath, 'utf-8')
const entries = envData.split('\n').map((line) => line.split('='))
31 changes: 31 additions & 0 deletions javascript/test/acceptance/createMetaTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import assert from 'assert'
import fs from 'fs'
import path from 'path'

import CreateMeta from '../../src/createMeta'
import { Env } from '../../src/types'

const TEST_DATA_DIR = '../testdata'

describe('CreateMeta', () => {
const test_data_files = fs.readdirSync(TEST_DATA_DIR)

test_data_files.forEach((test_data_file) => {
if (path.extname(test_data_file) !== '.txt') {
return
}

const env_data = fs.readFileSync(`${TEST_DATA_DIR}/${test_data_file}`, { encoding: 'utf8' })
const entries = env_data.split(/\n/).map((line) => line.split(/=/))
const env: Env = Object.fromEntries(entries)
const meta = CreateMeta('cucumber-something', '1.2.3', env)

const expected_json = fs.readFileSync(`${TEST_DATA_DIR}/${test_data_file}.json`, {
encoding: 'utf8',
})

it(`with ${path.basename(test_data_file, '.txt')}`, () => {
assert.deepStrictEqual(meta.ci, JSON.parse(expected_json))
})
})
})
21 changes: 9 additions & 12 deletions javascript/test/createMetaTest.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import createMeta from '../src/createMeta'
import assert from 'assert'
import ciDict from '../src/ciDict.json'
import * as messages from '@cucumber/messages'
import assert from 'assert'

import createMeta from '../src/createMeta'

describe('createMeta', () => {
it('defines the implementation product', () => {
@@ -21,7 +21,7 @@ describe('createMeta', () => {
CIRCLE_BUILD_NUM: '234',
}

const meta = createMeta('someTool', '1.2.3', envDict, ciDict)
const meta = createMeta('someTool', '1.2.3', envDict)
const ci: messages.Ci = {
name: 'CircleCI',
url: 'the-url',
@@ -45,7 +45,7 @@ describe('createMeta', () => {
GITHUB_REF: 'refs/tags/the-tag',
}

const meta = createMeta('someTool', '1.2.3', envDict, ciDict)
const meta = createMeta('someTool', '1.2.3', envDict)
const ci: messages.Ci = {
name: 'GitHub Actions',
url: 'https://github.com/cucumber/cucumber-ruby/actions/runs/140170388',
@@ -69,7 +69,7 @@ describe('createMeta', () => {
GITHUB_REF: 'refs/heads/the-branch',
}

const meta = createMeta('someTool', '1.2.3', envDict, ciDict)
const meta = createMeta('someTool', '1.2.3', envDict)
const ci: messages.Ci = {
name: 'GitHub Actions',
url: 'https://github.company.com/cucumber/cucumber-ruby/actions/runs/140170388',
@@ -78,7 +78,6 @@ describe('createMeta', () => {
remote: 'https://github.company.com/cucumber/cucumber-ruby.git',
branch: 'the-branch',
revision: 'the-revision',
tag: undefined,
},
}
assert.deepStrictEqual(meta.ci, ci)
@@ -93,7 +92,7 @@ describe('createMeta', () => {
BUILD_BUILDNUMBER: '456',
}

const meta = createMeta('someTool', '1.2.3', envDict, ciDict)
const meta = createMeta('someTool', '1.2.3', envDict)
const ci: messages.Ci = {
name: 'Azure Pipelines',
url: 'the-url',
@@ -102,7 +101,6 @@ describe('createMeta', () => {
remote: 'the-remote',
branch: 'main',
revision: 'the-revision',
tag: undefined,
},
}
assert.deepStrictEqual(meta.ci, ci)
@@ -117,7 +115,7 @@ describe('createMeta', () => {
BUILD_BUILDNUMBER: '456',
}

const meta = createMeta('someTool', '1.2.3', envDict, ciDict)
const meta = createMeta('someTool', '1.2.3', envDict)
const ci: messages.Ci = {
name: 'Azure Pipelines',
url: 'the-url',
@@ -142,11 +140,10 @@ describe('createMeta', () => {
WERCKER_RUN_URL: 'https://cihost.com/path/to/build/629af084064c2',
}

const meta = createMeta('someTool', '1.2.3', envDict, ciDict)
const meta = createMeta('someTool', '1.2.3', envDict)
const ci: messages.Ci = {
git: {
branch: 'main',
tag: undefined,
remote: 'https://github.com/cucumber-ltd/shouty.rb.git',
revision: '057f8fe233b17629af084064c2a7b8d1dbb795ad',
},
1 change: 1 addition & 0 deletions javascript/test/evaluateVariableExpressionTest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import assert from 'assert'

import evaluateVariableExpression from '../src/evaluateVariableExpression'

describe('createMeta', () => {
3 changes: 2 additions & 1 deletion javascript/test/removeUserInfoFromUrlTest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { removeUserInfoFromUrl } from '../src/createMeta'
import assert from 'assert'

import { removeUserInfoFromUrl } from '../src/createMeta'

describe('removeUserInfoFromUrl', () => {
it('returns undefined for undefined', () => {
assert.strictEqual(removeUserInfoFromUrl(undefined), undefined)
23 changes: 23 additions & 0 deletions javascript/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"declaration": true,
"target": "es2018",
"lib": [
"es2019",
"dom"
],
"sourceMap": true,
"allowJs": false,
"jsx": "react",
"resolveJsonModule": true,
"module": "commonjs",
"esModuleInterop": true,
"noImplicitAny": true,
"moduleResolution": "node",
"outDir": "dist",
"downlevelIteration": true,
"skipLibCheck": true,
"strictNullChecks": false,
"experimentalDecorators": true
}
}
9 changes: 7 additions & 2 deletions javascript/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"extends": "../../tsconfig.build.json",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"target": "es6",
"module": "commonjs",
"rootDir": ".",
"outDir": "dist"
},
"include": [
"src/ciDict.json",
"src",
"test"
]
18 changes: 17 additions & 1 deletion javascript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
{
"extends": "../../tsconfig.json"
"extends": "./tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@cucumber/messages": ["messages/javascript"],
"@cucumber/message-streams": ["message-streams/javascript"],
"@cucumber/gherkin": ["gherkin/javascript/src/index.ts"],
"@cucumber/gherkin-streams": ["gherkin-streams/javascript/src/index.ts"],
"@cucumber/gherkin-utils": ["gherkin-utils/javascript/src/index.ts"],
"@cucumber/create-meta": ["create-meta/javascript/src/index.ts"],
"@cucumber/fake-cucumber": ["fake-cucumber/javascript/src/index.ts"],
"@cucumber/query": ["query/javascript/src/index.ts"],
"@cucumber/compatibility-kit": ["compatibility-kit/javascript/src/index.ts"],
"@cucumber/react": ["react/javascript/src/index.ts"]
},
"noEmit": true
}
}
6 changes: 6 additions & 0 deletions package-lock.json
1 change: 0 additions & 1 deletion ruby/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Gemfile.lock
coverage/
acceptance/
pkg/
*.gem
.compared
4 changes: 0 additions & 4 deletions ruby/.rsync

This file was deleted.

2 changes: 1 addition & 1 deletion ruby/Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
source "https://rubygems.org"

#gem 'cucumber-messages', :path => File.dirname(__FILE__) + '/../../messages/ruby'
gem 'rubocop'

gemspec
16 changes: 0 additions & 16 deletions ruby/Makefile

This file was deleted.

6 changes: 3 additions & 3 deletions ruby/cucumber-create-meta.gemspec
Original file line number Diff line number Diff line change
@@ -15,11 +15,11 @@ Gem::Specification.new do |s|
s.required_ruby_version = ">= 2.3"

s.metadata = {
'bug_tracker_uri' => 'https://github.com/cucumber/cucumber/issues',
'changelog_uri' => 'https://github.com/cucumber/common/blob/main/gherkin/CHANGELOG.md',
'bug_tracker_uri' => 'https://github.com/cucumber/common/issues',
'changelog_uri' => 'https://github.com/cucumber/common/blob/main/create-meta/CHANGELOG.md',
'documentation_uri' => 'https://cucumber.io/docs/gherkin/',
'mailing_list_uri' => 'https://groups.google.com/forum/#!forum/cukes',
'source_code_uri' => 'https://github.com/cucumber/common/blob/main/gherkin/ruby',
'source_code_uri' => 'https://github.com/cucumber/common/tree/main/create-meta/ruby',
}

s.add_dependency 'cucumber-messages', '~> 17.1', '>= 17.1.1'
93 changes: 0 additions & 93 deletions ruby/default.mk

This file was deleted.

142 changes: 0 additions & 142 deletions ruby/lib/cucumber/ciDict.json

This file was deleted.

2 changes: 1 addition & 1 deletion ruby/lib/cucumber/create_meta.rb
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
module Cucumber
module CreateMeta
extend Cucumber::CreateMeta::VariableExpression
CI_DICT = JSON.parse(IO.read(File.join(File.dirname(__FILE__), "ciDict.json")))
CI_DICT = JSON.parse(IO.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'ciDict.json')))

def create_meta(tool_name, tool_version, env = ENV)
Cucumber::Messages::Meta.new(
25 changes: 25 additions & 0 deletions ruby/spec/acceptance/create_meta_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

require 'cucumber/create_meta'
require 'json'

TEST_DATA_DIR = '../testdata'

describe 'CreateMeta' do
Dir.each_child(TEST_DATA_DIR) do |test_data_file|
next unless File.extname(test_data_file) == '.txt'

context "with #{File.basename(test_data_file, '.*')}" do
subject { JSON.parse(meta.ci.to_json) }

let(:meta) { Cucumber::CreateMeta.create_meta('cucumber-something', '1.2.3', env) }
let(:env) { Hash[entries] }
let(:entries) { env_data.split(/\n/).map { |line| line.split(/=/) } }
let(:env_data) { IO.read("#{TEST_DATA_DIR}/#{test_data_file}") }

let(:expected_json) { File.read("#{TEST_DATA_DIR}/#{test_data_file}.json") }

it { is_expected.to eq JSON.parse(expected_json) }
end
end
end