Skip to content

Commit c1375e4

Browse files
setup CI
1 parent 776601d commit c1375e4

File tree

8 files changed

+110
-0
lines changed

8 files changed

+110
-0
lines changed

.github/workflows/c.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: C CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-linux:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- run: sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-gfx-dev libsdl2-mixer-dev
14+
- uses: actions/checkout@v3
15+
- name: make
16+
run: make
17+
- name: Zip Release
18+
uses: TheDoctor0/zip-release@0.6.2
19+
with:
20+
type: 'zip'
21+
filename: 'release-linux.zip'
22+
path: res/ game
23+
- uses: "marvinpinto/action-automatic-releases@latest"
24+
with:
25+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
26+
automatic_release_tag: "latest-linux"
27+
prerelease: false
28+
title: "Latest Linux Build"
29+
files: |
30+
release-linux.zip
31+
build-windows:
32+
runs-on: windows-latest
33+
defaults:
34+
run:
35+
shell: msys2 {0}
36+
steps:
37+
- name: checkout repo
38+
uses: actions/checkout@v3
39+
40+
- name: setup msys2
41+
uses: msys2/setup-msys2@v2
42+
with:
43+
update: true
44+
install: >-
45+
base-devel
46+
git
47+
make
48+
mingw-w64-x86_64-gcc
49+
mingw-w64-x86_64-harfbuzz
50+
mingw-w64-x86_64-SDL2
51+
mingw-w64-x86_64-SDL2_ttf
52+
mingw-w64-x86_64-SDL2_gfx
53+
mingw-w64-x86_64-SDL2_image
54+
mingw-w64-x86_64-SDL2_mixer
55+
56+
- name: build project
57+
run: make -f Makefile_win
58+
59+
- name: move libs to current directory for packing
60+
run: mv libs/* .
61+
62+
- name: zip and upload game
63+
uses: TheDoctor0/zip-release@0.6.2
64+
with:
65+
type: 'zip'
66+
filename: 'release-windows.zip'
67+
path: res/ *.dll game.exe
68+
- uses: "marvinpinto/action-automatic-releases@latest"
69+
with:
70+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
71+
automatic_release_tag: "latest-windows"
72+
prerelease: false
73+
title: "Latest Windows Build"
74+
files: |
75+
release-windows.zip

Makefile_win

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# this makefile is a stripped down version of this one:
2+
# https://makefiletutorial.com/#makefile-cookbook
3+
4+
TARGET_EXEC := game
5+
6+
CC := gcc
7+
8+
BUILD_DIR := ./build
9+
SRC_DIRS := ./src
10+
11+
CFLAGS := -O3
12+
LINKERFLAGS := -Isdl/include -Lsdl/lib -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer -lm
13+
14+
# Find all the C files we want to compile
15+
# Note the single quotes around the * expressions. Make will incorrectly expand these otherwise.
16+
SRCS := $(shell find $(SRC_DIRS) -name '*.c')
17+
18+
# String substitution for every C file.
19+
# As an example, hello.cpp turns into ./build/hello.cpp.o
20+
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
21+
22+
# The final build step.
23+
$(TARGET_EXEC): $(OBJS)
24+
$(CC) $(OBJS) $(LINKERFLAGS) -o game
25+
26+
# Build step for C source
27+
$(BUILD_DIR)/%.c.o: %.c
28+
mkdir -p $(dir $@)
29+
$(CC) $(CFLAGS) $(LINKERFLAGS) -c $< -o $@
30+
31+
32+
.PHONY: clean
33+
clean:
34+
rm -r $(BUILD_DIR)
35+
rm game

libs/SDL2.dll

2.15 MB
Binary file not shown.

libs/SDL2_image.dll

123 KB
Binary file not shown.

libs/SDL2_mixer.dll

132 KB
Binary file not shown.

libs/SDL2_ttf.dll

1.46 MB
Binary file not shown.

libs/libpng16-16.dll

237 KB
Binary file not shown.

libs/zlib1.dll

116 KB
Binary file not shown.

0 commit comments

Comments
 (0)