Recover github files

Thought it'd be nice to keep them around and for reference.
This commit is contained in:
Zedifus 2022-06-10 14:20:50 +01:00
parent cf06574fca
commit c34c204d95
5 changed files with 203 additions and 0 deletions

View File

@ -6,6 +6,7 @@ docker-compose.yml
# git & gitlab related # git & gitlab related
.git/ .git/
.github/
.gitlab/ .gitlab/
.gitignore .gitignore
.gitlab-ci.yml .gitlab-ci.yml

4
.github/NOT-MAINTAINED.md vendored Normal file
View File

@ -0,0 +1,4 @@
I've decided to recover these from the git history, Even though they won't be used or maintained,
I did a lot of learning to create them. Might as well just keep them for reference. -Zed
#fishsticks

89
.github/workflows/docker-build.yml vendored Normal file
View File

@ -0,0 +1,89 @@
# yamllint disable rule:line-length
---
name: Build Docker Images
on: # yamllint disable-line rule:truthy
push:
branches:
- master
- dev
workflow_dispatch:
jobs:
build:
name: Build Docker Images
runs-on: ubuntu-latest
outputs:
date: ${{ steps.date.outputs.date }}
tag: ${{ steps.branch.outputs.tag }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
# - name: Login to Docker Hub
# if: github.event_name != 'pull_request'
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +"%Y-%m-%dT%H:%M:%SZ")"
- name: Get Crafty version
id: version
run: |
MAJOR=$(cat app/config/version.json | jq '.major' )
MINOR=$(cat app/config/version.json | jq '.minor' )
SUB=$(cat app/config/version.json | jq '.sub' )
META=$(cat app/config/version.json | jq -r '.meta' )
echo "::set-output name=version::$MAJOR.$MINOR.$SUB-$META"
- name: Get branch tag
id: branch
run: |
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
echo "::set-output name=tag::latest"
else
echo "::set-output name=tag::$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///g')"
fi
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/arm64,linux/amd64
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=registry,ref=${{ github.repository }}:${{ steps.branch.outputs.tag }}
cache-to: type=inline
build-args: |
BUILD_DATE=${{ steps.date.outputs.date }}
BUILD_REF=${{ github.sha }}
CRAFTY_VER=${{ steps.version.outputs.version }}
tags: |
ghcr.io/${{ github.repository }}:${{ steps.branch.outputs.tag }}
# {{ GITHUB_REPOSITORY }}:${{ steps.branch.outputs.tag }}

37
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,37 @@
# yamllint disable rule:line-length
---
name: Lint
on: [push, pull_request] # yamllint disable-line rule:truthy
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.9"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint black yamllint
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run pylint
run: |
pylint --output-format=text $(find -type f -name "*.py" ! -path "**/.venv/**" ! -path "**/app/migrations/**") | tee /tmp/pylint.txt
echo "pylint score: $(cat /tmp/pylint.txt | grep -oP 'Your code has been rated at \K[0-9]*\.?[0-9]*')"
- name: Run black
run: black --check --diff .
- name: Lint YAML files
run: yamllint .

72
.github/workflows/pyinstaller-build.yml vendored Normal file
View File

@ -0,0 +1,72 @@
# yamllint disable rule:line-length
---
name: Build pyinstaller apps
on: # yamllint disable-line rule:truthy
push:
branches:
- master
- dev
workflow_dispatch:
jobs:
build:
name: Build Packages
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
TARGET: macos
CMD_BUILD: |
pyinstaller -F main.py --name "crafty4" \
--distpath . \
--hidden-import cryptography \
--hidden-import cffi \
--hidden-import apscheduler \
--collect-all tzlocal \
--collect-all tzdata \
--collect-all pytz \
--collect-all six
chmod +x crafty4
tar --exclude='./app/classes/' -cvzf crafty4.tar.gz crafty4 app/
OUT_FILE_NAME: crafty4.tar.gz
- os: windows-latest
TARGET: windows
CMD_BUILD: |
pyinstaller -F main.py --name "crafty4" `
--distpath . `
--icon app\frontend\static\assets\images\Crafty_4-0_Logo_square.ico `
--hidden-import cryptography `
--hidden-import cffi `
--hidden-import apscheduler `
--collect-all tzlocal `
--collect-all tzdata `
--collect-all pytz `
--collect-all six
OUT_FILE_NAME: |
crafty4.exe
app/
!app/classes/**/*
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
cache: "pip"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install -r requirements.txt
- name: Build with pyinstaller for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
- name: "Upload Artifact"
uses: actions/upload-artifact@v3
with:
name: crafty4-${{matrix.TARGET}}
path: ${{ matrix.OUT_FILE_NAME}}