Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Thepathakarpit authored Oct 25, 2024
2 parents 37b929c + f776ee7 commit 2037982
Show file tree
Hide file tree
Showing 24 changed files with 2,106 additions and 1,465 deletions.
25 changes: 7 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true

env:
CN_APP_SLUG: verso-nightly
CN_APP_SLUG: verso/verso-nightly

jobs:
pr-fast-check:
Expand Down Expand Up @@ -72,6 +72,7 @@ jobs:
- name: Install flatpak dependencies
if: ${{ github.event_name == 'schedule' }}
run: |
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y --noninteractive flathub org.freedesktop.Platform//23.08
Expand Down Expand Up @@ -116,7 +117,7 @@ jobs:
- name: Fetch Verso version
if: ${{ github.event_name == 'schedule' }}
run: |
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "verso") | .version')" >> $GITHUB_ENV
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "versoview") | .version')" >> $GITHUB_ENV
- name: Generate flatpak cargo sources
if: ${{ github.event_name == 'schedule' }}
Expand Down Expand Up @@ -153,12 +154,6 @@ jobs:
- name: Install Rust
uses: dsherret/rust-toolchain-file@v1

- name: Install Rust toolchain for packager
if: ${{ github.event_name == 'schedule' }}
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Install Python
uses: actions/setup-python@v5
with:
Expand All @@ -177,7 +172,7 @@ jobs:

- name: Install Cargo Packager
if: ${{ github.event_name == 'schedule' }}
run: cargo +stable install cargo-packager
run: cargo install cargo-packager

- name: Build
run: |
Expand All @@ -195,7 +190,7 @@ jobs:
- name: Fetch Verso version
if: ${{ github.event_name == 'schedule' }}
run: |
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "verso") | .version')" >> $Env:GITHUB_ENV
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "versoview") | .version')" >> $Env:GITHUB_ENV
- name: Upload artifact
if: ${{ github.event_name == 'schedule' }}
Expand Down Expand Up @@ -225,12 +220,6 @@ jobs:
- name: Install Rust
uses: dsherret/rust-toolchain-file@v1

- name: Install Rust toolchain for packager
if: ${{ github.event_name == 'schedule' }}
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Install Python
uses: actions/setup-python@v5
with:
Expand All @@ -250,7 +239,7 @@ jobs:

- name: Install Cargo Packager
if: ${{ github.event_name == 'schedule' }}
run: cargo +stable install cargo-packager
run: cargo install cargo-packager

- name: Build
run: |
Expand All @@ -272,7 +261,7 @@ jobs:
- name: Fetch Verso version
if: ${{ github.event_name == 'schedule' }}
run: |
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "verso") | .version')" >> $GITHUB_ENV
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "versoview") | .version')" >> $GITHUB_ENV
- name: Upload artifact
if: ${{ github.event_name == 'schedule' }}
Expand Down
78 changes: 33 additions & 45 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,35 @@ on:

jobs:
build:
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: sccache
CCACHE: sccache
SCCACHE_GHA_ENABLED: 'true'
LIBCLANG_PATH: /usr/lib/llvm-14/lib
runs-on: ubuntu-24.04
permissions:
actions: write # for purging
steps:
- name: Checkout branch
uses: actions/checkout@v4

- name: Run sccache-cache
uses: Mozilla-Actions/sccache-action@v0.0.5
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v28

- name: Configure cache
uses: Swatinem/rust-cache@v2

- name: Install Nix
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Setup Nix Shell
uses: rrbutani/use-nix-shell-action@v1
- name: "Restore and cache Nix store"
uses: nix-community/cache-nix-action@v5
with:
file: shell.nix
paths: |
~/.cargo
target/debug/
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', 'Cargo.lock', 'Cargo.toml') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 1073741824

- name: Clean docs folder
run: cargo clean --doc
- name: "Add Nix channel"
run: |
nix-channel --add https://nixos.org/channels/nixos-24.05 nixpkgs
nix-channel --update nixpkgs
- name: Build docs
run: cargo doc -p verso --no-deps
- name: "Build Verso docs"
run: nix-shell shell.nix --run 'cargo doc -p versoview --no-deps'

