Skip to content

Commit

Permalink
Merge pull request #324 from reorproject/fix/test-line-endings
Browse files Browse the repository at this point in the history
force line ending lf
  • Loading branch information
samlhuillier authored Jul 29, 2024
2 parents dc1c27c + d6be068 commit 6f9a983
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 52 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto eol=lf

36 changes: 10 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,104 +1,88 @@
name: Build and Package Electron App

on:
push:
branches:
- "*"
pull_request:
branches:
- "*"

jobs:
build_and_package:
strategy:
matrix:
include:
- os: macos-13
# arch: x64
- os: macos-latest
# arch: arm64
- os: windows-latest
- os: ubuntu-latest
arch: x64

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Cache TypeScript build
uses: actions/cache@v3
with:
path: ./dist
key: ${{ runner.os }}-tsc-${{ hashFiles('**/tsconfig.json') }}
restore-keys: |
${{ runner.os }}-tsc-
- name: Install dependencies
run: npm install

- name: Run Linter
run: npm run lint

- name: Run Tests
run: npm run test

- name: Set up environment for macOS build
if: matrix.os == 'macos-13' || matrix.os == 'macos-latest'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If you use GitHub token for auto-update
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run build
- name: Build for non-macos
- name: Build for non-macOS
if: matrix.os != 'macos-13' && matrix.os != 'macos-latest'
run: |
npm run build
- name: Notarize macOS build
if: (matrix.os == 'macos-13' || matrix.os == 'macos-latest') && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
run: npm run notarize
- name: Set version as env
run: echo "APP_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV

- name: Print APP_VERSION
run: echo "APP_VERSION=${{ env.APP_VERSION }}"

- name: List output files
if: matrix.os != 'macos-13' && matrix.os != 'macos-latest'
run: |
ls ./release/${{ env.APP_VERSION }}/
- name: Check runner architecture
if: matrix.os != 'macos-13' && matrix.os != 'macos-latest'
run: uname -m


- name: Rename artifacts for ARM architecture
if: matrix.os == 'macos-latest'
run: |
mv ./release/${{ env.APP_VERSION }}/*.dmg ./release/${{ env.APP_VERSION }}/Reor_${{ env.APP_VERSION }}-arm64.dmg
- name: Rename artifacts for Intel architecture
if: matrix.os == 'macos-13'
run: |
mv ./release/${{ env.APP_VERSION }}/*.dmg ./release/${{ env.APP_VERSION }}/Reor_${{ env.APP_VERSION }}-intel.dmg
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
35 changes: 11 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,77 @@
name: Release script

on:
push:
tags:
- "v*"

jobs:
build_and_package:
runs-on: ${{ matrix.os }}

strategy:
matrix:
include:
- os: macos-13
# arch: x64
- os: macos-latest
# arch: arm64
- os: windows-latest
- os: ubuntu-latest
arch: x64
fail-fast: false

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Cache TypeScript build
uses: actions/cache@v3
with:
path: ./dist
key: ${{ runner.os }}-tsc-${{ hashFiles('**/tsconfig.json') }}
restore-keys: |
${{ runner.os }}-tsc-
- name: Install dependencies
run: npm install

- name: Run Linter
run: npm run lint

- name: Run Tests
run: npm run test

- name: Set up environment for macOS build
if: matrix.os == 'macos-latest' || matrix.os == 'macos-latest-xlarge'
if: matrix.os == 'macos-13' || matrix.os == 'macos-latest'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If you use GitHub token for auto-update
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run build
- name: Build for non-macos
if: matrix.os != 'macos-latest' && matrix.os != 'macos-latest-xlarge'
- name: Notarize macOS build
if: matrix.os == 'macos-13' || matrix.os == 'macos-latest'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
run: npm run notarize
- name: Build for non-macOS
if: matrix.os != 'macos-13' && matrix.os != 'macos-latest'
run: |
npm run build
- name: Set version as env
run: echo "APP_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV

- name: Rename artifacts for ARM architecture
if: matrix.os == 'macos-latest'
run: |
mv ./release/${{ env.APP_VERSION }}/*.dmg ./release/${{ env.APP_VERSION }}/Reor_${{ env.APP_VERSION }}-arm64.dmg
- name: Rename artifacts for Intel architecture
if: matrix.os == 'macos-13'
run: |
mv ./release/${{ env.APP_VERSION }}/*.dmg ./release/${{ env.APP_VERSION }}/Reor_${{ env.APP_VERSION }}-intel.dmg
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
Expand All @@ -101,7 +89,6 @@ jobs:
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
Expand All @@ -110,4 +97,4 @@ jobs:
**/*.AppImage
**/*.dmg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"trailingComma": "all",
"tabWidth": 2,
"semi": false,
"singleQuote": true
"singleQuote": true,
"endOfLine": "lf"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dev": "vite",
"prebuild": "node scripts/downloadOllama.js",
"build": "tsc && vite build && electron-builder",
"postbuild": "node scripts/notarize.js",
"notarize": "node scripts/notarize.js",
"preview": "vite preview",
"pree2e": "vite build --mode=test",
"e2e": "playwright test",
Expand Down
1 change: 1 addition & 0 deletions scripts/notarize.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function printDirectoryTree(startPath, indent = "") {
}

async function notarizeApp() {
console.log("Notarizing the app...");
const productName = "Reor";

// Get the current platform
Expand Down

0 comments on commit 6f9a983

Please sign in to comment.