mrjackwills / adsbdb

public api for aircraft, airlines, & flightroutes
https://adsbdb.com
MIT License
111 stars 6 forks source link

Add CI workflow to check Rust code #28

Open taeh98 opened 12 months ago

taeh98 commented 12 months ago

Made a CI workflow file to find errors in Rust code and check its syntax and formatting. Should help keep it standardised and eliminate human error.

mrjackwills commented 12 months ago

Very cool thanks, I've not really used any CI on GitHub before, I use a basic workflow for release but that's about it.

At the moment, for adsbdb, and most of my other repos, I'm using a slightly delicate bash script, create_release.sh, which versions the release, runs cargo fmt, checks for typos with typos, formats the changelog correctly, runs the tests, and builds for all required platforms. Obviously this is all done locally, and will only push to main (with a semver tag) once it all succeeds.

The only issue I can see with this is that in order to run the tests, it requires a fully seeded database, and I am unaware of how we could do that via CI on GitHub - although as I say I have never really used a CI on GitHub before, so maybe there is an easy solution.

taeh98 commented 12 months ago

At the moment, for adsbdb, and most of my other repos, I'm using a slightly delicate bash script, create_release.sh, which versions the release, runs cargo fmt, checks for typos with typos, formats the changelog correctly, runs the tests, and builds for all required platforms. Obviously this is all done locally, and will only push to main (with a semver tag) once it all succeeds.

I've added typos to the workflow and commitlint. It keeps commits in keeping with Conventional Commits, which is widely viewed as best practice, and enables automatic generation of a changelog and version/tag with something like semantic-release or release-please.

taeh98 commented 12 months ago

The only issue I can see with this is that in order to run the tests, it requires a fully seeded database, and I am unaware of how we could do that via CI on GitHub - although as I say I have never really used a CI on GitHub before, so maybe there is an easy solution.

I've not had to run tests with a database in GH actions before, but something like this might help: https://atlasgo.io/guides/testing/github-actions

mrjackwills commented 12 months ago

Thanks, I'll have a read, and play around in a cloned private repo