Skip to content

De-globalize RUNNING_TRACKER and SETTINGS (#2835) #110

De-globalize RUNNING_TRACKER and SETTINGS (#2835)

De-globalize RUNNING_TRACKER and SETTINGS (#2835) #110

Workflow file for this run

name: Build and Test
permissions:
checks: write
contents: read
on:
# Allow manual triggering
workflow_dispatch:
# Always run on pull requests
pull_request:
# And on `main` when manually pushed or after merges
paths-ignore:
- "website/**"
- ".vscode/**"
- "**.md"
push:
branches:
- main
paths-ignore:
- "website/**"
- ".vscode/**"
- "**.md"
env:
CARGO_TERM_COLOR: always
MACOSX_DEPLOYMENT_TARGET: 10.11
defaults:
run:
shell: bash # necessary for windows
jobs:
lint:
uses: ./.github/workflows/lint-app.yml
test:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
toolchain: [stable, nightly]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Show toolchain info
run: cargo --version --verbose
- name: Install neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get -qq install -y \
curl gnupg ca-certificates git gcc-multilib g++-multilib cmake \
libssl-dev pkg-config libfreetype6-dev libasound2-dev \
libexpat1-dev libxcb-composite0-dev libbz2-dev freeglut3-dev \
libxi-dev libfuse2 appstream libfontconfig1-dev
- name: Install Cargo Binstall
uses: cargo-bins/cargo-binstall@main
- name: Install cargo-nextest
run: cargo binstall -y cargo-nextest
- uses: Swatinem/rust-cache@v2
- name: Test
env:
RUST_BACKTRACE: full
run: |
cargo nextest run --profile ci
mv target/nextest/ci/results.xml target/nextest/ci/results-${{ matrix.os }}.xml
- name: Prepare test results
run: |
mkdir -p test-results-${{ matrix.os }}-${{ matrix.toolchain }}
mv target/nextest/ci/results-*.xml test-results-${{ matrix.os }}-${{ matrix.toolchain }}/
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-${{ matrix.toolchain }}
path: |
test-results-${{ matrix.os }}-${{ matrix.toolchain }}
clippy:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
toolchain: [stable, nightly]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Show toolchain info
run: cargo --version --verbose
- name: Run Clippy
run: cargo clippy --all-targets -- -D warnings
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
event-upload:
needs: test
name: Upload Test Event
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact@v4
with:
name: test-event
path: ${{ github.event_path }}
build-deploy:
strategy:
fail-fast: false
matrix:
# NOTE: Should use the oldest available Ubuntu release, for maximum compatibility
os: [windows-latest, macos-latest, ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install Cargo Binstall
uses: cargo-bins/cargo-binstall@main
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
if ! which cargo-wix; then cargo binstall -y cargo-wix; fi
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
curl -L -o create-dmg.tar.gz https://github.com/create-dmg/create-dmg/archive/refs/tags/v1.2.2.tar.gz
tar -xzf create-dmg.tar.gz
cd create-dmg-1.2.2
sudo make install
cd ..
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get -qq install -y \
curl gnupg ca-certificates git gcc-multilib g++-multilib cmake \
libssl-dev pkg-config libfreetype6-dev libasound2-dev \
libexpat1-dev libxcb-composite0-dev libbz2-dev freeglut3-dev \
libxi-dev libfuse2 appstream
- name: Install neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
- uses: Swatinem/rust-cache@v2
- name: Build (Windows)
if: matrix.os == 'windows-latest'
run: cargo wix --output target/release/neovide.msi --package neovide
- name: Build (macOS)
if: matrix.os == 'macos-latest'
run: |
# x86
cargo build --locked --release --target=x86_64-apple-darwin
# arch
cargo build --locked --release --target=aarch64-apple-darwin
- name: Build (Linux)
if: matrix.os == 'ubuntu-20.04'
run: cargo build --locked --release
- name: create Neovide.app (macOS only)
if: matrix.os == 'macos-latest'
run: |
# create the .app only, fix the arguments later
GENERATE_BUNDLE_APP=true GENERATE_DMG=false ./macos-builder/run aarch64-apple-darwin
GENERATE_BUNDLE_APP=true GENERATE_DMG=false ./macos-builder/run x86_64-apple-darwin
- name: Write Apple signing key to a file (macOS only)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
env:
APPLE_SIGNING_KEY_P12: ${{ secrets.APPLE_SIGNING_KEY_P12 }}
run: echo "$APPLE_SIGNING_KEY_P12" | base64 -d -o key.p12
- name: Write App Store Connect API key to a file (macOS only)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
env:
APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }}
run: echo "$APP_STORE_CONNECT_API_KEY" > app_store_connect_api_key.json
- name: Sign Mac App binary root (aarch64-apple-darwin)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
uses: indygreg/apple-code-sign-action@v1
with:
input_path: target/aarch64-apple-darwin/release/neovide
p12_file: key.p12
p12_password: ${{ secrets.APPLE_SIGNING_KEY_PASSWORD }}
sign: true
sign_args: "--code-signature-flags=runtime"
- name: Sign Mac App binary (aarch64-apple-darwin)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
uses: indygreg/apple-code-sign-action@v1
with:
input_path: target/aarch64-apple-darwin/release/bundle/osx/Neovide.app/Contents/MacOS/neovide
p12_file: key.p12
p12_password: ${{ secrets.APPLE_SIGNING_KEY_PASSWORD }}
sign: true
sign_args: "--code-signature-flags=runtime"
- name: Sign Mac App .app (aarch64-apple-darwin)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
uses: indygreg/apple-code-sign-action@v1
with:
input_path: target/aarch64-apple-darwin/release/bundle/osx/Neovide.app
p12_file: key.p12
p12_password: ${{ secrets.APPLE_SIGNING_KEY_PASSWORD }}
sign: true
sign_args: "--code-signature-flags=runtime"
- name: Sign Mac App binary root (x86_64-apple-darwin)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
uses: indygreg/apple-code-sign-action@v1
with:
input_path: target/x86_64-apple-darwin/release/neovide
p12_file: key.p12
p12_password: ${{ secrets.APPLE_SIGNING_KEY_PASSWORD }}
sign: true
sign_args: "--code-signature-flags=runtime"
- name: Sign Mac App binary (x86_64-apple-darwin)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
uses: indygreg/apple-code-sign-action@v1
with:
input_path: target/x86_64-apple-darwin/release/bundle/osx/Neovide.app/Contents/MacOS/neovide
p12_file: key.p12
p12_password: ${{ secrets.APPLE_SIGNING_KEY_PASSWORD }}
sign: true
sign_args: "--code-signature-flags=runtime"
- name: Sign Mac App .app (x86_64-apple-darwin)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
uses: indygreg/apple-code-sign-action@v1
with:
input_path: target/x86_64-apple-darwin/release/bundle/osx/Neovide.app
p12_file: key.p12
p12_password: ${{ secrets.APPLE_SIGNING_KEY_PASSWORD }}
sign: true
sign_args: "--code-signature-flags=runtime"
- name: Prepare Artifacts (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "ARTIFACT=neovide.exe" >> $GITHUB_ENV
echo "ARTIFACT2=neovide.msi" >> $GITHUB_ENV
- name: Prepare Artifacts (macOS)
if: matrix.os == 'macos-latest'
run: |
cd $GITHUB_WORKSPACE
# create .dmg for x86_64-apple-darwin
GENERATE_BUNDLE_APP=false GENERATE_DMG=true ./macos-builder/run x86_64-apple-darwin
# create .dmg for aarch64-apple-darwin
GENERATE_BUNDLE_APP=false GENERATE_DMG=true ./macos-builder/run aarch64-apple-darwin
echo "ARTIFACT4=Neovide-x86_64-apple-darwin.dmg" >> $GITHUB_ENV
echo "ARTIFACT5=Neovide-aarch64-apple-darwin.dmg" >> $GITHUB_ENV
- name: Prepare Artifacts (Linux)
if: matrix.os == 'ubuntu-20.04'
run: |
cd target/release
# archive artifact
strip neovide
tar czvf neovide-linux-x86_64.tar.gz neovide
# create appimage
curl -Lo linuxdeploy https://github.com/linuxdeploy/linuxdeploy/releases/latest/download/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy
curl -Lo linuxdeploy-plugin-appimage https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/latest/download/linuxdeploy-plugin-appimage-x86_64.AppImage
chmod +x linuxdeploy-plugin-appimage
export LDAI_OUTPUT=neovide.AppImage
export LDAI_UPDATE_INFORMATION="gh-releases-zsync|neovide|neovide|latest|neovide.AppImage.zsync"
./linuxdeploy \
--executable=neovide \
--desktop-file=../../assets/neovide.desktop \
--appdir=AppDir \
--icon-file=../../assets/neovide.svg \
--output=appimage
echo "ARTIFACT=neovide-linux-x86_64.tar.gz" >> $GITHUB_ENV
echo "ARTIFACT2=neovide.AppImage" >> $GITHUB_ENV
echo "ARTIFACT3=neovide.AppImage.zsync" >> $GITHUB_ENV
- name: Sign Mac App .dmg (aarch64-apple-darwin)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
uses: indygreg/apple-code-sign-action@v1
with:
input_path: target/aarch64-apple-darwin/release/bundle/osx/Neovide-aarch64-apple-darwin.dmg
p12_file: key.p12
p12_password: ${{ secrets.APPLE_SIGNING_KEY_PASSWORD }}
sign: true
sign_args: "--code-signature-flags=runtime"
- name: Sign Mac App .dmg (x86_64-apple-darwin)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
uses: indygreg/apple-code-sign-action@v1
with:
input_path: target/x86_64-apple-darwin/release/bundle/osx/Neovide-x86_64-apple-darwin.dmg
p12_file: key.p12
p12_password: ${{ secrets.APPLE_SIGNING_KEY_PASSWORD }}
sign: true
sign_args: "--code-signature-flags=runtime"
- name: Notarize signed macOS (aarch64-apple-darwin)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
uses: indygreg/apple-code-sign-action@v1
continue-on-error: true
with:
input_path: target/aarch64-apple-darwin/release/bundle/osx/Neovide-aarch64-apple-darwin.dmg
sign: false
notarize: true
staple: true
app_store_connect_api_key_json_file: app_store_connect_api_key.json
- name: Notarize signed macOS (x86_64-apple-darwin)
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/main'
uses: indygreg/apple-code-sign-action@v1
continue-on-error: true
with:
input_path: target/x86_64-apple-darwin/release/bundle/osx/Neovide-x86_64-apple-darwin.dmg
sign: false
notarize: true
staple: true
app_store_connect_api_key_json_file: app_store_connect_api_key.json
- if: env.ARTIFACT
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT }}
path: target/release/${{ env.ARTIFACT }}
- if: env.ARTIFACT2
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT2 }}
path: target/release/${{ env.ARTIFACT2 }}
- if: env.ARTIFACT3
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT3 }}
path: target/release/${{ env.ARTIFACT3 }}
- if: env.ARTIFACT4
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT4 }}
path: target/x86_64-apple-darwin/release/bundle/osx/${{ env.ARTIFACT4 }}
- if: env.ARTIFACT5
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT5 }}
path: target/aarch64-apple-darwin/release/bundle/osx/${{ env.ARTIFACT5 }}