From f9c38cf03242e27b0dc75b3257516388f8f04809 Mon Sep 17 00:00:00 2001 From: Claudio Netto Date: Tue, 18 Jul 2023 15:47:45 -0300 Subject: [PATCH] chore(ci): update GitHub Actions jobs --- .github/workflows/ci.yaml | 72 +++++++++++++++------------------------ 1 file changed, 27 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b2c2a098..e3ea126b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,62 +6,37 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: 1.20.x - - uses: actions/cache@v2 - with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: ${{ runner.os }}-gorace-${{ hashFiles('**/go.sum') }}-${{ github.run_id }} - restore-keys: | - ${{ runner.os }}-gorace-${{ hashFiles('**/go.sum') }}- - ${{ runner.os }}-gorace- - # This magic line is to restore the timestamps (mtime) for each file based - # on the its last commit. This allows Go test cache to reuse results for - # tests that depend on fixture files. - - run: git ls-tree -r -t --full-name --name-only HEAD | grep -v vendor | xargs -I{} -P4 sh -c 'touch -d $(git log --pretty=format:%cI -1 HEAD -- "{}") "{}"' + go-version: '1.20' - run: make test lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - uses: actions/setup-go@v1 + go-version: '1.20' + - uses: golangci/golangci-lint-action@v3 with: - go-version: 1.20.x - - run: | - make lint + version: v1.53 integration: runs-on: ubuntu-latest + needs: + - test + - lint steps: - - uses: actions/checkout@v2 - uses: engineerd/setup-kind@v0.5.0 with: version: "v0.11.1" - image: 'kindest/node:v1.21.2' - - uses: actions/setup-go@v1 - with: - go-version: 1.20.x - - uses: actions/cache@v2 + image: 'kindest/node:v1.24.15' + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: ${{ runner.os }}-goleak-${{ hashFiles('**/go.sum') }}-${{ github.run_id }} - restore-keys: | - ${{ runner.os }}-goleak-${{ hashFiles('**/go.sum') }}- - ${{ runner.os }}-goleak- - - run: git ls-tree -r -t --full-name --name-only HEAD | grep -v vendor | xargs -I{} -P4 sh -c 'touch -d $(git log --pretty=format:%cI -1 HEAD -- "{}") "{}"' + go-version: '1.20' - name: Setup run: | kubectl create namespace nginx-operator-system @@ -77,26 +52,33 @@ jobs: NGINX_OPERATOR_INTEGRATION=1 make test docker-image: + runs-on: ubuntu-latest needs: - test - lint - integration - runs-on: ubuntu-latest if: github.event_name != 'pull_request' steps: - - uses: actions/checkout@v2 - - uses: docker/setup-buildx-action@v1 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - uses: actions/checkout@v3 - uses: Surgo/docker-smart-tag-action@v1 id: smarttag with: docker_image: tsuru/nginx-operator default_branch: main tag_with_sha: "true" - - uses: docker/login-action@v1 + - uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - uses: docker/build-push-action@v2 + - uses: docker/build-push-action@v4 with: push: true + platforms: linux/amd64,linux/arm64 tags: ${{ steps.smarttag.outputs.tag }} + build-args: |- + VERSION=${{ github.ref_name }} + GIT_COMMIT=${{ github.sha }}