Skip to content

Commit c687f8e

Browse files
authored
Merge pull request #12 from FlagBrew/back-to-sharp
Replace Python with C#
2 parents d693dfa + cc19632 commit c687f8e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3606
-5789
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ ENV=
33
CONFIGURED=false
44
SESSION_KEY=
55
HTTP_VALIDATION_KEY=
6-
HTTP_ENCRYPTION_KEY=
6+
HTTP_ENCRYPTION_KEY=
7+
LOGGGING_SENTRY_DSN=https://sentry.io/...

.github/workflows/build.yml

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
name: build
1+
name: Build and Release
2+
23
on:
34
push:
4-
paths-ignore: [".gitignore", "**/*.md"]
5-
branches: [master]
6-
tags: ["*"]
5+
branches:
6+
- master
77

88
jobs:
9-
docker-publish-tags:
10-
if: contains(github.ref, 'refs/tags/v')
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v2
14-
- uses: elgohr/Publish-Docker-Github-Action@master
15-
with:
16-
name: fmcore/coreapi
17-
username: ${{ secrets.DOCKER_USERNAME }}
18-
password: ${{ secrets.DOCKER_PASSWORD }}
19-
tag_semver: true
20-
docker-publish-latest:
21-
if: github.ref == 'refs/heads/master'
9+
build:
2210
runs-on: ubuntu-latest
11+
2312
steps:
24-
- uses: actions/checkout@v2
25-
- uses: elgohr/Publish-Docker-Github-Action@master
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Build Docker image
17+
run: |
18+
docker build -t myapp .
19+
20+
- name: Create container and extract
21+
run: |
22+
mkdir -p ./app
23+
docker create --name extract myapp
24+
docker cp extract:/app/coreapi ./app/coreapi
25+
docker cp extract:/app/cc ./app/cc
26+
docker rm extract
27+
- name: Archive release
28+
run: tar -czvf output.tar.gz ./app
29+
30+
- name: Create Release
31+
id: create_release
32+
uses: softprops/action-gh-release@v1
2633
with:
27-
name: fmcore/coreapi
28-
username: ${{ secrets.DOCKER_USERNAME }}
29-
password: ${{ secrets.DOCKER_PASSWORD }}
30-
post-to-webhook:
31-
needs: [docker-publish-latest]
32-
runs-on: ubuntu-latest
33-
steps:
34-
- run: |
35-
set +x
36-
curl -XPOST -H 'X-Webhook-Auth: ${{ secrets.WEBHOOK_SECRET }}' -H "Content-type: application/json" -d '{"app": "flagbrew", "service": "coreapi"}' '${{ secrets.WEBHOOK_URL }}'
34+
tag_name: run-${{ github.run_number }}-${{ github.sha }}
35+
name: Build ${{ github.sha }}
36+
draft: false
37+
prerelease: false
38+
files: output.tar.gz

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ tmp/
1313
**/dist
1414
**/.env
1515
bin
16-
coreapi
16+
coreapi
17+
cc/

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,27 @@ COPY . /build
77
RUN make go-build
88
RUN upx --best --lzma coreapi
99

10+
# build-cs-release image
11+
FROM mcr.microsoft.com/dotnet/sdk:7.0 as build-cs-release
12+
WORKDIR /build
13+
14+
COPY . /build
15+
RUN apt-get update && apt-get install --assume-yes make
16+
RUN make cs-build-release
17+
18+
1019
# Run image
1120
FROM python:3
1221
RUN apt update && \
1322
apt install mono-complete -y
1423

1524
RUN mkdir /app
1625
RUN mkdir /data
17-
RUN mkdir /app/python
26+
RUN mkdir /app/css
1827
COPY --from=build-go /build/coreapi /app
19-
COPY --from=build-go /build/python /app/python
2028
COPY --from=build-go /build/start.sh /app
2129
COPY --from=build-go /build/.env.example /data/.env
30+
COPY --from=build-cs-release /build/cc /app/cc
2231

2332
# runtime params
2433
WORKDIR /app

Makefile

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ export PACKAGE := "github.com/FlagBrew/CoreAPI"
66
VERSION=$(shell git describe --tags --always --abbrev=0 --match=v* 2> /dev/null | sed -r "s:^v::g" || echo 0)
77
VERSION_FULL=$(shell git describe --tags --always --dirty --match=v* 2> /dev/null | sed -r "s:^v::g" || echo 0)
88

9+
build-all: cs-build-release go-build
10+
911
# General
10-
clean:
12+
clean: cs-clean
1113
/bin/rm -rfv ${PROJECT}
1214

1315

16+
1417
# Docker
1518
docker:
1619
docker compose \
@@ -36,9 +39,21 @@ docker-build:
3639
--force-rm .
3740

3841

39-
# Python
40-
python-fetch:
41-
python3 -m pip install -r python/requirements.txt
42+
# CSharp
43+
44+
cs-build-release:
45+
cd coreconsole && \
46+
dotnet build coreconsole.csproj -c Release -o ../cc && \
47+
cp data ../cc/data -r
48+
49+
50+
cs-build-debug:
51+
cd coreconsole && \
52+
dotnet build coreconsole.csproj -c Debug -o ../cc && \
53+
cp data ../cc/data -r
54+
55+
cs-clean:
56+
/bin/rm -rfv cc
4257

4358
# Go
4459
go-fetch:

coreconsole/.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Common IntelliJ Platform excludes
2+
3+
# User specific
4+
**/.idea/**/workspace.xml
5+
**/.idea/**/tasks.xml
6+
**/.idea/shelf/*
7+
**/.idea/dictionaries
8+
**/.idea/httpRequests/
9+
10+
# Sensitive or high-churn files
11+
**/.idea/**/dataSources/
12+
**/.idea/**/dataSources.ids
13+
**/.idea/**/dataSources.xml
14+
**/.idea/**/dataSources.local.xml
15+
**/.idea/**/sqlDataSources.xml
16+
**/.idea/**/dynamic.xml
17+
18+
# Rider
19+
# Rider auto-generates .iml files, and contentModel.xml
20+
**/.idea/**/*.iml
21+
**/.idea/**/contentModel.xml
22+
**/.idea/**/modules.xml
23+
24+
*.suo
25+
*.user
26+
.vs/
27+
[Bb]in/
28+
[Oo]bj/
29+
_UpgradeReport_Files/
30+
[Pp]ackages/
31+
32+
Thumbs.db
33+
Desktop.ini
34+
.DS_Store

coreconsole/.idea/.idea.coreconsole/.idea/.gitignore

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coreconsole/.idea/.idea.coreconsole/.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)