Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ğ
Ğcli-v2s
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
Rust
Ğcli-v2s
Commits
439c267c
Commit
439c267c
authored
1 year ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
build macos packages in CI
parent
9365b805
No related branches found
No related tags found
No related merge requests found
Pipeline
#37108
passed
1 year ago
Stage: build_linux
Stage: build_macos
Stage: release
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
.cargo/config.toml
+8
-0
8 additions, 0 deletions
.cargo/config.toml
.gitlab-ci.yml
+40
-20
40 additions, 20 deletions
.gitlab-ci.yml
Cargo.lock
+1
-1
1 addition, 1 deletion
Cargo.lock
Cargo.toml
+7
-1
7 additions, 1 deletion
Cargo.toml
Dockerfile.ci
+48
-0
48 additions, 0 deletions
Dockerfile.ci
with
104 additions
and
22 deletions
.cargo/config.toml
0 → 100644
+
8
−
0
View file @
439c267c
[target.x86_64-apple-darwin]
linker
=
"o64-clang"
rustflags
=
[
"-C"
,
"link-arg=-mmacosx-version-min
=
10.12
",
"-C"
,
"target-feature
=
+crt-static
",
]
This diff is collapsed.
Click to expand it.
.gitlab-ci.yml
+
40
−
20
View file @
439c267c
# Official language image. Look for the different tagged releases at:
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/rust/tags/
# https://hub.docker.com/r/library/rust/tags/
image
:
"
rust:latest"
stages
:
stages
:
-
build_and_package
-
build_linux
-
build_macos
-
release
-
release
build_
and_package
:
build_
linux
:
stage
:
build_
and_package
stage
:
build_
linux
image
:
rust:slim-buster
image
:
rust:slim-buster
script
:
script
:
# Build the project
# Build the project
for Linux
-
cargo build --release
-
cargo build --release
# Install cargo-deb
-
cargo install cargo-deb
# Create Debian package
# Create Debian package
-
cargo install cargo-deb
-
cargo deb --no-build
-
cargo deb --no-build
-
ls target/debian/*.deb | head -n 1 > debian_package.txt
-
ls target/debian/*.deb | head -n 1 > debian_package.txt
artifacts
:
artifacts
:
...
@@ -24,15 +22,40 @@ build_and_package:
...
@@ -24,15 +22,40 @@ build_and_package:
-
target/debian/*.deb
-
target/debian/*.deb
-
debian_package.txt
-
debian_package.txt
cache
:
cache
:
key
:
key
:
"
$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
files
:
-
Cargo.lock
paths
:
paths
:
-
target/release
-
target/release
-
target/debian
-
target/debian
only
:
only
:
-
tags
-
tags
build_macos
:
stage
:
build_macos
image
:
poka/rust-osxcross:1.0.2
script
:
# Install the required dependencies
-
rustup target add x86_64-apple-darwin
# Build the project for macOS
-
cargo build --release --target x86_64-apple-darwin
# Create the macOS bundle
-
rm -rf target/macos
-
mkdir -p target/macos
-
cargo bundle --release --target x86_64-apple-darwin
# Zip the gcli.app before moving it
-
cd target/x86_64-apple-darwin/release/bundle/osx
-
echo -e "Unzip gcli.zip and move the gcli.app folder to /Applications/ folder.\nenjoy" > instructions.txt
-
zip -r gcli.zip gcli.app instructions.txt
-
mv gcli.zip ../../../../macos/
# target/macos/
artifacts
:
paths
:
-
target/macos
cache
:
key
:
"
$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths
:
-
target/macos
only
:
-
tags
release
:
release
:
stage
:
release
stage
:
release
image
:
registry.gitlab.com/gitlab-org/release-cli:latest
image
:
registry.gitlab.com/gitlab-org/release-cli:latest
...
@@ -42,26 +65,23 @@ release:
...
@@ -42,26 +65,23 @@ release:
-
git fetch --tags
-
git fetch --tags
-
LAST_VERSION=$(git tag --sort=-v:refname | sed -n '2p')
-
LAST_VERSION=$(git tag --sort=-v:refname | sed -n '2p')
-
git log --pretty="format:- %s ([%h]($CI_PROJECT_URL/-/commit/%h)) " HEAD...$LAST_VERSION --reverse > release_description.txt
-
git log --pretty="format:- %s ([%h]($CI_PROJECT_URL/-/commit/%h)) " HEAD...$LAST_VERSION --reverse > release_description.txt
# Define release parameters
release
:
release
:
# Release name and description using the tag name
name
:
"
v$CI_COMMIT_TAG"
name
:
"
v$CI_COMMIT_TAG"
description
:
"
Latest
changes:
\n
$(cat
release_description.txt)"
description
:
"
Latest
changes:
\n
$(cat
release_description.txt)"
# Set the tag for the release
tag_name
:
"
$CI_COMMIT_TAG"
tag_name
:
"
$CI_COMMIT_TAG"
# Attach the artifact to the release
assets
:
assets
:
links
:
links
:
-
name
:
"
gcli
v$CI_COMMIT_TAG
for
Linux
(binary)"
-
name
:
"
gcli
v$CI_COMMIT_TAG
for
Linux
(binary)"
url
:
"
$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/target/release/gcli?job=build_
and_package
"
url
:
"
$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/target/release/gcli?job=build_
linux
"
-
name
:
"
gcli
v$CI_COMMIT_TAG
Debian
Package"
-
name
:
"
gcli
v$CI_COMMIT_TAG
Debian
Package"
url
:
"
$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/$(cat
debian_package.txt)?job=build_and_package"
url
:
"
$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/$(cat
debian_package.txt)?job=build_linux"
# Trigger release creation only for tagged commits
-
name
:
"
gcli
v$CI_COMMIT_TAG
for
macOS"
url
:
"
$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/target/macos/gcli.zip?job=build_macos"
only
:
only
:
-
tags
-
tags
# Not necessary but clearly shows the dependency
dependencies
:
dependencies
:
-
build_and_package
-
build_linux
-
build_macos
artifacts
:
artifacts
:
paths
:
paths
:
-
debian_package.txt
-
debian_package.txt
This diff is collapsed.
Click to expand it.
Cargo.lock
+
1
−
1
View file @
439c267c
...
@@ -2092,7 +2092,7 @@ dependencies = [
...
@@ -2092,7 +2092,7 @@ dependencies = [
[[package]]
[[package]]
name = "gcli"
name = "gcli"
version = "0.2.1
1
"
version = "0.2.1
2
"
dependencies = [
dependencies = [
"age",
"age",
"anyhow",
"anyhow",
...
...
This diff is collapsed.
Click to expand it.
Cargo.toml
+
7
−
1
View file @
439c267c
...
@@ -9,7 +9,8 @@ rust-version = "1.75.0"
...
@@ -9,7 +9,8 @@ rust-version = "1.75.0"
license
=
"AGPL-3.0-only"
license
=
"AGPL-3.0-only"
name
=
"gcli"
name
=
"gcli"
repository
=
"https://git.duniter.org/clients/rust/gcli-v2s"
repository
=
"https://git.duniter.org/clients/rust/gcli-v2s"
version
=
"0.2.11"
description
=
"A command-line interface for Duniter v2s uses"
version
=
"0.2.12"
[dependencies]
[dependencies]
# subxt is main dependency
# subxt is main dependency
...
@@ -58,3 +59,8 @@ default = ["gdev"] # default runtime is "gdev", gdev network is available
...
@@ -58,3 +59,8 @@ default = ["gdev"] # default runtime is "gdev", gdev network is available
gdev
=
[]
gdev
=
[]
gtest
=
[]
gtest
=
[]
g1
=
[]
g1
=
[]
[package.metadata.bundle]
name
=
"gcli"
identifier
=
"com.axiomteam.gcli"
icon
=
[
"gcli.png"
]
This diff is collapsed.
Click to expand it.
Dockerfile.ci
0 → 100644
+
48
−
0
View file @
439c267c
# Stage 1: Build environment with all dependencies
FROM rust:slim-bookworm as builder
# Install necessary dependencies
RUN apt-get update && apt-get install -y \
clang \
llvm \
make \
file \
git \
curl \
cmake \
python3 \
python3-dev \
python3-pip
# Clone osxcross repository and set up
RUN git clone https://github.com/tpoechtrager/osxcross.git /opt/osxcross && \
cd /opt/osxcross && \
./tools/get_dependencies.sh && \
cd /opt/osxcross/tarballs && \
curl -LO https://github.com/joseluisq/macosx-sdks/releases/download/10.12/MacOSX10.12.sdk.tar.xz && \
cd /opt/osxcross && \
UNATTENDED=yes ./build.sh
# Stage 2: Create the final image with only the necessary files
FROM rust:slim-bookworm
# Install cargo-bundle
RUN cargo install cargo-bundle
RUN apt-get update && apt-get install -y --no-install-recommends clang zip; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
# Copy cargo plugins from the builder stage
COPY --from=builder /opt/osxcross/target /opt/osxcross/target
# Set environment variables for osxcross and Rust
ENV PATH="/opt/osxcross/target/bin:/usr/local/cargo/bin:$PATH"
ENV CC="o64-clang"
ENV CXX="o64-clang++"
# Add rust target for macOS
RUN rustup target add x86_64-apple-darwin
# Define the entrypoint
CMD ["bash"]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment