Skip to content

Actions rebased #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
623cb71
print commmands with -hb/-hc
stm2 Aug 13, 2020
bb8d3a1
fixed help (-R)
stm2 Aug 14, 2020
b5adbc8
added missing items and fixed English item names
stm2 Aug 13, 2020
9f80d4d
BREED is actually called GROW
stm2 Aug 13, 2020
6fd1a6d
message spelling fixed
stm2 Aug 17, 2020
e77728b
fixed English herb names
stm2 Aug 13, 2020
5981477
removed BELAGERE
stm2 Aug 14, 2020
a471368
removed deprecated commands
stm2 Aug 14, 2020
98f8237
fixed options
stm2 Aug 14, 2020
fb5129a
check ZERSTOERE
stm2 Aug 13, 2020
a21fcd8
HELP FIGHT, FACTIONSTEALTH not for e3
stm2 Aug 14, 2020
3223ea2
E3 races
stm2 Aug 14, 2020
f6e9095
fixed e3 files
stm2 Aug 14, 2020
eb99560
small adjustments
stm2 Aug 17, 2020
495013a
refactored testing, check CLAIM order parameters
stm2 Aug 15, 2020
65c3710
tests for e3, ALLIANZ
stm2 Aug 16, 2020
58be0a1
warn of too many parameters
stm2 Aug 16, 2020
9a2a62d
check PFLANZE
stm2 Aug 17, 2020
3be73b5
handle single quotes and quotes within quotes (partially)
stm2 Aug 17, 2020
d452782
check SPRACHE
stm2 Aug 17, 2020
1181b98
tweaks
stm2 Aug 20, 2020
2b1d245
fixed https://bugs.eressea.de/view.php?id=2555
stm2 Aug 20, 2020
9244f51
fixed https://bugs.eressea.de/view.php?id=2641
stm2 Aug 21, 2020
ef38813
added Steinkreis
stm2 Aug 21, 2020
a210756
fixed https://bugs.eressea.de/view.php?id=2547
stm2 Aug 21, 2020
b7441d2
fixed https://bugs.eressea.de/view.php?id=2522
stm2 Aug 21, 2020
9977e26
check for missing order start / accidental NEXT
stm2 Aug 21, 2020
1caca0c
fixed missing message, (wrong) caravanserei spelling, -P option
stm2 Aug 21, 2020
0cbe483
okay, server accepts PARTEI x "pw" as order start
stm2 Aug 22, 2020
2a10ce2
fixed whitespace errors
stm2 Aug 22, 2020
e917ef1
check LOCALE mismatch
stm2 Aug 23, 2020
2c3eb45
test actions
stm2 Aug 25, 2020
a37f5e2
fixed a few memory leaks
stm2 Aug 29, 2020
2574c6f
tests for breed
stm2 Aug 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions .github/workflows/distribute-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: Automatic build and release
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github workflows scheint mir ein neues feature zu sein, das ich gerne als eigenen PR gesehen hätte, und deshalb heute überspringe.


on:
push:
branches: [ master ]

jobs:
build_win:
name: Build for Windows
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: make
run: |
make test
make clean
make echeck

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: binaries.win
# note: mingw gcc appears to ignore -o option
path: echeck.exe

build_mac:
name: Build for MacOS
runs-on: macOS-latest

steps:
- uses: actions/checkout@v2
- name: make
run: |
make test
make clean
make echeck

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: binaries.mac
path: echeck

build_nix:
name: Build and zip
needs: [ build_win, build_mac ]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
# get all tags
fetch-depth: 0
- name: make
run: |
make test
make clean
make echeck

- name: configure tag
run: |
VERSION=$(grep echeck_version echeck.c | head -1 | cut -f2 -d'"')
if [[ ! "${VERSION}" =~ ^[0-9][.][0-9]+[.][0-9]+$ ]]; then
echo "version tag X.Y.Z not found: $VERSION"
exit 1
fi
LASTTAG=$(git tag -l "v*" --sort='-committerdate' | head -1)
if [[ ! "${LASTTAG}" =~ ^v[0-9][.][0-9]+[.][0-9]+$ ]]; then
echo "last tag vX.Y.Z not found: $LASTTAG"
exit 1
fi
VTAG=$(git tag -l "v$VERSION")

echo "latest tag: $LASTTAG, current version: $VERSION, existing tag: $VTAG"

git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git remote -v
REMOTE="https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git"

if [[ "v$VERSION" != "$LASTTAG" && "$VTAG" == "" ]]; then
# create new tag and release draft
TAG="v$VERSION"
name="Release $VERSION"
body="Dies ist ein stabiles Release. Diese Beschrebung solle geändert werden.\n\nThis is a stable release draft. This description should be updated.\n\n$date"
draft=true
prerelease=false

git tag "$TAG"
git push "$REMOTE" "$TAG"
elif [[ "$VTAG" != "" && "$VTAG" == "v$VERSION" ]]; then
# update vX.Y-latest tag and prerelease
draft=false
prerelease=true
name="Pre-Release $VERSION"
body="Dies ist eine automatisch generierte Version mit den neuesten Änderungen. Sie kann eher Fehler enthalten als eine stabile Version.\n\nThis is an automatic release of the latest version. It is less safe to use than a stable version.\n\n$date"
short=$(echo "${VERSION}" | cut -d. -f-2)
TAG="${short}-latest"

