-
Notifications
You must be signed in to change notification settings - Fork 188
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
Switch to GitHub Actions #556
Switch to GitHub Actions #556
Conversation
This is a test specifically for rails-sqlserver#545, which we were unable to run on CircleCI since we did not have paid runners.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Mostly just offering pedantic comments/reflections...
.github/workflows/ci.yml
Outdated
- name: Build gem | ||
shell: bash | ||
run: bundle exec rake gem:for_platform[${{ matrix.platform }}] | ||
- name: Move gems into separate directory before persisting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this step still required? I vaguely recall difficulties on CircleCI, not sure if that'll still be a problem here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, CircleCI did not support wildcard pattern, that's why we added this step.
I addressed removed this with 1d9a7c9.
- name: Download precompiled gem | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: gem-x64-mingw32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can't/won't parameterize this for the install task, because we're matching the VM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically we are matching the Ruby version, everything below 3.0 is mingw32, 3.1 and newer is ucrt.
we probably could make a parameter out of it, or combine it with matrix
, but to keep it simple I would suggest to spell it out explicitly for now.
ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path" | ||
exit $LASTEXITCODE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend splitting this to it's own step, for better clarity on failure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed with dc3b1e4.
.github/workflows/ci.yml
Outdated
- 2.7 | ||
- '3.0' | ||
|
||
name: Test on Windows (MingW) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for PR check clarity, we'll benefit from seeing the ruby version (and maybe sql server version) directly in the job name. Probably same comment for all jobs as applicable. Also, I'm big fan of consistency across jobs, so maybe something like test-$os (ruby $ruby_version)
, build- ...
, etc. Looking at the list here: https://github.com/andyundso/tiny_tds/actions/runs/8806805186/job/24172426029
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a suggestion with 0b12511.
Copy-Item -Path ".\tmp\gems\tiny_tds-$gemVersion-$rubyArchitecture\ports" -Destination "." -Recurse | ||
|
||
- name: Setup MSSQL | ||
uses: potatoqualitee/[email protected] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we able to use service containers here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw, there's also this https://github.com/ankane/setup-sqlserver/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linux service containers are not available on Windows for GitHub Actions. On Linux, the referenced action will use containers.
re: the action from ankane: would also work, also misses support for MSSQL 2017.
& sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-create.sql | ||
& sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-login.sql | ||
|
||
- name: Install toxiproxy-server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible to cache this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... maybe?
I think it's just an executable for Windows, which we could cache. Chocolatey is just comfortable to get it running quickly. Installation also only takes about 1min, compared to MSSQL (~4min) and Ruby (~3min) it is "fast".
uses: test-summary/action@v2 | ||
with: | ||
paths: "test/reports/TEST-*.xml" | ||
if: always() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious, how do test failures show up here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a branch with a test that fails intentionally. here is the result: https://github.com/andyundso/tiny_tds/actions/runs/8900358242
here is also a screenshot:
.github/workflows/ci.yml
Outdated
@@ -0,0 +1,443 @@ | |||
name: Build and test gem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also with the question(s) of how checks show up in the PR UI, this might be better as name: ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed with 6c4e643.
name: Build and test gem | ||
|
||
on: | ||
push: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to limit push to master, keeping the rest of the on's as you have it. Another way to say it, I don't think pushes to branches w/o PR's needs to run this CI workflow...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you fork the repository and want to run the actions, you would have to open a PR. therefore, I added this on: push
, because it makes development in forks easier.
- name: Install gems | ||
shell: bash | ||
run: bundle install | ||
- name: Write used versions into file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My fake undiagnosed OCD demands more newlines for this job, same as you have the others 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed with e994b63.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given the complexity of this PR, it might be better to begin adding a GitHub ci action and then testing extending it before removing the circle ci config
quick and dirty brainless importer didn't work. but now that there's an action on main with workflow dispatch, you can test it in a PR example failures https://github.com/rails-sqlserver/tiny_tds/actions/runs/8888886154 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aharpervc I think I addressed all your feedback.
I would adjust the development docker compose in a second PR, to not make this one even more bloated. :)
.github/workflows/ci.yml
Outdated
- name: Build gem | ||
shell: bash | ||
run: bundle exec rake gem:for_platform[${{ matrix.platform }}] | ||
- name: Move gems into separate directory before persisting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, CircleCI did not support wildcard pattern, that's why we added this step.
I addressed removed this with 1d9a7c9.
.github/workflows/ci.yml
Outdated
@@ -0,0 +1,443 @@ | |||
name: Build and test gem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed with 6c4e643.
name: Build and test gem | ||
|
||
on: | ||
push: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you fork the repository and want to run the actions, you would have to open a PR. therefore, I added this on: push
, because it makes development in forks easier.
- name: Install gems | ||
shell: bash | ||
run: bundle install | ||
- name: Write used versions into file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed with e994b63.
.github/workflows/ci.yml
Outdated
- 2.7 | ||
- '3.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed with c7ae011.
& sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-create.sql | ||
& sqlcmd -S localhost -U sa -P "c0MplicatedP@ssword" -i ./test/sql/db-login.sql | ||
|
||
- name: Install toxiproxy-server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... maybe?
I think it's just an executable for Windows, which we could cache. Chocolatey is just comfortable to get it running quickly. Installation also only takes about 1min, compared to MSSQL (~4min) and Ruby (~3min) it is "fast".
uses: test-summary/action@v2 | ||
with: | ||
paths: "test/reports/TEST-*.xml" | ||
if: always() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a branch with a test that fails intentionally. here is the result: https://github.com/andyundso/tiny_tds/actions/runs/8900358242
here is also a screenshot:
|
||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we only need to compile the ports once for all the Linux jobs, so no matrix (aka parallel jobs) needed.
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install FreeTDS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apparently possible, but looks messy:
https://stackoverflow.com/a/65056232
|
||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think was just an oversight. I added it now to all jobs: 49c557d.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see this green.
If it's ok to merge I'm happy to merge it.
Then I'll remove the not-actually-working circleci->gh-actions import I added whilst trying to be helpful (.github/workflows/test.yml and .github/actions/install-ruby-windows/action.yml) and if y'all have admin to remove the circleci check we can remove that else put in a no-op config till we can get Ken to remove it
This PR switches the pipeline for tiny_tds from CircleCI to GitHub Actions.
Functionality-wise, they should be equivalent, although I made a couple of additions:
/opt/homebrew
to search path on Apple Silicon #545, only to realise it is only available for paid organizations.Open questions / points from my side:
docker-composee.yml
currently uses the CircleCI Ruby image. I like having this compose file around for a quick start into tiny tds development, but I would suggest to switch the official Ruby images from Docker Hub.setup_cimgruby_dev
).