-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): update GitHub Actions jobs
- Loading branch information
1 parent
e24bc46
commit f9c38cf
Showing
1 changed file
with
27 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected] | ||
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 }} |