Skip to content

Commit

Permalink
Merge pull request #7 from Kosette/feature/ci
Browse files Browse the repository at this point in the history
build: create CI workflow
  • Loading branch information
tsukinaha authored Mar 27, 2024
2 parents 1ef6773 + 9bd89c2 commit 540cad8
Show file tree
Hide file tree
Showing 8 changed files with 344 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git*
Dockerfile
38 changes: 38 additions & 0 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Linux Releases
on:
workflow_dispatch:
push:
branches:
- 'main'
schedule:
- cron: '45 3 * * *'

jobs:
build-release:
strategy:
matrix:
include:
- arch-name: x86_64-linux-gnu
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: tsukimi

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

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build ${{matrix.target}}
run: |
mkdir artifact
docker build -t tsukimi .
docker run -d --name tsukimi tsukimi
docker cp tsukimi:/usr/src/tsukimi/. artifact/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{matrix.artifact}}-${{matrix.arch-name}}
path: artifact/*
compression-level: 0
54 changes: 54 additions & 0 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build MacOS Releases
on:
workflow_dispatch:
push:
branches:
- 'main'
schedule:
- cron: '0 4 * * *'

env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

jobs:
build-release:
env:
RUST_BACKTRACE: full
strategy:
matrix:
include:
- arch-name: x86_64-macos
os: macos-latest
target: x86_64-apple-darwin
artifact: tsukimi
ext:

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

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Dependencies
run: |
brew install gtk4
brew install libadwaita
rustup target add ${{matrix.target}}
cargo build --release --locked
- name: Make MacOS package
run: |
mkdir -p Tsukimi.app/Contents/MacOS
mkdir -p Tsukimi.app/Contents/Resources
cp share/macos/Info.plist Tsukimi.app/Contents/
cp share/macos/AppIcon.icns Tsukimi.app/Contents/Resources/
mv target/release/tsukimi Tsukimi.app/Contents/MacOS/
tar -czf tsukimi-x86_64-apple-darwin.tar.gz Tsukimi.app/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{matrix.artifact}}-${{matrix.target}}
path: tsukimi-${{matrix.target}}.tar.gz
compression-level: 0
172 changes: 172 additions & 0 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: Build releases and publish
on:
workflow_dispatch:
push:
tags:
- v*

env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
RUST_BACKTRACE: full

jobs:
build:
strategy:
matrix:
include:
# x86_64-windows-msvc
- arch: x86_64-windows-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
artifact: tsukimi.exe
ext: .exe
# x86_64-windows-gnu
- arch: x86_64-windows-gnu
os: windows-latest
target: x86_64-pc-windows-gnu
artifact: tsukimi.exe
ext: .exe
# x86_64-linux-gnu
- arch: x86_64-linux-gnu
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: tsukimi
ext:
# x86_64-apple-darwin
- arch: x86_64-apple-darwin
os: macos-latest
target: x86_64-apple-darwin
artifact: tsukimi
ext:

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

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build ${{ matrix.target }}
if: ${{ matrix.target == 'x86_64-pc-windows-msvc' }}
run: |
rustup default stable-msvc
py -3.12 -m pip install --user pipx
py -3.12 -m pipx ensurepath
pipx install gvsbuild
$env:Path = "C:\gtk-build\gtk\x64\release\lib\pkgconfig;C:\gtk-build\gtk\x64\release\bin;C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\msys64\mingw64\lib;C:\msys64\mingw64\include;" + $env:Path
$env:LIB = "C:\gtk-build\gtk\x64\release\lib;C:\msys64\mingw64\lib;" + $env:LIB
$env:INCLUDE = "C:\gtk-build\gtk\x64\release\include;C:\gtk-build\gtk\x64\release\include\cairo;C:\gtk-build\gtk\x64\release\include\glib-2.0;C:\gtk-build\gtk\x64\release\include\gobject-introspection-1.0;C:\gtk-build\gtk\x64\release\lib\glib-2.0\include;C:\msys64\mingw64\include;" + $env:INCLUDE
$env:PKG_CONFIG_PATH = "C:\gtk-build\gtk\x64\release\lib\pkgconfig;" + $env:PKG_CONFIG_PATH
gvsbuild build gtk4 libadwaita adwaita-icon-theme
cargo build --release --locked --target ${{ matrix.target }}
mkdir artifact
cp target/${{matrix.target}}/release/${{ matrix.artifact }} artifact/tsukimi-${{ matrix.arch }}${{ matrix.ext }}
cp C:\gtk-build\gtk\x64\release\bin\*.dll artifact/
compress-archive -path artifact/* -destination artifact/tsukimi-${{matrix.arch}}.zip
- name: Build ${{ matrix.target }}
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
run: |
rustup toolchain install stable-gnu
rustup default stable-gnu
C:\msys64\usr\bin\pacman.exe -S --needed --noconfirm mingw-w64-x86_64-gtk4 mingw-w64-x86_64-gettext mingw-w64-x86_64-libxml2 mingw-w64-x86_64-librsvg mingw-w64-x86_64-pkgconf mingw-w64-x86_64-gcc mingw-w64-x86_64-libadwaita
C:\msys64\usr\bin\pacman.exe -Syu --noconfirm
- name: Build ${{ matrix.target }}
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
run: |
$env:Path = "C:\msys64\mingw64\bin;C:\msys64\mingw64\lib;C:\msys64\mingw64\include;" + $env:Path;
cargo build --release --locked --target ${{ matrix.target }}
mkdir artifact/
cp target/${{matrix.target}}/release/${{ matrix.artifact }} artifact/tsukimi-${{ matrix.arch }}${{ matrix.ext }}
cp C:/msys64/mingw64/bin/*.dll artifact
compress-archive -path artifact/* -destination artifact/tsukimi-${{matrix.arch}}.zip
- name: Build ${{matrix.target}}
if: ${{matrix.target == 'x86_64-unknown-linux-gnu'}}
run: |
mkdir artifact
docker build -t tsukimi .
docker run -d --name tsukimi tsukimi
docker cp tsukimi:/usr/src/tsukimi/. artifact/
cd artifact
tar -czf tsukimi-${{matrix.arch}}.tar.gz tsukimi
- name: Build ${{matrix.target}}
if: ${{matrix.target == 'x86_64-apple-darwin'}}
run: |
brew install gtk4
brew install libadwaita
rustup target add ${{matrix.target}}
cargo build --release --locked --target ${{matrix.target}}
mkdir artifact
cp target/${{matrix.target}}/release/${{matrix.artifact}} artifact/
cd artifact/
tar -czf tsukimi-${{matrix.arch}}.tar.gz ./*
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: tsukimi-${{matrix.arch}}
path: |
artifact/*.deb
artifact/tsukimi-*.zip
artifact/tsukimi-*.tar.gz
compression-level: 0

publish:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4

- name: Package MacOS x86_64
run: |
tar -xzf tsukimi-x86_64-apple-darwin/tsukimi-x86_64-apple-darwin.tar.gz
mkdir -p Tsukimi.app/Contents/MacOS
mkdir -p Tsukimi.app/Contents/Resources
cp share/macos/Info.plist Tsukimi.app/Contents/
cp share/macos/AppIcon.icns Tsukimi.app/Contents/Resources/
mv tsukimi Tsukimi.app/Contents/MacOS/
tar -czf tsukimi-x86_64-apple-darwin.tar.gz Tsukimi.app/
- name: Package Windows GNU
run: |
mv tsukimi-x86_64-windows-gnu/*.zip .
- name: Package Windows MSVC
run: |
mv tsukimi-x86_64-windows-msvc/*.zip .
- name: Package Linux GNU
run: |
mv tsukimi-x86_64-linux-gnu/*.tar.gz .
mv tsukimi-x86_64-linux-gnu/*.deb .
- name: Calculate hash
run: |
sha512sum *.zip > tsukimi.sha512sum
sha512sum *.tar.gz >> tsukimi.sha512sum
sha512sum *.deb >> tsukimi.sha512sum
- name: Get latest tag name
run: echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV

- name: Upload Github Assets
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
*.zip
*.tar.gz
*.deb
tsukimi.sha512sum
tag_name: ${{ env.TAG_NAME }}
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM archlinux:latest as builder

WORKDIR /usr/src/tsukimi

COPY . .
ENV CARGO_TERM_COLOR=always \
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse \
RUST_BACKTRACE=full

RUN pacman -Syu --noconfirm &&\
pacman -S --noconfirm base-devel gtk4 libadwaita &&\
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y &&\
export PATH=$HOME/.cargo/bin:$PATH &&\
cargo build --release --locked

RUN pacman -Syu --noconfirm &&\
pacman -S --noconfirm base-devel gtk4 libadwaita &&\
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y &&\
export PATH=$HOME/.cargo/bin:$PATH &&\
cargo install cargo-deb --no-default-features &&\
cargo deb

FROM ubuntu:latest

WORKDIR /usr/src/tsukimi

VOLUME /usr/src/tsukimi

COPY --from=builder /usr/src/tsukimi/target/release/tsukimi /usr/src/tsukimi/

COPY --from=builder /usr/src/tsukimi/target/debian/*.deb /usr/src/tsukimi/

ENTRYPOINT ["sleep","3600"]
2 changes: 1 addition & 1 deletion resources/ui/movie.ui
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<child>
<object class="GtkPicture" id="backdrop">
<property name="halign">fill</property>
<property name="valign">start</property>
<property name="valign">fill</property>
<property name="content-fit">cover</property>
<property name="hexpand">true</property>
<property name="vexpand">true</property>
Expand Down
Binary file added share/macos/AppIcon.icns
Binary file not shown.
44 changes: 44 additions & 0 deletions share/macos/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Tsukimi</string>
<key>CFBundleDisplayName</key>
<string>Tsukimi</string>
<key>CFBundleIdentifier</key>
<string>com.inaha.tsukimi</string>
<key>CFBundleExecutable</key>
<string>tsukimi</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>CFBundleIconName</key>
<string>AppIcon</string>
<key>CFBundleSignature</key>
<string>suki</string>

<key>LSMinimumSystemVersion</key>
<string>12.7.3</string>

<key>CFBundleVersion</key>
<string>0.0.3</string>
<key>CFBundleShortVersionString</key>
<string>0.0.3</string>
<key>CFBundlePackageType</key>
<string>APPL</string>

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>tsukimi</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLSchemes</key>
<array>
<string>tsukimi</string>
</array>
</dict>
</array>
</dict>
</plist>

0 comments on commit 540cad8

Please sign in to comment.