- name: Remove lock file
- name: "Remove doc lock file"
run: rm target/doc/.lock

- name: Upload `doc`
- name: "Upload `doc` artifact"
uses: actions/upload-artifact@v4
with:
name: doc
Expand All @@ -54,33 +47,28 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout `docs` repository
- name: "Checkout `docs` repository"
uses: actions/checkout@v4
with:
repository: versotile-org/docs.versotile.org
repository: versotile-org/www-docs
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
ref: docs

- name: Clean up docs directory
run: |
cp {docs/,}index.html
rm -r docs/*
mv index.html docs/
cp CNAME docs/
- name: Download `doc`
- name: "Download `doc` artifact"
uses: actions/download-artifact@v4
with:
name: doc
path: docs
path: artifact

- name: Configure Git
- name: "Configure git, commit changes and PUSH"
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Commit and push
run: |
git add docs
git commit -m ":rocket: update docs from \`verso\` repository"
rm -r docs/*
cp -r artifact/* docs/
git add docs/
git fetch origin main:main
git checkout main docs/
git status
git commit -m ":rocket: update docs from \`verso\` repository" || exit 0
git push origin docs
137 changes: 137 additions & 0 deletions .github/workflows/release-versoview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Release VersoView

on:
workflow_dispatch:

env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v28

- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v5
with:
paths: |
~/.cargo
target/release/
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', 'Cargo.lock', 'Cargo.toml') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 1073741824

- name: Add Nix channel
run: |
nix-channel --add https://nixos.org/channels/nixos-24.05 nixpkgs
nix-channel --update nixpkgs
- name: Build
run: nix-shell shell.nix --run 'cargo build --release'

- name: Make archive
run: nix-shell shell.nix --run 'cd ./target/release && tar -czvf verso-x86_64-unknown-linux-gnu.tar.gz versoview'

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: verso-x86_64-unknown-linux-gnu
path: ./target/release/verso-x86_64-unknown-linux-gnu.tar.gz

build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install mako
run: python -m pip install mako

- name: Install scroop
uses: MinoruSekine/setup-scoop@v3
- name: Install dependencies
run: |
scoop install llvm cmake
- name: Build
env:
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: "sccache"
run: cargo build --release

- name: Make archive
working-directory: ./target/release
run: tar -czvf verso-x86_64-pc-windows-msvc.tar.gz versoview.exe

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: verso-x86_64-pc-windows-msvc
path: ./target/release/verso-x86_64-pc-windows-msvc.tar.gz

build-mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install mako
run: python -m pip install mako

- name: Install dependencies
run: |
brew install cmake
curl https://gstreamer.freedesktop.org/data/pkg/osx/1.24.6/gstreamer-1.0-1.24.6-universal.pkg -o runtime.pkg
sudo installer -pkg runtime.pkg -target /
curl https://gstreamer.freedesktop.org/data/pkg/osx/1.24.6/gstreamer-1.0-devel-1.24.6-universal.pkg -o develop.pkg
sudo installer -pkg develop.pkg -target /
- name: Build
env:
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: "sccache"
run: cargo build --release

- name: Make archive
working-directory: ./target/release
run: tar -czvf verso-aarch64-apple-darwin.tar.gz versoview

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: verso-aarch64-apple-darwin
path: ./target/release/verso-aarch64-apple-darwin.tar.gz

publish-release:
runs-on: ubuntu-latest
needs: [build-linux, build-windows, build-mac]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts

- name: Publish release
run: |
RELEASE_TAG=versoview-v$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "versoview") | .version')
git fetch --tags --quiet
if ! git show-ref --tags --verify --quiet "refs/tags/${RELEASE_TAG}" ; then
gh release create ${RELEASE_TAG} ./artifacts/*.tar.gz
fi
Loading

0 comments on commit 2037982

Please sign in to comment.