Skip to content

Commit 18e6ca4

Browse files
committed
feat(ci): add ci
Signed-off-by: dark0dave <dark0dave@mykolab.com>
1 parent b1b4479 commit 18e6ca4

File tree

16 files changed

+145
-21
lines changed

16 files changed

+145
-21
lines changed

.envrc.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
set -a
2+
use flake

.github/workflows/main.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: main
2+
on:
3+
pull_request:
4+
concurrency:
5+
group: ${{ github.ref }}-${{ github.workflow }}
6+
jobs:
7+
build-linux:
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- uses: actions/checkout@main
11+
- name: build tileconv
12+
run: |
13+
sudo apt-get update -yqqq
14+
sudo apt-get install -yqqq libsquish-dev zlib1g-dev libimagequant0 libjpeg-turbo
15+
make -j$(npoc) -C tileconv
16+
- uses: actions/upload-artifact@v4
17+
with:
18+
name: ubuntu-22.04
19+
path: tileconv/tileconv
20+
if-no-files-found: error
21+
build-nix:
22+
strategy:
23+
matrix:
24+
include:
25+
- os: macos-latest
26+
- os: macos-15-intel
27+
- os: ubuntu-24.04
28+
- os: ubuntu-24.04-arm
29+
runs-on: ${{ matrix.os }}
30+
steps:
31+
- uses: actions/checkout@main
32+
- uses: cachix/install-nix-action@master
33+
with:
34+
nix_path: nixpkgs=channel:nixos-25.11
35+
- run: |
36+
nix-build

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@
2626
/Debug
2727
/Release
2828
/.settings
29+
30+
.direnv
31+
.envrc
32+
result

default.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
let
2+
nixpkgs_unstable = import (fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-unstable-small") { };
3+
in
4+
{ pkgs ? nixpkgs_unstable, ... }:
5+
pkgs.stdenv.mkDerivation rec {
6+
name = "tileconv";
7+
src = ./tileconv;
8+
nativeBuildInputs = with pkgs; [
9+
gnumake
10+
libjpeg8
11+
libsquish
12+
libimagequant
13+
zlib
14+
];
15+
buildInputs = with pkgs; [
16+
git
17+
];
18+
configurePhase = ''
19+
make clean
20+
mkdir -p $out/bin
21+
'';
22+
buildPhase = ''
23+
make -j$(nproc) all
24+
cp tileconv $out/bin/tileconv
25+
'';
26+
installPhase = ''
27+
ls $out
28+
'';
29+
enableParallelBuilding = true;
30+
}

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
4+
};
5+
outputs = { self, nixpkgs }:
6+
let
7+
systems = [
8+
"x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"
9+
];
10+
forEachSystem = f: nixpkgs.lib.genAttrs systems (system: f system);
11+
pkgsFor = nixpkgs.legacyPackages;
12+
in {
13+
devShells = forEachSystem (system:
14+
let
15+
pkgs = import nixpkgs { inherit system; };
16+
in {
17+
default = pkgs.stdenv.mkDerivation {
18+
name = "tileconv";
19+
src = ./tileconv;
20+
# Libs
21+
buildInputs = with pkgs; [
22+
gnumake
23+
libjpeg8
24+
libsquish
25+
libimagequant
26+
zlib
27+
];
28+
# Tools
29+
nativeBuildInputs = with pkgs; [
30+
direnv
31+
git
32+
];
33+
# Env
34+
shellHook = ''
35+
'';
36+
};
37+
});
38+
packages = forEachSystem (system: {
39+
default = pkgsFor.${system}.callPackage ./default.nix { pkgs = import nixpkgs { inherit system; }; };
40+
});
41+
};
42+
}

tileconv/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ include config.mk
66

77
CXX ?= g++
88
CXXFLAGS = -c -Wall -O2 -std=c++11 -msse -mfpmath=sse -I$(ZLIB_INCLUDE) -I$(PNGQUANT_INCLUDE) -I$(SQUISH_INCLUDE) -I$(JPEG_INCLUDE)
9-
LDFLAGS = -L$(ZLIB_LIB) -L$(PNGQUANT_LIB) -L$(SQUISH_LIB) -L$(JPEG_LIB)
109
LIBS = -lz -limagequant -lsquish -ljpeg
1110
EXECUTABLE = tileconv
1211

@@ -78,5 +77,4 @@ $(EXECUTABLE): $(OBJECTS)
7877
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -o $@
7978

8079
clean:
81-
$(RM) $(OBJECTS)
82-
# $(RM) *.o
80+
$(RM) -f *.o

tileconv/colorquant.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ THE SOFTWARE.
2222
#ifndef _COLORQUANT_H_
2323
#define _COLORQUANT_H_
2424

25-
#include <lib/libimagequant.h>
25+
#include <libimagequant.h>
2626

2727
namespace tc {
2828

tileconv/config.mk

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
# Where to install (Linux/Mac only)
22
INSTALL_DIR ?= /usr/local
33

4-
# Include paths of the external libraries
5-
ZLIB_INCLUDE ?= ./zlib
6-
SQUISH_INCLUDE ?= ./squish
7-
PNGQUANT_INCLUDE ?= ./pngquant
8-
JPEG_INCLUDE ?= ./jpeg-turbo
9-
10-
# Paths to the libraries
11-
ZLIB_LIB ?= ./zlib
12-
SQUISH_LIB ?= ./squish
13-
PNGQUANT_LIB ?= ./pngquant/lib
14-
JPEG_LIB ?= ./jpeg-turbo
15-
164
# Set to 1 when compiling on Windows using Win32 threads
175
USE_WINTHREADS ?= 0

tileconv/jpeg-turbo/remove.me

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)