-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: Re-enable FOSSA scan and add Codecov #14333
Merged
+135
−5
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7821273
Re-enable FOSSA scan and add CODECOV
mattlord c661af5
Add codecov badge
mattlord ca8d73a
Only run both on merges to main
mattlord e6b1a14
Changes form testing in my fork
mattlord 850fbbe
More updates from testing
mattlord f9e6695
Exclude endtoend tests from coverage report
mattlord 26445bd
Workflow tweaks
mattlord 4b61418
Tidy up workflow yaml
mattlord 786bd7e
Merge remote-tracking branch 'origin/main' into codecov
mattlord 3e9fcd0
Update yaml
mattlord e873dff
Run on all pushes and PRs
mattlord a3acbca
Trigger code coverage
mattlord 5f8e99c
Some unit tests require the e2e test packages
mattlord 74dbeb1
Reduce disk space needed for unit tests
mattlord c7ff747
Try again to NOT run any e2e tests as they fill up the disk
mattlord 94576cd
Deal with go tool cover issue
mattlord 346b17e
Address review feedback
mattlord File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
name: Code Coverage | ||
on: [push, pull_request] | ||
concurrency: | ||
group: format('{0}-{1}', ${{ github.ref }}, 'Code Coverage') | ||
cancel-in-progress: true | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
test: | ||
name: Code Coverage | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check for changes in files relevant to code coverage | ||
uses: frouioui/paths-filter@main | ||
id: changes | ||
with: | ||
token: '' | ||
filters: | | ||
changed_files: | ||
- .github/workflows/codecov.yml | ||
- 'go/**' | ||
- go.mod | ||
- go.sum | ||
- Makefile | ||
|
||
- name: Set up Go | ||
if: steps.changes.outputs.changed_files == 'true' | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.21.5 | ||
|
||
- name: Set up python | ||
if: steps.changes.outputs.changed_files == 'true' | ||
uses: actions/setup-python@v4 | ||
|
||
- name: Tune the OS | ||
if: steps.changes.outputs.changed_files == 'true' | ||
run: | | ||
sudo sysctl -w net.ipv4.ip_local_port_range="22768 65535" | ||
# Increase the asynchronous non-blocking I/O. More information at https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_use_native_aio | ||
echo "fs.aio-max-nr = 1048576" | sudo tee -a /etc/sysctl.conf | ||
sudo sysctl -p /etc/sysctl.conf | ||
|
||
- name: Get dependencies | ||
if: steps.changes.outputs.changed_files == 'true' | ||
run: | | ||
export DEBIAN_FRONTEND="noninteractive" | ||
sudo apt-get update | ||
|
||
# Uninstall any previously installed MySQL first | ||
sudo systemctl stop apparmor | ||
sudo DEBIAN_FRONTEND="noninteractive" apt-get remove -y --purge mysql-server mysql-client mysql-common | ||
sudo apt-get -y autoremove | ||
sudo apt-get -y autoclean | ||
sudo deluser mysql | ||
sudo rm -rf /var/lib/mysql | ||
sudo rm -rf /etc/mysql | ||
|
||
# Get key to latest MySQL repo | ||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8D3785C | ||
|
||
# mysql80 | ||
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb | ||
echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections | ||
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config* | ||
sudo apt-get update | ||
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server mysql-client | ||
|
||
sudo apt-get install -y make unzip g++ curl git wget ant openjdk-11-jdk eatmydata | ||
sudo service mysql stop | ||
sudo bash -c "echo '/usr/sbin/mysqld { }' > /etc/apparmor.d/usr.sbin.mysqld" # https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263 | ||
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ | ||
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld || echo "could not remove mysqld profile" | ||
|
||
mkdir -p dist bin | ||
curl -L https://github.com/coreos/etcd/releases/download/v3.3.10/etcd-v3.3.10-linux-amd64.tar.gz | tar -zxC dist | ||
mv dist/etcd-v3.3.10-linux-amd64/{etcd,etcdctl} bin/ | ||
|
||
go mod download | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
|
||
- name: Run make tools | ||
if: steps.changes.outputs.changed_files == 'true' | ||
run: | | ||
make tools | ||
|
||
- name: Run unit tests and generate code coverage reports | ||
if: steps.changes.outputs.changed_files == 'true' | ||
timeout-minutes: 45 | ||
run: | | ||
set -exo pipefail | ||
# We set the VTDATAROOT to the /tmp folder to reduce the file path of mysql.sock file | ||
# which musn't be more than 107 characters long. | ||
export VTDATAROOT="/tmp/" | ||
|
||
export NOVTADMINBUILD=1 | ||
|
||
# Exclude endtoend tests from the coverage report. | ||
# TODO: figure out how best to include our endtoend tests in the coverage report. | ||
rm -rf go/test/endtoend go/*/endtoend go/vt/*/endtoend go/cmd/vttestserver | ||
|
||
eatmydata -- make unit_test_cover | ||
|
||
- name: Upload coverage reports to codecov.io | ||
if: steps.changes.outputs.changed_files == 'true' | ||
uses: codecov/codecov-action@v3 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This was required, at least for now, for the pull request action to pass: