Skip to content
Snippets Groups Projects
Commit 4ab0df34 authored by Éloïs's avatar Éloïs
Browse files

[ci] add automatic windows build

parent 1c52b40b
No related branches found
No related tags found
1 merge request!80CI build release for windows 64 bits
...@@ -117,7 +117,23 @@ pages: ...@@ -117,7 +117,23 @@ pages:
only: only:
- dev - dev
package:test:linux-x64: package:test:win64:
tags:
- redshift-rust-win64
before_script:
- rustc --version && cargo --version
stage: package
script:
- bash "release/arch/win64/build-win64.sh" "$(date +%Y%m%d).$(date +%H%M).$(date +%S)"
artifacts:
paths:
- work/bin/
expire_in: 1 weeks
except:
- tags
when: manual
package:test:linux64:
<<: *rust_stable_env <<: *rust_stable_env
stage: package stage: package
script: script:
...@@ -134,7 +150,7 @@ package:test:linux-x64: ...@@ -134,7 +150,7 @@ package:test:linux-x64:
- tags - tags
when: manual when: manual
package:prod:linux-x64: package:prod:linux64:
<<: *rust_stable_env <<: *rust_stable_env
stage: package stage: package
script: script:
......
#!/bin/bash
if [[ -z "${1}" ]]; then
echo "Fatal: no version given to build script"
exit 1
fi
# ---------
# Functions
# ---------
# Create description.
# -
# Parameters:
# 1. Initial file name.
# 2. Building type (either “desktop” or “server”).
# 3. Category (OS, distribution).
create_desc() {
cat >"${1}".desc <<-EOF
{
"version": "${DURS_TAG}",
"job": "${CI_JOB_ID}",
"type": "${2^}",
"category": "${3}",
"arch": "x64"
}
EOF
}
# -----------
# Prepare
# -----------
DURS_TAG="v${1}"
DURS_VER=" ${1}"
TARGET="x86_64-pc-windows-gnu"
#rustup add target ${TARGET} || exit 1
# -----------
# Folders
# -----------
ROOT="${PWD}"
WORK_NAME=work
WORK="${ROOT}/${WORK_NAME}"
DOWNLOADS="${WORK}/downloads"
RELEASES="${WORK}/releases"
BIN="${WORK}/bin"
mkdir -p "${DOWNLOADS}" "${RELEASES}" "${BIN}" || exit 1
rm -rf "${BIN}/"*.{deb,tar.gz}{,.desc} # Clean up
# -----------
# Downloads
# -----------
cd "${DOWNLOADS}"
# -----------
# Releases
# -----------
# Prepare sources
mkdir -p "${RELEASES}/durs" || exit 1
cp -r $(find "${ROOT}" -mindepth 1 -maxdepth 1 ! -name "${WORK_NAME}") "${RELEASES}/durs" || exit 1
cd "${RELEASES}/durs"
rm -Rf .gitignore .git || exit 1 # Remove git files
# Build binary
echo ">> Building binary..."
cd "${ROOT}"
cargo build --target=${TARGET} --release --no-default-features || exit 1
mkdir -p "${RELEASES}/server_" || exit 1
cp "${ROOT}/target/${TARGET}/release/durs.exe" "${RELEASES}/server_/" || exit 1
#cp "${ROOT}/target/${TARGET}/release/durs" "${RELEASES}/desktop_" || exit 1
# Copy logo
#cp "${ROOT}/images/duniter-rs.png" "${RELEASES}/server_/" || exit 1
#cp "${ROOT}/images/duniter-rs.png" "${RELEASES}/desktop_" || exit 1
# ---------------
# Build .zip
# ---------------
cd "${RELEASES}/server_"
zip "${BIN}/duniter-rust-server-${DURS_TAG}-windows-x64.zip" * || exit 1
create_desc "${BIN}/duniter-rust-server-${DURS_TAG}-windows-x64.zip" "Server" "Windows"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment