mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-28 01:23:55 -07:00
add github actions (#4164)
This commit is contained in:
parent
45d838a0b3
commit
4aaedf64d2
11 changed files with 425 additions and 334 deletions
|
|
@ -1,4 +1,4 @@
|
|||
FROM fedora:32
|
||||
FROM fedora:33
|
||||
|
||||
RUN dnf install -y \
|
||||
@development-tools \
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script is to be used in .travis.yaml from the project root directory, do not use it from somewhere else.
|
||||
# This script is to be used by the ci environment from the project root directory, do not use it from somewhere else.
|
||||
|
||||
# Read arguments
|
||||
while [[ "$@" ]]; do
|
||||
|
|
@ -58,7 +58,7 @@ done
|
|||
|
||||
# Check formatting using clang-format
|
||||
if [[ $CHECK_FORMAT ]]; then
|
||||
source ./.ci/travis-lint.sh
|
||||
source ./.ci/lint.sh
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
|
@ -69,7 +69,7 @@ mkdir -p build
|
|||
cd build
|
||||
|
||||
if ! [[ $CORE_AMOUNT ]]; then
|
||||
CORE_AMOUNT="2" # travis machines have 2 cores
|
||||
CORE_AMOUNT="2" # default machines have 2 cores
|
||||
fi
|
||||
|
||||
# Add cmake flags
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script is to be sourced in .travis.yaml from the project root directory, do not use it from somewhere else.
|
||||
# This script is to be used by the ci environment from the project root directory, do not use it from somewhere else.
|
||||
|
||||
# Creates or loads docker images to use in compilation, creates RUN function to start compilation on the docker image.
|
||||
# --get loads the image from a previously saved image cache, will build if no image is found
|
||||
# --build builds the image from the Dockerfile in .ci/$NAME
|
||||
|
|
@ -9,7 +10,7 @@
|
|||
# uses env: NAME CACHE BUILD GET SAVE (correspond to args: <name> --set-cache <cache> --build --get --save)
|
||||
# sets env: RUN CCACHE_DIR IMAGE_NAME RUN_ARGS RUN_OPTS BUILD_SCRIPT
|
||||
# exitcode: 1 for failure, 2 for missing dockerfile, 3 for invalid arguments
|
||||
export BUILD_SCRIPT=".ci/travis-compile.sh"
|
||||
export BUILD_SCRIPT=".ci/compile.sh"
|
||||
|
||||
project_name="cockatrice"
|
||||
save_extension=".tar.gz"
|
||||
|
|
@ -64,10 +65,14 @@ if ! [[ -r $docker_dir/Dockerfile ]]; then
|
|||
return 2 # even if the image is cached, we do not want to run if there is no way to build this image
|
||||
fi
|
||||
|
||||
if ! [[ -d $CACHE ]]; then
|
||||
echo "could not find cache dir: $CACHE" >&2
|
||||
unset CACHE
|
||||
if ! [[ $CACHE ]]; then
|
||||
echo "cache dir is not set!" >&2
|
||||
else
|
||||
if ! [[ -d $CACHE ]]; then
|
||||
echo "could not find cache dir: $CACHE" >&2
|
||||
mkdir -p $CACHE
|
||||
unset GET # the dir is empty
|
||||
fi
|
||||
if [[ $GET || $SAVE ]]; then
|
||||
img_dir="$CACHE/$image_cache"
|
||||
img_save="$img_dir/$IMAGE_NAME$save_extension"
|
||||
19
.ci/get_github_upload_url.sh
Executable file
19
.ci/get_github_upload_url.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
# this script is to be used by the ci to fetch the github upload url
|
||||
# using curl and jq
|
||||
[[ $ref ]] || missing+=" ref"
|
||||
[[ $repo ]] || missing+=" repo"
|
||||
if [[ $missing ]]; then
|
||||
echo "missing env:$missing" >&2
|
||||
exit 2
|
||||
fi
|
||||
tag="${ref##*/}"
|
||||
api_url="https://api.github.com/repos/$repo/releases/tags/$tag"
|
||||
upload_url="$(curl "$api_url" | jq -r '.upload_url')"
|
||||
if [[ $upload_url && $upload_url != null ]]; then
|
||||
echo "$upload_url"
|
||||
exit 0
|
||||
else
|
||||
echo "failed to fetch upload url from $api_url" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -1,9 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check formatting using clang-format
|
||||
# fetch master branch
|
||||
git fetch origin master
|
||||
|
||||
# unshallow if needed
|
||||
echo "Finding merge base"
|
||||
if ! git merge-base origin/master HEAD; then
|
||||
echo "Could not find merge base, unshallowing repo"
|
||||
git fetch --unshallow
|
||||
fi
|
||||
|
||||
# Check formatting using clangify
|
||||
echo "Checking your code using clang-format..."
|
||||
|
||||
diff="$(./clangify.sh --diff --cf-version)"
|
||||
diff="$(./clangify.sh --diff --cf-version --branch origin/master)"
|
||||
err=$?
|
||||
|
||||
case $err in
|
||||
Loading…
Add table
Add a link
Reference in a new issue