Danish Language #1820
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
name: "test" | |
on: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
run_optional_build_desktop: | |
description: "Run the optional build_desktop job (yes/no)" | |
required: true | |
default: "no" | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
desktop: ${{steps.desktop.outputs.src}} | |
preview_folder: ${{steps.preview.outputs.folder}} | |
is-fork: ${{steps.check-fork.outputs.is-fork}} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dorny/paths-filter@v2 | |
id: desktop | |
with: | |
filters: | | |
src: | |
- 'modules/desktop/**' | |
- 'modules/ui/**' | |
- name: get s3 preview folder | |
id: preview | |
run: echo "folder=${{ github.event.number }}-merge" >> $GITHUB_OUTPUT | |
- name: Check if PR is from fork | |
id: check-fork | |
run: | | |
echo "is-fork=$(if [ \"${{ github.event.pull_request.head.repo.full_name }}\" != \"${{ github.repository }}\" ]; then echo true; else echo false; fi)" >> $GITHUB_OUTPUT | |
shell: bash | |
test: | |
needs: changes | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pkgxdev/dev@v0 | |
- name: cache node_modules build | |
uses: actions/cache@v3 | |
with: | |
key: test-mac | |
path: ./node_modules | |
- name: env file | |
run: | | |
cp .env.example svelte/.env | |
- name: install app dependencies | |
run: xc setup | |
- name: test build electron main process | |
run: npm run build:main | |
# TODO: fix | |
# - name: unit test | |
# run: pnpm --filter desktop run coverage | |
- name: lint | |
run: npm run lint | |
- name: check | |
run: npm run check | |
e2e_test: | |
needs: changes | |
runs-on: macos-latest | |
env: | |
# see: https://github.com/electron-userland/electron-builder/issues/3179 | |
USE_HARD_LINKS: false | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pkgxdev/dev@v0 | |
- name: cache node_modules build | |
uses: actions/cache@v3 | |
with: | |
key: e2e-macos | |
path: ./node_modules | |
- name: env file | |
run: cp .env.example svelte/.env | |
- name: install app dependencies | |
run: xc setup | |
- name: test build electron main process | |
run: xc build | |
env: | |
NOTARIZE: "false" | |
CSC_IDENTITY_AUTO_DISCOVERY: "false" | |
MAC_BUILD_TARGET: "dir" | |
- name: setup dev | |
run: | | |
mkdir -p /Users/runner/.pkgx/pkgx.app | |
touch /Users/runner/.pkgx/pkgx.app/dev | |
- name: e2e test | |
run: xc e2e | |
build_svelte: | |
needs: changes | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pkgxdev/dev@v0 | |
- name: cache node_modules build | |
uses: actions/cache@v3 | |
with: | |
# key: ubuntu-latest-pnpm | |
key: mac-latest-pnpm | |
path: ./node_modules | |
- name: cache electron build | |
uses: actions/cache@v3 | |
with: | |
key: mac-latest-electron | |
# key: ubuntu-latest-electron | |
path: | | |
./svelte/.svelte-kit | |
./svelte/build | |
- name: get gui version | |
id: gui-version | |
run: | | |
export version=$(echo $(cat package.json) | pkgx jq --raw-output .version) | |
export postfix= | |
if GIT_DIR=/path/to/repo/.git git rev-parse $1 >/dev/null 2>&1 | |
then | |
echo "Found tag" | |
else | |
export postfix=-dev | |
fi | |
echo "version=$version$postfix" >> $GITHUB_OUTPUT | |
- name: build | |
run: xc build:lite | |
env: | |
PUBLIC_VERSION: ${{ steps.gui-version.outputs.version }} | |
BUILD_FOR: preview | |
build_desktop: | |
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.run_optional_build_desktop == 'yes') | |
needs: [changes, test] | |
# if: needs.changes.outputs.desktop == 'true' | |
strategy: | |
matrix: | |
platform: | |
# X86+64 is built with ARM64 also | |
- darwin+aarch64 | |
uses: ./.github/workflows/build-sign-notarize.yml | |
with: | |
platform: ${{ matrix.platform }} | |
s3-prefix: ${{ needs.changes.outputs.preview_folder || 'dev-pr' }} | |
debug: 1 | |
secrets: inherit | |
upload: | |
needs: [build_desktop, changes] | |
if: needs.changes.outputs.is-fork == 'false' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: | |
# x86 included already in aarch64 | |
- name: darwin+aarch64 | |
id: mac_m1 | |
# - name: linux+x86-64 | |
# id: linux | |
# - name: linux+aarch64 | |
# id: linux_arm64 | |
steps: | |
- uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: s3 artifact download | |
env: | |
S3_INSTALLER_KEY: ${{ needs.build_desktop.outputs.s3-custom-notarized-installers-key }} | |
run: aws s3 cp $S3_INSTALLER_KEY dist.tgz | |
- run: mkdir dist | |
- run: tar xzf dist.tgz -C dist | |
- name: get installer filenames of arm64 and x86+64 | |
id: app_files | |
working-directory: ./dist | |
run: | | |
ARM64_ZIP=$(ls | grep -Ev blockmap | grep arm64-mac.zip) | |
X86_ZIP=$(ls | grep -Ev blockmap | grep -Ev arm64 | grep mac.zip) | |
ARM64_DMG=$(ls | grep -Ev blockmap | grep arm64.dmg) | |
X86_DMG=$(ls | grep -Ev blockmap | grep -Ev arm64 | grep dmg) | |
echo zip_arm64=$ARM64_ZIP >> $GITHUB_OUTPUT | |
echo zip_x86=$X86_ZIP >> $GITHUB_OUTPUT | |
echo dmg_arm64=$ARM64_DMG >> $GITHUB_OUTPUT | |
echo dmg_x86=$X86_DMG >> $GITHUB_OUTPUT | |
- name: build platform output | |
id: build_platform | |
env: | |
platform: ${{ matrix.platform.name }} | |
run: | | |
BUILD_PLATFORM=$(echo $platform | sed -e "s/darwin+//g" | sed -e "s/linux+//g") | |
EXTENSION=dmg | |
case $platform in | |
"linux+x86-64") | |
BUILD_PLATFORM="amd64" | |
EXTENSION="deb" | |
;; | |
"linux+aarch64") | |
BUILD_PLATFORM="aarch64" | |
EXTENSION="deb" | |
;; | |
"darwin+aarch64") | |
BUILD_PLATFORM="aarch64" | |
EXTENSION="dmg" | |
;; | |
"darwin+x86-64") | |
BUILD_PLATFORM="x64" | |
EXTENSION="dmg" | |
;; | |
*) | |
echo "Unknown platform $platform" | |
exit 1 | |
;; | |
esac | |
echo "build_platform=$BUILD_PLATFORM" >> $GITHUB_OUTPUT | |
echo "extension=$EXTENSION" >> $GITHUB_OUTPUT | |
- uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: cp package images from prod to preview bucket | |
env: | |
prefix: ${{ needs.changes.outputs.preview_folder }} | |
bucket: ${{ secrets.BUILDS_S3_BUCKET }} | |
run: | | |
cd dist && \ | |
aws s3 sync . "$bucket/$prefix/" | |
- name: comment install for Linux | |
if: startsWith(matrix.platform.name, 'linux') | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message-id: ${{ matrix.platform.id }}-comment | |
message: | | |
**installer for Linux ${{ matrix.platform.name }} is at**: | |
```bash | |
${{ secrets.BUILDS_S3_PUBLIC_DOMAIN }}/${{ needs.changes.outputs.preview_folder }}/${{ steps.build_platform.outputs.filename }} | |
``` | |
copy-paste into a browser to download | |
- name: comment install for MacOS | |
if: startsWith(matrix.platform.name, 'darwin') | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message-id: darwin+aarch64-comment | |
message: | | |
**installers for MacOS darwin+aarch64 is at**: | |
```bash | |
${{ secrets.BUILDS_S3_PUBLIC_DOMAIN }}/${{ needs.changes.outputs.preview_folder }}/${{ steps.app_files.outputs.dmg_arm64 }} | |
``` | |
copy-paste into a browser to download | |
- name: comment install for MacOS | |
if: startsWith(matrix.platform.name, 'darwin') | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message-id: darwin+x86-64-comment | |
message: | | |
**installers for MacOS darwin+x86-64 is at**: | |
```bash | |
${{ secrets.BUILDS_S3_PUBLIC_DOMAIN }}/${{ needs.changes.outputs.preview_folder }}/${{ steps.app_files.outputs.dmg_x86 }} | |
``` | |
copy-paste into a browser to download |