Merge branch 'test-paymentrequest' #9969
This file contains hidden or 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
# See reference docs at | |
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions | |
name: ci | |
on: [push, pull_request] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
GITHUB_BUILD_DIR: ${{github.workspace}} | |
jobs: | |
setup-env: | |
runs-on: ubuntu-22.04 | |
outputs: | |
ci_image_version: ${{ steps.set-ci-image-version.outputs.ci_image_version }} | |
steps: | |
- name: Clone the repo | |
uses: actions/checkout@v4 | |
- name: Read CI Image Version | |
id: set-ci-image-version | |
run: | | |
# Keep this in sync with default in scripts/github-ci.sh. | |
CI_IMAGE_VERSION=$(cat .containerversion) | |
echo "ci_image_version=$CI_IMAGE_VERSION" >> $GITHUB_OUTPUT | |
test-lint: | |
runs-on: ubuntu-22.04 | |
needs: setup-env | |
container: | |
image: shiftcrypto/bitbox-wallet-app:${{ needs.setup-env.outputs.ci_image_version }} | |
steps: | |
- name: Clone the repo | |
with: | |
submodules: recursive | |
uses: actions/checkout@v4 | |
- name: Run CI script | |
# The script also runs golang-ci but it's ok: doesn't take too long and may be useful | |
# to keep its linter errors in this log, too. | |
run: ./scripts/github-ci.sh ci | |
env: | |
OS_NAME: linux | |
android: | |
runs-on: ubuntu-22.04 | |
needs: setup-env | |
outputs: | |
artifact-url: ${{ steps.upload.outputs.artifact-url }} | |
container: | |
image: shiftcrypto/bitbox-wallet-app:${{ needs.setup-env.outputs.ci_image_version }} | |
steps: | |
- name: Clone the repo | |
uses: actions/checkout@v4 | |
- name: Enable caching | |
uses: actions/cache@v4 | |
with: | |
key: ${{runner.os}}-android | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
- name: Build Android | |
run: ./scripts/github-ci.sh android | |
env: | |
OS_NAME: linux | |
- name: Upload APK | |
id: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
path: /github/home/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/android/BitBoxApp/app/build/outputs/apk/debug/app-debug.apk | |
name: BitBoxApp-android-${{github.sha}}.apk | |
if-no-files-found: error | |
qt-linux: | |
runs-on: ubuntu-22.04 | |
needs: setup-env | |
container: | |
image: shiftcrypto/bitbox-wallet-app:${{ needs.setup-env.outputs.ci_image_version }} | |
outputs: | |
artifact-url-ai: ${{ steps.upload-ai.outputs.artifact-url }} | |
artifact-url-deb: ${{ steps.upload-deb.outputs.artifact-url }} | |
artifact-url-rpm: ${{ steps.upload-rpm.outputs.artifact-url }} | |
steps: | |
- name: Clone the repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build Qt-Linux | |
run: ./scripts/github-ci.sh qt-linux | |
env: | |
OS_NAME: linux | |
- name: Upload AppImage | |
id: upload-ai | |
uses: actions/upload-artifact@v4 | |
with: | |
path: /github/home/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/qt/build/linux/BitBoxApp-*.AppImage | |
name: BitBoxApp-linux-${{github.sha}}.AppImage | |
if-no-files-found: error | |
- name: Upload deb | |
id: upload-deb | |
uses: actions/upload-artifact@v4 | |
with: | |
path: /github/home/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/qt/build/linux/bitbox_*.deb | |
name: BitBoxApp-linux-${{github.sha}}.deb | |
if-no-files-found: error | |
- name: Upload rpm | |
id: upload-rpm | |
uses: actions/upload-artifact@v4 | |
with: | |
path: /github/home/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/qt/build/linux/bitbox-*.rpm | |
name: BitBoxApp-linux-${{github.sha}}.rpm | |
if-no-files-found: error | |
macos: | |
runs-on: macos-14 | |
outputs: | |
artifact-url: ${{ steps.upload.outputs.artifact-url }} | |
steps: | |
- name: Clone the repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.24.x | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Qt | |
# Qt modules: Not sure why we need qtpositioning - app compilation fails without. Maybe the webengine depends on it. | |
# qtpositioning depends on qtserialport. | |
# qtwebchannel is for the JS/backend bridge. | |
# qtwebengine is for rendering the frontend. | |
run: | | |
pip install aqtinstall | |
aqt install-qt mac desktop 6.8.2 --modules qtpositioning qtserialport qtwebchannel qtwebengine --outputdir ~/Qt | |
echo "$HOME/Qt/6.8.2/macos/bin" >> $GITHUB_PATH | |
echo "$HOME/Qt/6.8.2/macos/libexec" >> $GITHUB_PATH | |
- name: Build macOS app | |
run: > | |
./scripts/github-ci.sh qt-osx; | |
env: | |
OS_NAME: osx | |
- name: Ad-hoc sign BitBox.app | |
run: | | |
APP_PATH="$(go env GOPATH)/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/qt/build/osx/BitBox.app" | |
echo "Signing app at $APP_PATH" | |
codesign --deep --force --verbose --sign - "$APP_PATH" | |
- name: Verify BitBox.app signature | |
run: | | |
APP_PATH="$(go env GOPATH)/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/qt/build/osx/BitBox.app" | |
codesign --verify --deep --strict --verbose=2 "$APP_PATH" | |
- name: Archive app | |
run: > | |
pushd ~/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/qt/build/osx; | |
ditto -c -k --keepParent BitBox.app ${{github.workspace}}/BitBoxApp-macos.zip; | |
popd; | |
- name: Upload app | |
id: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
path: BitBoxApp-macos.zip | |
name: BitBoxApp-macos-${{github.sha}}.zip | |
if-no-files-found: error | |
ios: | |
runs-on: macos-14 | |
env: | |
GO_SRC_DIR: src/github.com/BitBoxSwiss/bitbox-wallet-app | |
steps: | |
- name: Clone the repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
# Take Go version to install from go.mod. | |
go-version-file: 'go.mod' | |
- name: Set GOPATH | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
- name: Copy repo to GOPATH | |
# This is needed as gomobile is still unaware of go modules, so the repo must be in GOPATH | |
run: | | |
mkdir -p $GOPATH/$(dirname $GO_SRC_DIR) | |
cp -a ${{github.workspace}} $GOPATH/$(dirname $GO_SRC_DIR) | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Build iOS app | |
run: | | |
make gomobileinit | |
(cd $GOPATH/$GO_SRC_DIR; make ios) | |
windows: | |
runs-on: windows-2022 | |
outputs: | |
artifact-url: ${{ steps.upload.outputs.artifact-url }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
MINGW_BIN: /C/mingw64/bin | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
# Take Go version to install from go.mod | |
go-version-file: 'go.mod' | |
# We need to install wheel otherwise the below will fail | |
# with "invalid command 'bdist_wheel'" | |
# See https://github.com/jurplel/install-qt-action/issues/281 | |
- run: pip install wheel | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: '6.8.2' | |
host: 'windows' | |
target: 'desktop' | |
arch: 'win64_msvc2022_64' | |
modules: 'qtwebengine qtwebchannel qtpositioning' | |
- name: Link Visual Studio editions | |
# This is needed due to our build expecting the Community edition, but Enterprise being pre-installed | |
shell: cmd | |
run: | | |
mklink /J "C:\Program Files\Microsoft Visual Studio\2022\Community" "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" | |
- name: Build Windows app | |
run: | | |
make qt-windows | |
cd frontends/qt | |
makensis setup.nsi | |
- name: Upload Installer | |
id: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
path: frontends/qt/BitBox-installer.exe | |
name: BitBoxApp-windows-${{ github.sha }}.exe | |
if-no-files-found: error | |
report-artifacts: | |
needs: [android, qt-linux, macos, windows] | |
runs-on: ubuntu-22.04 | |
if: ${{ !cancelled() && github.event_name == 'push' }} | |
steps: | |
- name: Clone the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create vars | |
id: vars | |
run: | | |
echo "git_sha_short=$(git rev-parse --short HEAD)" >> ${GITHUB_OUTPUT} | |
{ | |
echo "git_shortlog<<EOF" | |
git shortlog HEAD~..HEAD | |
echo EOF | |
} >> ${GITHUB_OUTPUT} | |
- name: Message for success | |
uses: mattermost/action-mattermost-notify@master | |
continue-on-error: true | |
if: job.status == 'success' | |
with: | |
MATTERMOST_WEBHOOK_URL: ${{ secrets.MM_WEBHOOK_URL }} | |
MATTERMOST_ICON_URL: https://cdn4.iconfinder.com/data/icons/basic-ui-2-line/32/check-mark-checklist-complete-done-512.png | |
MATTERMOST_CHANNEL: eng-artifacts | |
TEXT: | | |
**${{ github.repository }}: Artifacts built** | |
([${{ github.ref_name }}](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}), [${{ steps.vars.outputs.git_sha_short }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}), [artifacts](https://github.com/${{ github.repository }}/actions/runs/${{github.run_id}}#artifacts)) | |
* Android - [APK](${{needs.android.outputs.artifact-url}}) | |
* Linux - [AppImage](${{needs.qt-linux.outputs.artifact-url-ai}}), [DEB](${{needs.qt-linux.outputs.artifact-url-deb}}), [RPM](${{needs.qt-linux.outputs.artifact-url-rpm}}) | |
* MacOS - [Zip](${{needs.macos.outputs.artifact-url}}) | |
* Windows - [EXE](${{needs.windows.outputs.artifact-url}}) | |
``` | |
${{ steps.vars.outputs.git_shortlog }} | |
``` | |
- name: Message for failure | |
uses: mattermost/action-mattermost-notify@master | |
continue-on-error: true | |
if: job.status == 'failure' | |
with: | |
MATTERMOST_WEBHOOK_URL: ${{ secrets.MM_WEBHOOK_URL }} | |
MATTERMOST_ICON_URL: https://cdn4.iconfinder.com/data/icons/basic-ui-2-line/32/exclamation-mark-triangle-sign-caution-1024.png | |
MATTERMOST_CHANNEL: eng-build-failures | |
TEXT: | | |
**Oh no! [${{ steps.vars.outputs.git_sha_short }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) failed to build.** | |
See [run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details. | |
bitbox02-simulator: | |
# This is a separate job because the simulator platform requirements are independent of our CI image Ubuntu version. | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Clone the repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Run simulator tests | |
run: | | |
go test -mod=vendor -tags=bitbox02_simulator ./... -count=1 -v -run 'TestSimulator*' |