From 19ef2dd82686bf86a1ff569048949cdff0979c9e Mon Sep 17 00:00:00 2001 From: iofq Date: Sun, 15 Sep 2024 04:34:35 -0500 Subject: [PATCH] move lint to test CI --- .github/workflows/ci.yml | 39 ++++++++++------- .github/workflows/golangci-lint.yml | 65 ----------------------------- Makefile | 24 ++++++++++- 3 files changed, 46 insertions(+), 82 deletions(-) delete mode 100644 .github/workflows/golangci-lint.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76027765a..b4f219962 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,11 +30,6 @@ jobs: GOPROXY: "https://proxy.golang.org" steps: - - name: "Install packages" - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends graphviz gnupg2 gpgv2 git gcc make devscripts - - name: "Checkout repository" uses: actions/checkout@v3 with: @@ -51,14 +46,20 @@ jobs: with: go-version: ${{ steps.goversion.outputs.GOVER }} + - name: "Get aptly version" + run: | + make version > VERSION + cat VERSION + - name: Lint with golangci-lint uses: golangci/golangci-lint-action@v6 with: version: v1.54.1 - - name: "Get aptly version" + - name: "Install packages" run: | - make version + sudo apt-get update + sudo apt-get install -y --no-install-recommends graphviz gnupg2 gpgv2 git gcc make devscripts - name: "Setup Python" uses: actions/setup-python@v4 @@ -103,15 +104,9 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.txt -<<<<<<< HEAD - ci-debian: - name: "CI Build" - needs: build -======= ci-debian-build: name: "CI Build (Deb)" needs: test ->>>>>>> ad4ffa51 (use multiarch CI build for release) runs-on: ubuntu-latest strategy: fail-fast: false @@ -197,9 +192,10 @@ jobs: ./upload-artifacts.sh release ${{ matrix.suite }} ci-release-build: - name: "CI Build (Binary)" + name: "CI Build (Binary Release)" needs: test runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') strategy: matrix: goos: [linux, freebsd, darwin] @@ -230,6 +226,7 @@ jobs: env: GOBIN: /usr/local/bin run: | + set -ex mkdir -p tmp/man tmp/completion/bash_completion.d tmp/completion/zsh/vendor-completions go version echo ${{ github.ref_name }} > VERSION @@ -238,9 +235,11 @@ jobs: cp completion.d/aptly tmp/completion/bash_completion.d/ cp completion.d/_aptly tmp/completion/zsh/vendor-completions/ gzip tmp/man/aptly.1 - path="aptly_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.goarch }}" + path=aptly_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.goarch }} mv tmp "$path" - zip -r "$path" . -i "$path/*" + ls -R "$path" + zip -r aptly . -i "${path}/**" + mv aptly.zip "${path}.zip" - uses: actions/upload-artifact@v4 with: @@ -258,7 +257,15 @@ jobs: uses: actions/download-artifact@v4 with: path: out/ + + - name: Create Changelog + id: changelog + uses: mikepenz/release-changelog-builder-action@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Release uses: softprops/action-gh-release@v2 with: files: "out/**/aptly_*.zip" + body: ${{ steps.changelog.outputs.changelog }} diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml deleted file mode 100644 index a3d8666b7..000000000 --- a/.github/workflows/golangci-lint.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: golangci-lint -on: - push: - branches: - - master - pull_request: - -permissions: - contents: read - # Optional: allow read access to pull request. Use with `only-new-issues` option. - # pull-requests: read - -jobs: - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: "Read go version from go.mod" - run: | - echo "GOVER=$(sed -n 's/^go \(.*\)/\1/p' go.mod)" >> $GITHUB_OUTPUT - id: goversion - - - name: "Setup Go" - uses: actions/setup-go@v3 - with: - go-version: ${{ steps.goversion.outputs.GOVER }} - - - name: Create VERSION file - run: | - make -s version | tr -d '\n' > VERSION - shell: sh - - name: golangci-lint - uses: golangci/golangci-lint-action@v4 - with: - # Require: The version of golangci-lint to use. - # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. - # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. - version: v1.54.1 - - # Optional: working directory, useful for monorepos - # working-directory: somedir - - # Optional: golangci-lint command line arguments. - # - # Note: By default, the `.golangci.yml` file should be at the root of the repository. - # The location of the configuration file can be changed by using `--config=` - # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 - - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true - - # Optional: if set to true, then all caching functionality will be completely disabled, - # takes precedence over all other caching options. - # skip-cache: true - - # Optional: if set to true, then the action won't cache or restore ~/go/pkg. - # skip-pkg-cache: true - - # Optional: if set to true, then the action won't cache or restore ~/.cache/go-build. - # skip-build-cache: true - - # Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'. - # install-mode: "goinstall" diff --git a/Makefile b/Makefile index a364aebc0..423500dcc 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,11 @@ prepare: ## Install go module dependencies go mod tidy -v go generate +dev: + PATH=$(BINPATH)/:$(PATH) + go get github.com/laher/goxc + go install github.com/laher/goxc + check: system/env ifeq ($(RUN_LONG_TESTS), yes) system/env/bin/flake8 @@ -83,6 +88,23 @@ mem.png: mem.dat mem.gp gnuplot mem.gp open mem.png +goxc: dev + rm -rf root/ + mkdir -p root/usr/share/man/man1/ root/etc/bash_completion.d/ root/usr/share/zsh/vendor-completions/ + cp man/aptly.1 root/usr/share/man/man1 + cp completion.d/aptly root/etc/bash_completion.d/ + cp completion.d/_aptly root/usr/share/zsh/vendor-completions/ + gzip root/usr/share/man/man1/aptly.1 + GOPATH=$(PWD)/.go go generate + GOPATH=$(PWD)/.go goxc -pv=$(VERSION) -max-processors=4 $(GOXC_OPTS) + +release: GOXC_OPTS=-tasks-=go-vet,go-test,rmbin +release: goxc + rm -rf build/ + mkdir -p build/ + mv xc-out/$(VERSION)/aptly_$(VERSION)_* build/ + ls -l build/ + man: ## Create man pages make -C man @@ -131,4 +153,4 @@ clean: ## remove local build and module cache test -d .go/ && chmod u+w -R .go/ && rm -rf .go/ || true rm -rf build/ docs/ obj-*-linux-gnu* -.PHONY: help man prepare version release docker-build-aptly-dev docker-system-tests docker-unit-tests docker-lint docker-build build docker-aptly clean +.PHONY: help man prepare version release goxc docker-build-aptly-dev docker-system-tests docker-unit-tests docker-lint docker-build build docker-aptly clean