diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index 062291a..6d74020 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -4,15 +4,28 @@ on: schedule: - cron: 0 0 * * * workflow_dispatch: - + jobs: CompatHelper: runs-on: ubuntu-latest + permissions: + actions: write + contents: read steps: - - name: Pkg.add("CompatHelper") - run: julia -e 'using Pkg; Pkg.add("CompatHelper")' - - name: CompatHelper.main() + - uses: actions/checkout@v4 + - uses: julia-actions/add-julia-registry@v2 + with: + key: ${{ secrets.SSH_PRIVATE_KEY }} + registry: bhftbootcamp/Green + - uses: julia-actions/setup-julia@v2 + - uses: julia-actions/cache@v2 + - name: Configure CompatHelper + run: | + julia -e ' + using Pkg + Pkg.add("CompatHelper") + using CompatHelper + CompatHelper.main(use_existing_registries = true) + ' env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} - run: julia -e 'using CompatHelper; CompatHelper.main()' + GITHUB_TOKEN: ${{ github.token }} # Token required to create a pull request to the same repository diff --git a/.github/workflows/Coverage.yml b/.github/workflows/Coverage.yml new file mode 100644 index 0000000..f7516ef --- /dev/null +++ b/.github/workflows/Coverage.yml @@ -0,0 +1,51 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + permissions: + actions: write + contents: read + strategy: + fail-fast: false + matrix: + version: + - '1' + - '1.8' + - '1.9' + os: + - ubuntu-latest + arch: + - x64 + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/add-julia-registry@v2 + with: + key: ${{ secrets.SSH_PRIVATE_KEY }} + registry: bhftbootcamp/Green + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: lcov.info diff --git a/.github/workflows/DocPreviewCleanup.yml b/.github/workflows/DocPreviewCleanup.yml new file mode 100644 index 0000000..5be23b9 --- /dev/null +++ b/.github/workflows/DocPreviewCleanup.yml @@ -0,0 +1,33 @@ +name: Doc Preview Cleanup + +on: + pull_request: + types: [closed] + +# Ensure that only one "Doc Preview Cleanup" workflow is force pushing at a time +concurrency: + group: doc-preview-cleanup + cancel-in-progress: false + +jobs: + doc-preview-cleanup: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v4 + with: + ref: gh-pages + - name: Delete preview and history + push changes + run: | + if [ -d "${preview_dir}" ]; then + git config user.name "Documenter.jl" + git config user.email "documenter@juliadocs.github.io" + git rm -rf "${preview_dir}" + git commit -m "delete preview" + git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) + git push --force origin gh-pages-new:gh-pages + fi + env: + preview_dir: previews/PR${{ github.event.number }} diff --git a/.github/workflows/CI.yml b/.github/workflows/Documentation.yml similarity index 51% rename from .github/workflows/CI.yml rename to .github/workflows/Documentation.yml index 806bd9e..ad3ba4f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/Documentation.yml @@ -1,54 +1,12 @@ -name: CI +name: Documenter on: push: - branches: - - master - tags: ['*'] + tags: [v*] pull_request: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: - test: - name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} - runs-on: ${{ matrix.os }} - timeout-minutes: 60 - permissions: - actions: write - contents: read - strategy: - fail-fast: false - matrix: - version: - - '1' - - '1.8' - - '1.9' - - '1.10' - os: - - ubuntu-latest - arch: - - x64 - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - arch: ${{ matrix.arch }} - - uses: julia-actions/cache@v2 - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 - - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: lcov.info - - docs: + Documenter: permissions: contents: write statuses: write @@ -58,10 +16,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: julia-actions/add-julia-registry@v2 + with: + key: ${{ secrets.SSH_PRIVATE_KEY }} + registry: bhftbootcamp/Green - uses: julia-actions/setup-julia@latest - uses: julia-actions/cache@v2 - name: Install dependencies - run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(; path = pwd())); Pkg.instantiate();' + run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path = pwd())); Pkg.instantiate()' - name: Build and deploy env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/Registry.yml b/.github/workflows/Registry.yml new file mode 100644 index 0000000..1d9f1f8 --- /dev/null +++ b/.github/workflows/Registry.yml @@ -0,0 +1,59 @@ +name: Update registry + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + registry: + name: Update registry + runs-on: ubuntu-latest + permissions: + actions: write + contents: read + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/add-julia-registry@v2 + with: + key: ${{ secrets.SSH_PRIVATE_KEY }} + registry: bhftbootcamp/Green + - uses: julia-actions/setup-julia@v2 + with: + version: 1.9 + - uses: julia-actions/cache@v2 + - name: Configure Git + run: | + sudo apt-get update -qq && sudo apt-get install -y -qq git + git config --global user.name github-actions[bot] + git config --global user.email github-actions[bot]@users.noreply.github.com + - name: Updating package version in registers + run: | + julia -e ' + using Pkg + + Pkg.add("LocalRegistry") + Pkg.develop(url = "git@github.com:${{ github.repository }}.git") + + using LocalRegistry + using TOML + + package_name = match(r"^.*/(.*?)(\.jl)?(\.git)?$", "${{ github.repository }}") + package_name == nothing && error("Invalid package name: ${{ github.repository }}") + package_name = package_name[1] + + package_dir = joinpath(DEPOT_PATH[1], "dev", package_name) + project_toml = TOML.parsefile(joinpath(package_dir, "Project.toml")) + version = VersionNumber(project_toml["version"]) + + LocalRegistry.register( + package_name, + repo = "https://github.com/${{ github.repository }}.git", + registry = "git@github.com:bhftbootcamp/Green.git", + ignore_reregistration = true, + ) + + run(Cmd(`git tag -f "v$version"`, dir = package_dir)) + run(Cmd(`git push --force origin "v$version"`, dir = package_dir)) + ' diff --git a/.github/workflows/ReleaseTag.yml b/.github/workflows/ReleaseTag.yml new file mode 100644 index 0000000..8ee459b --- /dev/null +++ b/.github/workflows/ReleaseTag.yml @@ -0,0 +1,25 @@ +name: Create release + +on: + push: + tags: + - v* + workflow_dispatch: + +permissions: + contents: write + +jobs: + release: + name: Release pushed tag + runs-on: ubuntu-latest + steps: + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref_name }} + run: | + gh release create "$tag" \ + --repo="$GITHUB_REPOSITORY" \ + --title="v${tag#v}" \ + --generate-notes diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml deleted file mode 100644 index 2bacdb8..0000000 --- a/.github/workflows/TagBot.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: TagBot -on: - issue_comment: - types: - - created - workflow_dispatch: - inputs: - lookback: - default: 3 -permissions: - actions: read - checks: read - contents: write - deployments: read - issues: read - discussions: read - packages: read - pages: read - pull-requests: read - repository-projects: read - security-events: read - statuses: read -jobs: - TagBot: - if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' - runs-on: ubuntu-latest - steps: - - uses: JuliaRegistries/TagBot@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - ssh: ${{ secrets.DOCUMENTER_KEY }} diff --git a/README.md b/README.md index cf48cff..c4bdc13 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://bhftbootcamp.github.io/LibTDJSON.jl/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://bhftbootcamp.github.io/LibTDJSON.jl/dev/) -[![Build Status](https://github.com/bhftbootcamp/LibTDJSON.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/bhftbootcamp/LibTDJSON.jl/actions/workflows/CI.yml?query=branch%3Amaster) +[![Build Status](https://github.com/bhftbootcamp/LibTDJSON.jl/actions/workflows/Coverage.yml/badge.svg?branch=master)](https://github.com/bhftbootcamp/LibTDJSON.jl/actions/workflows/Coverage.yml?query=branch%3Amaster) [![Coverage](https://codecov.io/gh/bhftbootcamp/LibTDJSON.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/bhftbootcamp/LibTDJSON.jl) -[![Registry](https://img.shields.io/badge/registry-General-4063d8)](https://github.com/JuliaRegistries/General) +[![Registry](https://img.shields.io/badge/registry-Green-green)](https://github.com/bhftbootcamp/Green) Wrapper for TDLib’s C JSON [interface](https://core.telegram.org/tdlib/docs/td__json__client_8h.html) for building Telegram clients in Julia.