-
Notifications
You must be signed in to change notification settings - Fork 6
Add GitHub Actions testing workflow #35
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
Changes from all commits
1cbe888
4235fb1
df8ea53
ab1631f
bf6ff3d
9d85a71
51cc975
46a2110
4b973b9
d697921
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Test | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: ./go.mod | ||
| check-latest: true | ||
| cache: true | ||
|
|
||
| - name: Install keyring dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y gnome-keyring dbus-x11 | ||
|
|
||
| - name: Start D-Bus and keyring | ||
| run: | | ||
| # Start D-Bus session | ||
| eval $(dbus-launch --sh-syntax) | ||
| echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> $GITHUB_ENV | ||
|
|
||
| # Initialize gnome-keyring with a test password | ||
| echo 'test' | gnome-keyring-daemon --unlock | ||
| eval $(echo 'test' | gnome-keyring-daemon --start --components=secrets) | ||
| echo "GNOME_KEYRING_CONTROL=$GNOME_KEYRING_CONTROL" >> $GITHUB_ENV | ||
|
|
||
| - name: Build | ||
| run: go build ./... | ||
|
|
||
| - name: Vet | ||
| run: go vet ./... | ||
|
|
||
| - name: Test | ||
| run: go test -p 1 -race -coverprofile=coverage.out -coverpkg=./... ./... | ||
|
|
||
| - name: Generate Coverage Report | ||
| run: go tool cover -html=coverage.out -o=coverage.html | ||
|
|
||
| - name: Upload Coverage Report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage.html | ||
| path: coverage.html | ||
|
|
||
| - name: ShellCheck | ||
| run: shellcheck scripts/install.sh | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -298,7 +298,7 @@ verify_checksum() { | |
|
|
||
| # Format checksum for validation: "hash filename" | ||
| local formatted_checksum | ||
| formatted_checksum=$(printf "%s %s\n" "$(cat "${checksum_file}" | tr -d '[:space:]')" "${filename}") | ||
| formatted_checksum=$(printf "%s %s\n" "$(tr -d '[:space:]' < "${checksum_file}")" "${filename}") | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addresses https://www.shellcheck.net/wiki/SC2002, which was only showing up in CI because the GitHub Actions ubuntu image includes an older version of shellcheck, and the shellcheck docs say:
|
||
|
|
||
| if command -v sha256sum >/dev/null 2>&1; then | ||
| if ! echo "${formatted_checksum}" | sha256sum -c - >/dev/null 2>&1; then | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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 necessary to get the tests that rely on the keyring to pass in CI. Tbh, Claude wrote this code and I didn't take time to understand it, but it did make the tests pass 😅. It's definitely possible that some of this is wonky or unnecessary.