From c2e3867598085c6648d82bcf66cbb26ec49d190e Mon Sep 17 00:00:00 2001 From: Hiroki Matsumoto Date: Sat, 3 Feb 2024 21:26:20 +0900 Subject: [PATCH] ci: update lint action --- .devcontainer/docker-compose.yml | 3 ++- .github/workflows/e2e.yaml | 4 ++-- .github/workflows/pull-request.yml | 18 +++++++++++------- .github/workflows/releease.yml | 18 +++++++++--------- .gitignore | 2 ++ .golangci.yml => .golangci.yaml | 0 .goreleaser.yml => .goreleaser.yaml | 6 ++++-- test/kubernetes/run.sh | 1 + test/passenger-app/Dockerfile | 2 +- 9 files changed, 32 insertions(+), 22 deletions(-) rename .golangci.yml => .golangci.yaml (100%) rename .goreleaser.yml => .goreleaser.yaml (94%) diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index fd68796..2ebccf1 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -44,7 +44,8 @@ services: depends_on: - passenger-app passenger-app: - image: ghcr.io/rakutentech/passenger-go-exporter/passenger-app:6.0.14 + image: ghcr.io/rakutentech/passenger-go-exporter/passenger-app:6.0.20 + platform: linux/x86_64 ports: - 3000:3000 environment: diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 2b4aecf..7bd97a6 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -18,9 +18,9 @@ jobs: - 6.0.20 steps: - uses: actions/checkout@v4 - - uses: engineerd/setup-kind@v0.5.0 + - uses: helm/kind-action@v1.5.0 with: - version: "v0.21.0" + cluster_name: kind - name: Kind Load Image run: | docker build -t passenger-go-exporter:test . diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 6113e4b..27c5c41 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -4,6 +4,9 @@ on: pull_request: types: [opened, synchronize, reopened] +permissions: + contents: read + jobs: test: name: Test @@ -13,9 +16,12 @@ jobs: - uses: actions/setup-go@v5 with: go-version: '1.20' + cache: false - uses: actions/cache@v4 with: - path: ~/go/pkg/mod + path: | + ~/.cache/go-build + ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- @@ -28,7 +34,7 @@ jobs: run: go test -json ./... > test.json - name: annotate tests if: always() - uses: guyarb/golang-test-annotations@v0.6.0 + uses: guyarb/golang-test-annotations@v0.7.0 with: test-results: test.json lint: @@ -38,11 +44,9 @@ jobs: go-version: [1.20] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - stable: 'true' go-version: '1.20' + cache: false - uses: golangci/golangci-lint-action@v3 - with: - skip-go-installation: true diff --git a/.github/workflows/releease.yml b/.github/workflows/releease.yml index 75babdf..bedef81 100644 --- a/.github/workflows/releease.yml +++ b/.github/workflows/releease.yml @@ -15,21 +15,21 @@ jobs: COSIGN_EXPERIMENTAL: "1" steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install cosign - uses: sigstore/cosign-installer@v2 + uses: sigstore/cosign-installer@v3 - name: Set env run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ secrets.USERNAME }} @@ -37,7 +37,7 @@ jobs: - name: Build and push id: build-and-push - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . push: true @@ -77,18 +77,18 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: "1.20" - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v5 with: version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.CR_PAT }} diff --git a/.gitignore b/.gitignore index 00a342f..5235859 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ passenger-go-exporter # Dependency directories (remove the comment below to include it) # vendor/ + +dist/ diff --git a/.golangci.yml b/.golangci.yaml similarity index 100% rename from .golangci.yml rename to .golangci.yaml diff --git a/.goreleaser.yml b/.goreleaser.yaml similarity index 94% rename from .goreleaser.yml rename to .goreleaser.yaml index 5baf02a..9cfbea6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yaml @@ -1,16 +1,18 @@ +version: 1 + before: hooks: # You may remove this if you don't use go modules. - - go mod download + - go mod tidy # you may remove this if you don't need go generate - go generate ./... builds: - env: - CGO_ENABLED=0 goos: + - linux - windows - darwin - - linux goarch: - amd64 archives: diff --git a/test/kubernetes/run.sh b/test/kubernetes/run.sh index 722bc1a..4f4d058 100755 --- a/test/kubernetes/run.sh +++ b/test/kubernetes/run.sh @@ -6,6 +6,7 @@ REPO_HOME=$(git rev-parse --show-toplevel) kubectl delete namespace test --ignore-not-found=true --wait=true kubectl create namespace test + # deploy kubectl apply -k ${REPO_HOME}/test/kubernetes/test kubectl set image -n test deployment/example example=ghcr.io/rakutentech/passenger-go-exporter/passenger-app:$PASSENGER_VERSION diff --git a/test/passenger-app/Dockerfile b/test/passenger-app/Dockerfile index bec134c..07792da 100644 --- a/test/passenger-app/Dockerfile +++ b/test/passenger-app/Dockerfile @@ -1,6 +1,6 @@ FROM ruby:3.3 -ARG ARG_RAILS_VERSION=7.1.3 +ARG ARG_RAILS_VERSION=7.0.8 ARG ARG_PASSENGER_VERSION=6.0.20 ENV RAILS_VERSION $ARG_RAILS_VERSION ENV PASSENGER_VERSION $ARG_PASSENGER_VERSION