From 247b46a6b2a991917e613b46439c70305850a243 Mon Sep 17 00:00:00 2001 From: ujstor <116409846+Ujstor@users.noreply.github.com> Date: Fri, 12 Jul 2024 00:21:56 +0200 Subject: [PATCH] Workflows-refactor (#278) * update workflows --- .github/workflows/ci.yml | 2 +- .github/workflows/docs.yml | 4 +- ...inter.yml => generate-linter-advanced.yml} | 21 +++++----- .github/workflows/generate-linter-core.yml | 41 +++++++++++++++++++ .github/workflows/release.yml | 2 +- .github/workflows/update-htmx-version.yml | 14 +++---- 6 files changed, 63 insertions(+), 21 deletions(-) rename .github/workflows/{generate-linter.yml => generate-linter-advanced.yml} (71%) create mode 100644 .github/workflows/generate-linter-core.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7639070f..026dfe50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22.2' + go-version: '1.22.x' - name: Deps cache id: cache-go-deps diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f36403ea..ff04ca1b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v2 @@ -46,4 +46,4 @@ jobs: # git add CNAME # git commit -m "Add CNAME file" - # git push origin gh-pages \ No newline at end of file + # git push origin gh-pages diff --git a/.github/workflows/generate-linter.yml b/.github/workflows/generate-linter-advanced.yml similarity index 71% rename from .github/workflows/generate-linter.yml rename to .github/workflows/generate-linter-advanced.yml index bfb8795b..78a99a0b 100644 --- a/.github/workflows/generate-linter.yml +++ b/.github/workflows/generate-linter-advanced.yml @@ -1,4 +1,4 @@ -name: Linting Generated Blueprints +name: Linting Generated Blueprints Advanced on: pull_request: {} @@ -8,19 +8,20 @@ jobs: framework_matrix: strategy: matrix: - framework: - [chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo] - driver: - [mysql, postgres, sqlite, mongo, redis, none] - advanced: - [htmx, githubaction, websocket] + framework: [chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo] + driver: [postgres] + git: [commit] + advanced: [htmx, githubaction, websocket, tailwind] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Setup Go uses: actions/setup-go@v5 with: - go-version: '1.22.2' + go-version: '1.22.x' + - name: Install golangci-lint run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2 @@ -30,9 +31,9 @@ jobs: git config --global user.email 'testemail@users.noreply.github.com' - name: build templates - run: script -q /dev/null -c "go run main.go create -n ${{ matrix.framework }} -f ${{ matrix.framework}} -d ${{ matrix.driver }} --advanced true --feature ${{ matrix.advanced }} -g commit" /dev/null + run: script -q /dev/null -c "go run main.go create -n ${{ matrix.framework }} -f ${{ matrix.framework}} -d ${{ matrix.driver }} -g ${{ matrix.git}} --advanced --feature ${{ matrix.advanced }}" /dev/null - - if: ${{ matrix.advanced == 'htmx' }} + - if: ${{ matrix.advanced == 'htmx' || matrix.advanced == 'tailwind' }} name: Install Templ & gen templates run: | go install github.com/a-h/templ/cmd/templ@latest diff --git a/.github/workflows/generate-linter-core.yml b/.github/workflows/generate-linter-core.yml new file mode 100644 index 00000000..07a9304c --- /dev/null +++ b/.github/workflows/generate-linter-core.yml @@ -0,0 +1,41 @@ +name: Linting Generated Blueprints Core + +on: + pull_request: {} + workflow_dispatch: {} + +jobs: + framework_matrix: + strategy: + matrix: + framework: [chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo] + driver: [mysql, postgres, sqlite, mongo, redis, none] + git: [commit, stage, skip] + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.22.x' + + - name: Install golangci-lint + run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2 + + - name: Commit report + run: | + git config --global user.name 'testname' + git config --global user.email 'testemail@users.noreply.github.com' + + - name: build templates + run: script -q /dev/null -c "go run main.go create -n ${{ matrix.framework }} -f ${{ matrix.framework}} -d ${{ matrix.driver }} -g ${{ matrix.git}}" /dev/null + + - name: golangci-lint + run: | + cd ${{ matrix.framework }} + golangci-lint run + + - name: remove templates + run: rm -rf ${{ matrix.framework }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5ef83bc8..583ed0b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,4 +26,4 @@ jobs: args: release --clean workdir: ./ env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-htmx-version.yml b/.github/workflows/update-htmx-version.yml index 1722a7b5..e631ebb9 100644 --- a/.github/workflows/update-htmx-version.yml +++ b/.github/workflows/update-htmx-version.yml @@ -46,28 +46,28 @@ jobs: fi - name: dump latest htmx version - run: curl -L https://unpkg.com/htmx.org@latest -o cmd/template/advanced/files/htmx/htmx.min.js if: steps.compare_versions.outputs.release_changed == 'true' + run: curl -L https://github.com/bigskysoftware/htmx/releases/latest/download/htmx.min.js -o cmd/template/advanced/files/htmx/htmx.min.js - name: Prettify code + if: steps.compare_versions.outputs.release_changed == 'true' run: | npm install --save-dev --save-exact prettier npx prettier --write cmd/template/advanced/files/htmx/htmx.min.js rm -rf node_modules rm package-lock.json rm package.json - if: steps.compare_versions.outputs.release_changed == 'true' - name: Create tmpl after Prettify - run: mv cmd/template/advanced/files/htmx/htmx.min.js cmd/template/advanced/files/htmx/htmx.min.js.tmpl if: steps.compare_versions.outputs.release_changed == 'true' + run: mv cmd/template/advanced/files/htmx/htmx.min.js cmd/template/advanced/files/htmx/htmx.min.js.tmpl - name: Create Pull Request + if: steps.compare_versions.outputs.release_changed == 'true' uses: peter-evans/create-pull-request@v6 with: - commit-message: update htmx version - title: Update htmx version [Bot] - body: New version is available. This is an automatic PR to update changes. + commit-message: update htmx version ${{ steps.get_version_api.outputs.version_api }} + title: Update htmx to version ${{ steps.get_version_api.outputs.version_api }} [Bot] + body: New htmx ${{ steps.get_version_api.outputs.version_api }} version is available. This is an automatic PR to update changes. branch: htmx-version-update base: main - if: steps.compare_versions.outputs.release_changed == 'true'