git tag -f "$TAG"
git push --force "$REMOTE" "$TAG"
else
echo "not creating any release"
draft=
prerelease=
fi

body="${body//'%'/'%25'}"
body="${body//'\n'/'%0A'}"
body="${body//'\r'/'%0D'}"

echo "::set-env name=PRERELEASE::$prerelease"
echo "::set-env name=DRAFT::$draft"
echo "::set-env name=VERSION::$VERSION"
echo "::set-env name=TAG::$TAG"
echo "::set-env name=NAME::$name"
echo "::set-env name=BODY::$body"

- name: Download all binaries
uses: actions/download-artifact@v2

- name: Create zip
run: |
mv binaries.mac/echeck ./echeck.macos
mv binaries.win/echeck.exe ./echeck.exe
zip -r echeck.zip echeck echeck.macos echeck.exe e2 e3 changelog.txt LIESMICH.txt README.txt

- name: Upload zip artifact
uses: actions/upload-artifact@v2
with:
name: release
path: echeck.zip

- name: Create release
uses: meeDamian/[email protected]
if: env.PRERELEASE != '' && env.DRAFT != ''
with:
prerelease: ${{ env.PRERELEASE }}
draft: ${{ env.DRAFT }}
allow_override: true
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.TAG }}
# commitish: ${{ github.ref }}
name: ${{ env.NAME }}
body: ${{ env.BODY }}
gzip: folders
files: >
echeck.zip
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
MINGW_STRIP = i686-w64-mingw32-strip
MINGW_CC = i686-w64-mingw32-gcc
GCC = gcc
CFLAGS = -Wall -std=c99 -Werror -I.
RELEASE_CFLAGS = $(CFLAGS) -Os
DEBUG_CFLAGS = $(CFLAGS) -g
Expand Down Expand Up @@ -31,15 +32,18 @@ echeck.exe: echeck.c unicode.c unicode.h config.h
$(MINGW_CC) $(RELEASE_CFLAGS) -o echeck.exe echeck.c unicode.c
$(MINGW_STRIP) echeck.exe

echeck: echeck.c unicode.c unicode.h config.h $(TEST_SRC) $(TEST_HDR)
$(CC) $(DEBUG_CFLAGS) -DWITH_CUTEST -o echeck echeck.c unicode.c $(TEST_SRC)
echeck.dbg: echeck.c unicode.c unicode.h config.h $(TEST_SRC) $(TEST_HDR)
$(GCC) $(DEBUG_CFLAGS) -DWITH_CUTEST -o echeck.dbg echeck.c unicode.c $(TEST_SRC)

echeck: echeck.c unicode.c unicode.h config.h
$(GCC) $(RELEASE_CFLAGS) -o echeck echeck.c unicode.c

clean:
@rm -f *.o core *.bak echeck echeck.exe echeck.zip
@rm -f *.o core *.bak echeck echeck.dbg echeck.exe echeck.zip

test: echeck
@./echeck -T=all -Lde -Re3 -b
@./echeck -T=all -Lde -Re2 -b
test: echeck.dbg
@./echeck.dbg -T=all -Lde -Re3 -b
@./echeck.dbg -T=all -Lde -Re2 -b

echeck.zip: echeck.exe changelog.txt LIESMICH.txt README.txt
zip -r echeck.zip echeck.exe e2 e3 changelog.txt LIESMICH.txt README.txt
21 changes: 10 additions & 11 deletions echeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,13 @@ void set_order_unit(unit * u)
order_unit = u;
}

void set_output(FILE *out, FILE *err) {
if (out)
OUT = out;
if (err)
ERR = err;
}

#ifdef WITH_CUTEST

void mock_input(const char *input)
Expand All @@ -1697,13 +1704,6 @@ void mock_input(const char *input)
mock_pos = mocked_input;
}

void set_output(FILE *out, FILE *err) {
if (out)
OUT = out;
if (err)
ERR = err;
}

int get_long_order_line() {
if (order_unit)
return order_unit->long_order_line;
Expand Down Expand Up @@ -2585,8 +2585,7 @@ void checkemail(void)
return;
}
scat(errtxt[DELIVERYTO]);
scat(" ");
scat(addr);
Scat(addr);
}

/*
Expand Down Expand Up @@ -3562,7 +3561,7 @@ void check_ally(void)
case P_GUARD:
case P_FACTIONSTEALTH:
case P_ALLES:
case P_NOT: /* FIXME: legal? */
case P_NOT: /* server actually accepts HELFE foe NICHT = HELFE foe ALLES NICHT */
Scat(printparam(i));
break;
default:
Expand Down Expand Up @@ -4629,7 +4628,7 @@ void checkanorder(char *Orders)
break;

case K_SCHOOL: /* Magiegebiet */
/* FIXME not an order any more */
/* not an order any more */
s = getstr();
i = findstr(magiegebiet, s, 5);
if (i < 0) {
Expand Down