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

ci: replace travis with actions, setup renovate #1699

Merged
merged 12 commits into from
Jan 20, 2021
Merged

Conversation

gr2m
Copy link
Member

@gr2m gr2m commented Nov 20, 2020

fixes #1692

@gr2m gr2m force-pushed the 1692/setup-renovate branch 2 times, most recently from 114ec95 to 7083d0e Compare November 20, 2020 21:17
@gr2m
Copy link
Member Author

gr2m commented Nov 20, 2020

it looks like the fact that the tests are ran on GitHub actions somehow interferes with the tests.

This is the last step to setup renovate across @semantic-release, would be great to get this fixed. I can have another look next week, but any help is welcome

@jsoref
Copy link
Contributor

jsoref commented Jan 19, 2021

That's correct. Adding a couple of env vars takes the error count from 8 to 3:

4c733f4

The error I hit involves an unexpected URL -- happy to return the adventure to you :-).

@gr2m
Copy link
Member Author

gr2m commented Jan 19, 2021

That's correct. Adding a couple of env vars takes the error count from 8 to 3:

4c733f4

The error I hit involves an unexpected URL -- happy to return the adventure to you :-).

Thanks a lot! Applied via 1f71b2b

@gr2m
Copy link
Member Author

gr2m commented Jan 20, 2021

I think I got it 🤞🏼 mocking the environment variables by setting values to null results in the env variables to be set to the string "null", which causes false positives.

@gr2m
Copy link
Member Author

gr2m commented Jan 20, 2021

I think I got it 🤞🏼 mocking the environment variables by setting values to null results in the env variables to be set to the string "null", which causes false positives.

that didn't work, but I'm pretty sure the problem is caused because GITHUB_ACTION is set, which causes slightly different behavior in @semantic-release/github: https://github.com/semantic-release/github/blob/c16f315cac8c541b5b923e6c0b102fd75a831713/lib/verify.js#L59-L65

…the repository URL as is if none of the given git credentials are valid" which should never have passed before but well here we are
@jsoref
Copy link
Contributor

jsoref commented Jan 20, 2021

I think I needed to set:

GITHUB_API_URL: mockServer.url,
GITHUB_PREFIX: 'api/',
to make some amount of progress in this (the latter definitely requires changes to the test to account for the url) -- alternatively, one could try to have two mockServers, but I didn't see enough benefit in that.

I also looked into setting up multiple repo servers, because it felt like tests might be colliding...

@gr2m
Copy link
Member Author

gr2m commented Jan 20, 2021

I think we don't want to set any of the GITHUB_* environment variables, we don't want semantic release to get into any CI state

I feel like there is a racing condition:

https://github.com/semantic-release/semantic-release/runs/1737560659#step:7:372

It fails because the request URL it expects for the Dry-run test is /repos/git/test-dry-run, but instead it gets /repos/git/test-js-api", which is from another test

@jsoref
Copy link
Contributor

jsoref commented Jan 20, 2021

Yeah, that's where I think you need to use distinct dockers for each test, it's the same fail I'm hitting.

@gr2m
Copy link
Member Author

gr2m commented Jan 20, 2021

I don't get the same error locally.

need to use distinct dockers for each test

I don't know how I would even do that right now :D I still hope to make it work, I've changed the tests to run sequentially, let's see ...

@gr2m

This comment has been minimized.

@gr2m
Copy link
Member Author

gr2m commented Jan 20, 2021

Today I learned: turns out that await execa(cli, [], {env, cwd}) does not use env as exclusive environment variables, it extends process.env, unless extendEnv: false is set. That's why the integration tests all assume they are run in GitHub Actions, although we set Travis as environment.

@gr2m
Copy link
Member Author

gr2m commented Jan 20, 2021

I think I got it now, thank you @jsoref, you helped a lot :)

@@ -122,13 +122,19 @@
"lint": "xo",
"pretest": "npm run lint",
"semantic-release": "./bin/semantic-release.js",
"test": "nyc ava -v"
"test": "nyc ava -v",
"test:ci": "nyc ava -v"
Copy link
Member

@travi travi Jan 20, 2021

Choose a reason for hiding this comment

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

is it worth having this as a separate script when it already matches the existing test script? i know we needed it, at least temporarily, in some cases where they didnt match, but seems like that could be avoided here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added it because of pretest. On CI, we run the linting in the separate job, that only runs after the tests passed in all supported node versions

TRAVIS_BRANCH: 'master',
TRAVIS_PULL_REQUEST: 'false',
GITHUB_API_URL: mockServer.url,
};
Copy link
Member Author

Choose a reason for hiding this comment

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

The main problem why the CI tests started to fail after migrating from Travis to GitHub Actions was that the environment variables set by the GitHub Actions environment sneaked into process.env. I always thought that setting the env option for exec would set all environment variables, but instead it only extends process.env. Setting extendEnv resolved the problem

@gr2m gr2m merged commit b5aa853 into master Jan 20, 2021
@gr2m gr2m deleted the 1692/setup-renovate branch January 20, 2021 22:07
@github-actions
Copy link

🎉 This PR is included in version 17.3.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

push:
branches:
- master
- renovate/**
Copy link
Contributor

Choose a reason for hiding this comment

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

I claim this is wrong ;-)

Copy link
Contributor

@jsoref jsoref Jan 21, 2021

Choose a reason for hiding this comment

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

Or perhaps, if it's intended, I'd suggest '**renovate**' and then document that people can test renovate stuff by using a branch vaguely named renovate -- there's no particular explanation anywhere in this PR as to why renovate is special as part of a branch name.

Copy link
Member

Choose a reason for hiding this comment

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

We are using https://github.com/renovatebot to keep dependencies up to date and it creates branches that are named to match this pattern. This ensures that these branches trigger this workflow, even in the cases we have configured renovate to not open pull requests (although we still have a few kinks to work out around those cases). This pattern isn't intended to enable any special behavior for outside contributors.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that isn't particularly obvious (there aren't enough hints anywhere). Might I suggest a # renovate/* branches are generated by @renovate-bot ?

Copy link
Member Author

Choose a reason for hiding this comment

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

great idea! Let's do that! Pull request welcome ;)

Xunnamius pushed a commit to Xunnamius/semantic-release-atam that referenced this pull request Feb 11, 2021
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[meta] Replace Travis with GitHub Actions, enable renovate
3 participants