Skip to content

Commit 9fadd5b

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

File tree

15 files changed

+142
-20
lines changed

15 files changed

+142
-20
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: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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 bison cmake flex wget libfl-dev
15+
mkdir -p obj
16+
make -j$(npoc) -C tileconv
17+
- uses: actions/upload-artifact@v4
18+
with:
19+
name: ubuntu-22.04
20+
path: tileconv/tileconv
21+
if-no-files-found: error
22+
build-nix:
23+
strategy:
24+
matrix:
25+
include:
26+
- os: macos-latest
27+
target: '.#packages.aarch64-darwin'
28+
- os: macos-15-intel
29+
target: '.#packages.x86_64-darwin'
30+
- os: ubuntu-24.04
31+
target: '.#packages.x86_64-linux'
32+
- os: ubuntu-24.04-arm
33+
target: '.#packages.aarch64-linux'
34+
runs-on: ${{ matrix.os }}
35+
steps:
36+
- uses: actions/checkout@main
37+
- uses: cachix/install-nix-action@master
38+
with:
39+
nix_path: nixpkgs=channel:nixos-25.11
40+
- run: |
41+
nix build ${{ matrix.target }}

.gitignore

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

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: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
4+
};
5+
outputs = { self, nixpkgs }:
6+
let systems = [
7+
"x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"
8+
];
9+
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
10+
in {
11+
devShells = forAllSystems (system:
12+
let
13+
pkgs = import nixpkgs { inherit system; };
14+
in {
15+
default = pkgs.stdenv.mkDerivation {
16+
name = "tileconv";
17+
src = ./tileconv;
18+
# Libs
19+
buildInputs = with pkgs; [
20+
gnumake
21+
libjpeg8
22+
libsquish
23+
libimagequant
24+
zlib
25+
];
26+
# Tools
27+
nativeBuildInputs = with pkgs; [
28+
direnv
29+
git
30+
];
31+
# Env
32+
shellHook = ''
33+
'';
34+
};
35+
});
36+
packages = forAllSystems (system:
37+
let
38+
pkgs = import nixpkgs { inherit system; };
39+
in pkgs.stdenv.mkDerivation {
40+
pname = "tileconv";
41+
src = ./tileconv;
42+
nativeBuildInputs = with pkgs; [
43+
gnumake
44+
libjpeg8
45+
libsquish
46+
libimagequant
47+
zlib
48+
];
49+
buildInputs = with pkgs; [
50+
git
51+
];
52+
configurePhase = ''
53+
make -C tileconv
54+
'';
55+
buildPhase = ''
56+
make -j$(nproc) -C $out
57+
'';
58+
installPhase = ''
59+
ls $out
60+
'';
61+
enableParallelBuilding = true;
62+
}
63+
);
64+
};
65+
}

tileconv/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,4 @@ $(EXECUTABLE): $(OBJECTS)
7878
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -o $@
7979

8080
clean:
81-
$(RM) $(OBJECTS)
82-
# $(RM) *.o
81+
$(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.

tileconv/pngquant/lib/remove.me

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

0 commit comments

Comments
 (0)