Skip to content

Commit

Permalink
add static build workflow
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit faf10df
Author: azimut <[email protected]>
Date:   Mon Mar 18 00:22:29 2024 -0300

    revert ci changes

commit 0e93247
Author: azimut <[email protected]>
Date:   Mon Mar 18 00:15:46 2024 -0300

    ignore mp4 and final test of mv -> cp of stripped

commit 61a71d3
Author: azimut <[email protected]>
Date:   Mon Mar 18 00:09:44 2024 -0300

    run commands inside makefile/docker

commit 08f6f2b
Author: azimut <[email protected]>
Date:   Sun Mar 17 23:57:19 2024 -0300

    add strip into docker step

commit 145d7ce
Author: azimut <[email protected]>
Date:   Sun Mar 17 23:48:29 2024 -0300

    makefile: remove -ti of docker run

commit fd435b5
Author: azimut <[email protected]>
Date:   Sun Mar 17 23:41:08 2024 -0300

    tmp changing workflow to do the docker stuff

commit 5efe3dc
Author: azimut <[email protected]>
Date:   Sun Mar 17 23:36:41 2024 -0300

    add files for static release

commit c5c9063
Author: azimut <[email protected]>
Date:   Sun Mar 17 22:28:32 2024 -0300

    build changes for static target
  • Loading branch information
azimut committed Mar 18, 2024
1 parent a6920cb commit 0362c98
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 15 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
name: CI build
on:
push:
branches:
- "*"
paths-ignore:
- 'LICENSE'
- 'README.md'
- '.github/workflows/release.yml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 5.1.x
dune-cache: true
- run: make deps
- run: make dev release
- run: make test
- run: make dev release
- uses: actions/upload-artifact@v2
if: "!startsWith(github.ref, 'refs/tags/')"
with:
name: ffbar-linux-x86_64
name: ffbar-ubuntu-linux-x86_64
path: _build/default/bin/main.exe
if-no-files-found: error
- uses: marvinpinto/action-automatic-releases@latest
if: "startsWith(github.ref, 'refs/tags/')"
with:
prerelease: false
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: |
_build/default/src/main.exe
LICENSE
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release on new tag
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: make image
- run: make docker
- run: cp _build_static/default/bin/main.exe ffbar
- uses: marvinpinto/action-automatic-releases@latest
with:
prerelease: false
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: |
ffbar
LICENSE
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.mp4
_build_static/
_build_release/

# Created by https://www.toptal.com/developers/gitignore/api/ocaml
Expand Down
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM alpine:3.19

RUN apk add \
bash\
bubblewrap\
coreutils\
gcc\
git\
m4\
make\
musl-dev\
opam

RUN opam init\
--disable-sandboxing\
--auto-setup\
--compiler ocaml-base-compiler.5.1.1

WORKDIR /build

ADD Makefile /build/
ADD ffbar.opam /build/

RUN make deps
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
.PHONY: dev release deps test clean run install
.PHONY: dev release static docker image deps test clean run install

dev: ; opam exec -- dune build
release: ; opam exec -- dune build --profile release --build-dir _build_release
static:
opam exec -- dune build --profile static --build-dir _build_static
strip _build_static/default/bin/main.exe

deps: ; opam install . --deps-only --with-test
image:; docker build --tag ffbar:latest .
docker:; docker run --rm --volume=$(shell pwd):/build ffbar make static

deps: ; opam install --deps-only --yes .
test: ; opam exec -- dune runtest
clean: ; opam exec -- dune clean ; rm -rf _build_release _build
run: ; opam exec -- dune exec ffbar
Expand Down
2 changes: 2 additions & 0 deletions bin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
(libraries ffbar progress))

(env
(static
(flags (:standard -ccopt -static)))
(dev
(flags (:standard -w @A-4-33-40-41-42-43-34-44-70)))
(release
Expand Down

0 comments on commit 0362c98

Please sign in to comment.