diff --git a/.github/actions/release-drafter/release-drafter.yml b/.github/actions/release-drafter/release-drafter.yml new file mode 100644 index 0000000..df9d4b2 --- /dev/null +++ b/.github/actions/release-drafter/release-drafter.yml @@ -0,0 +1,75 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + labels: + - 'infrastructure' + - 'automation' + - 'documentation' + - 'code refinement' + - title: '🏎 Performance' + label: 'performance' + - title: '🛡 Security' + label: 'security' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +version-resolver: + major: + labels: + - 'breaking' + minor: + labels: + - 'enhancement' + - 'feature' + patch: + labels: + - 'bug' + - 'bugfix' + - 'fix' + - 'maintenance' + - 'documentation' + - 'code refinement' + - 'infrastructure' + - 'performance' + - 'security' + default: patch +autolabeler: + - label: 'breaking' + title: + - '/breaking/i' + - label: 'enhancement' + title: + - '/enhancement/i' + - '/feature/i' + - label: 'bugfix' + title: + - '/fix/i' + - '/bug/i' + - '/regression/i' + - label: 'infrastructure' + title: + - '/infrastructure/i' + - label: 'documentation' + title: + - '/doc/i' + - label: 'code refinement' + title: + - '/refine/i' + - '/clean/i' + - label: 'performance' + title: + - '/perf/i' + - label: 'security' + title: + - '/security/i' +template: | + # Changelog ... + $CHANGES diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt new file mode 100644 index 0000000..197176d --- /dev/null +++ b/.github/actions/spelling/excludes.txt @@ -0,0 +1,7 @@ +^\Qsrc/pd/include/ajax_anyrole.h\E$ +^\Qsrc/pd/include/approver.h\E$ +^\Qsrc/pd/include/company.h\E$ +^\Qsrc/pd/include/companylogouploader.h\E$ +^\Qsrc/pd/include/complain.h\E$ +^\Qsrc/pd/include/cron_daily_pd.h\E$ +^\Qsrc/pd/include/subcontractor.h\E$ diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt new file mode 100644 index 0000000..b391345 --- /dev/null +++ b/.github/actions/spelling/expect.txt @@ -0,0 +1,356 @@ +ABCDEFGHIJKLMNOPQRSTUVWXY +ALIGNH +ALIGNV +AZN +Airfarelimitation +Anyconnect +Autoapprove +Autodetect +BGN +BORDERSTYLE +BTID +BTIn +BTVAT +BTexpense +BYN +CFormat +CGIDIR +CHF +CLEANUPDIRECTORY +CNY +CRedirect +CRto +CURDATE +CZK +DARKGREEN +DARKRED +DBby +DKK +Dest +EUR +Econom +FFFFFFF +FILLPATTERN +FNumber +Flawfinder +GBP +HDR +HKD +HTMLTo +HUF +IApplied +IDBy +IDIn +IMAGEMAGICK +IMessage +INR +Img +JPY +KGS +KRW +KZT +LEN +LIGHTGREEN +LOGDIR +LOGGEDIN +MDL +MSVC +Magick +NOK +NUMFORMAT +ONMe +ORBT +PLN +PSo +REFERER +RON +SEK +SIGSEGV +SOWIn +Ses +Symantec +TALIGN +TCs +TJS +TMT +TODO +UAH +UINT +UNICODE +UZS +Unsubscribe +Uread +WAct +WActive +WAgreement +WBT +WBy +WContract +WCustom +WDate +WEdit +WIDBy +WIDs +WList +WNumber +WPayment +WPosition +WQuery +WSign +WStart +WTitle +WVariable +WWorking +Wfrom +Wkhtml +Wunused +XBy +XOffset +XResolution +YCb +YResolution +YYYY +ZIPBy +Zabcdefghijklmnopqrstuvwxyz +afm +airtickets +alnum +anketa +anyrole +arial +arialbd +autocomplete +autocompleted +autologin +avia +bbox +bday +bfd +bgp +bik +btn +bts +cactivator +captcha +ccgi +cexception +cgi +charcode +checkin +checkpersistence +chtml +cmail +cmake +cmath +cmenu +cmysql +cnx +codecvt +companyid +config +coord +costcenter +cpp +cron +css +cstatistics +cstdlib +ctime +currencyname +currencynominal +currencyvalue +cuser +cvars +datetime +dayrate +declensioned +deinit +difftime +downloader +dst +dupicated +employmenttype +endforeach +endif +endl +endmacro +eneded +enum +eventtimestamps +executables +exif +expenseitemid +fcntl +foreach +fstream +func +getenv +gettext +gettimeofday +helpdesk +hostname +hotelchain +hpdf +hpp +href +html +htmlt +http +iata +idto +idx +ifndef +imageid +isactivated +isblocked +isbn +iswalnum +jpg +json +jsonrpc +keepalive +kompanii +kpp +libhpdf +libintl +libxl +lng +localtime +localy +lostindb +lostpictures +maxsalary +mbstowcs +mbwcvt +mday +messageid +minsalary +mktime +multiwork +mysql +myvacancies +namespace +ngettext +noexcept +noone +notfound +nothrow +notificator +npos +ntp +nullptr +numcode +objs +ofs +ofstream +ogrn +okato +okpo +onot +ost +ostream +ostringstream +params +passwd +paymenttype +pdf +pfb +pragma +prettywriter +pricedomestic +priceforeign +proj +projectid +psow +qfp +qstring +rapidjson +ratelimiter +rawtime +rbegin +regex +relogin +rpath +rur +rus +sessid +setlang +showmain +signin +sizeof +smartway +sms +smth +snmp +snprintf +spam +sql +sqlquery +srand +src +srok +ssh +sstream +stderr +stdexcept +stoi +stol +stopbits +strftime +strlen +subc +subdir +submatch +substr +sys +sysid +tacacs +tempate +tempfile +templ +timeentry +timeframe +timeinfo +timereport +timeval +tmp +tooltip +topage +totaldays +totalhours +totalpayment +totalpaymentnovat +towlower +ttf +typedefs +uncomment +undef +uniq +url +usec +userid +username +usr +utf +valute +varset +vec +vrf +vty +walkthrough +wctype +wday +weberror +wkhtmltopdf +wkhtmltox +workflow +workpane +workperiod +wperiod +wstring +xheight +xls +xml +xxxx +xxxxxxxx +youtube \ No newline at end of file diff --git a/.github/actions/spelling/only.txt b/.github/actions/spelling/only.txt new file mode 100644 index 0000000..8eba6c8 --- /dev/null +++ b/.github/actions/spelling/only.txt @@ -0,0 +1 @@ +src/ diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt new file mode 100644 index 0000000..756fa48 --- /dev/null +++ b/.github/actions/spelling/patterns.txt @@ -0,0 +1,22 @@ +# --- HTTP POST request example +WebKitFormBoundary[a-zA-Z0-9]* +Content-Disposition\:.* +Content-Type\:.* + +# --- sessid +sessid=[a-zA-Z0-9]* + +# --- uuid: +\{[0-9A-FA-F]{8}-(?:[0-9A-FA-F]{4}-){3}[0-9A-FA-F]{12}\} +# [-4yx]+ + + +# --- URL-s +https?://(?:(?:www\.|)youtube\.com|youtu.be)/[-a-zA-Z0-9?&=]* +https?://.* + +# --- copyright +[a-zA-Z0-9]+@[a-zA-Z0-9]+\.com + +# --- random +rand\=x+ diff --git a/.github/workflows/codesee-arch-diagram.yml b/.github/workflows/codesee-arch-diagram.yml new file mode 100644 index 0000000..49a425e --- /dev/null +++ b/.github/workflows/codesee-arch-diagram.yml @@ -0,0 +1,20 @@ +# This workflow was added by CodeSee. Learn more at https://codesee.io/ +# This is v2.0 of this workflow file +on: + pull_request_target: + types: [opened, synchronize, reopened] + +name: CodeSee + +permissions: read-all + +jobs: + codesee: + runs-on: ubuntu-latest + continue-on-error: true + name: Analyze the repo with CodeSee + steps: + - uses: Codesee-io/codesee-action@v2 + with: + codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} + codesee-url: https://app.codesee.io diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml new file mode 100644 index 0000000..82cd264 --- /dev/null +++ b/.github/workflows/debug.yml @@ -0,0 +1,17 @@ +name: Debug +on: + release: + types: ['published'] +jobs: + debug: + name: Debug + runs-on: ubuntu-latest + steps: + - name: Dump env + run: env | sort + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Print published version + run: echo file-${{ github.event.release.tag_name }} \ No newline at end of file diff --git a/.github/workflows/go-publish.yml b/.github/workflows/go-publish.yml new file mode 100644 index 0000000..5106b84 --- /dev/null +++ b/.github/workflows/go-publish.yml @@ -0,0 +1,97 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Publish release assets + +on: + release: + types: ['published'] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + # write permission is required to create a github release + contents: write + deployments: write + steps: + ########################## + # Start deployment # + ########################## + - name: start deployment + uses: bobheadxi/deployments@v1 + id: deployment + with: + step: start + token: ${{ secrets.GITHUB_TOKEN }} + env: release + desc: "depl_id: ${{ github.event.deployment.id }}, ref_id: ${{ github.head_ref }}" + + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: 'stable' + + - name: Mod tidy + run: go mod tidy + + - name: Linux build + run: | + go build -o cmd/${{ github.event.repository.name }} ./cmd/config-mapper/ + cd ./cmd + tar -czf ${{ github.event.repository.name }}-linux-${{ github.event.release.tag_name }}.tar.gz ./${{ github.event.repository.name }} + rm ./${{ github.event.repository.name }} + + - name: Windows build + run: | + GOOS=windows GOARCH=amd64 go build -o cmd/${{ github.event.repository.name }}.exe ./cmd/config-mapper/ + cd ./cmd + zip ${{ github.event.repository.name }}-windows-${{ github.event.release.tag_name }}.zip ./${{ github.event.repository.name }}.exe + rm ./${{ github.event.repository.name }}.exe + + - name: Darwin build + run: | + GOOS=darwin GOARCH=amd64 go build -o cmd/${{ github.event.repository.name }} ./cmd/config-mapper/ + cd ./cmd + tar -czf ${{ github.event.repository.name }}-darwin-${{ github.event.release.tag_name }}.tar.gz ./${{ github.event.repository.name }} + rm ./${{ github.event.repository.name }} + + - name: Upload release assets + uses: softprops/action-gh-release@v1 + with: + files: | + cmd/${{ github.event.repository.name }}-darwin-${{ github.event.release.tag_name }}.tar.gz + cmd/${{ github.event.repository.name }}-linux-${{ github.event.release.tag_name }}.tar.gz + cmd/${{ github.event.repository.name }}-windows-${{ github.event.release.tag_name }}.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload linux artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ github.event.repository.name }}-linux-${{ github.event.release.tag_name }}.tar.gz + path: cmd/${{ github.event.repository.name }}-linux-${{ github.event.release.tag_name }}.tar.gz + + - name: Upload windows artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ github.event.repository.name }}-windows-${{ github.event.release.tag_name }}.zip + path: cmd/${{ github.event.repository.name }}-windows-${{ github.event.release.tag_name }}.tar.gz + + ########################## + # Stop deployment # + ########################## + - name: update deployment status + uses: bobheadxi/deployments@v1 + if: always() + with: + step: finish + token: ${{ secrets.GITHUB_TOKEN }} + status: ${{ job.status }} + env: ${{ steps.deployment.outputs.env }} + deployment_id: ${{ steps.deployment.outputs.deployment_id }} + + + diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml new file mode 100644 index 0000000..d977092 --- /dev/null +++ b/.github/workflows/go-test.yml @@ -0,0 +1,29 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Go test + +on: + pull_request: + branches: [ "master" ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: 'stable' + + - name: Mod tidy + run: go mod tidy + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./... diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..5b8d79f --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,29 @@ +name: Release Drafter + +on: + push: + branches: [master] + pull_request: + branches: [master] + types: [opened, reopened, synchronize] + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + # write permission is required to create a github release + contents: write + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: write + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + with: + config-name: actions/release-drafter/release-drafter.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/spell_check.yml b/.github/workflows/spell_check.yml new file mode 100644 index 0000000..a6da6bb --- /dev/null +++ b/.github/workflows/spell_check.yml @@ -0,0 +1,56 @@ +--- +#################### +## Check spelling ## +#################### + +# +# Documentation: +# https://help.github.com/en/articles/workflow-syntax-for-github-actions +# + +name: Spell checking +############################# +# Start the job on all push # +############################# +on: + pull_request: + branches: [master] + types: [opened, reopened, synchronize] + +############### +# Set the Job # +############### +jobs: + build: + permissions: + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: write + + # Name the Job + name: Spell checking + # Set the agent to run on + runs-on: ubuntu-latest + ################## + # Load all steps # + ################## + steps: + ########################## + # Checkout the code base # + ########################## + - name: Checkout Code + uses: actions/checkout@v2 + + ############################# + # Run check spelling action # + ############################# + - name: Check spelling + uses: check-spelling/check-spelling@main + with: + bucket: .github/actions + project: spelling + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + +