Bump actions/checkout from 4.0.0 to 4.1.0 #299
Workflow file for this run
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
name: main | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
- name: Setup Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
cache: true | |
go-version-file: 'go.mod' | |
- name: Download dependencies | |
run: | | |
go mod download -x | |
- name: Run tests | |
run: | | |
go test -v -race -coverprofile=coverage.txt -covermode=atomic $(go list ./... | grep -v e2e) | |
- name: Codecov | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 | |
- name: Run linters | |
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0 | |
with: | |
version: v1.48 | |
args: --verbose | |
# See: https://github.com/golangci/golangci-lint-action/issues/244 | |
skip-pkg-cache: true | |
skip-build-cache: true | |
- name: Run ShellCheck | |
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # v2.0.0 | |
with: | |
severity: warning | |
- name: Build | |
run: | | |
go build -v -o ./bin/helm-s3 ./cmd/helm-s3 | |
test-e2e: | |
name: Run end-to-end tests | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
helm: | |
- 2.17.0 | |
- 3.11.3 | |
- 3.12.3 | |
services: | |
minio: | |
# TODO: use official minio/minio image when this issue is fixed: | |
# https://github.community/t/how-do-i-properly-override-a-service-entrypoint/17435 | |
# Meanwhile, there is a workaround with custom image build with CMD set. | |
# See hack/minio/Dockerfile | |
image: hypnoglow/minio:latest | |
env: | |
MINIO_ACCESS_KEY: EXAMPLEKEY123 | |
MINIO_SECRET_KEY: EXAMPLESECRET123456 | |
ports: | |
- 9000:9000 | |
env: | |
AWS_ENDPOINT: localhost:9000 | |
AWS_ACCESS_KEY_ID: EXAMPLEKEY123 | |
AWS_SECRET_ACCESS_KEY: EXAMPLESECRET123456 | |
AWS_DISABLE_SSL: true | |
AWS_DEFAULT_REGION: us-east-1 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
- name: Setup Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
cache: true | |
go-version-file: 'go.mod' | |
- name: Download dependencies | |
run: | | |
go mod download -x | |
- name: Install helm | |
run: | | |
helm_version="${{ matrix.helm }}" | |
curl -sSL https://get.helm.sh/helm-v${helm_version}-linux-amd64.tar.gz | tar xz | |
mv linux-amd64/helm $(go env GOPATH)/bin/helm | |
rm -rf linux-amd64 | |
# Run `helm init` only for helm v2 | |
if [ "${helm_version:0:1}" == "2" ]; then | |
helm init --client-only | |
fi | |
# Add `stable` repo only for helm v3 | |
if [ "${helm_version:0:1}" == "3" ]; then | |
helm repo add stable https://charts.helm.sh/stable | |
fi | |
- name: Build and install the plugin | |
run: | | |
plugin_version="commit.${{ github.sha }}" | |
tmp_dir="$(mktemp -d)" | |
go build \ | |
-o bin/helm-s3 \ | |
-ldflags "-X main.version=${plugin_version}" \ | |
./cmd/helm-s3 | |
# Copy plugin directory to outside of the workspace. | |
cp -r ${{ github.workspace }} ${tmp_dir} | |
# Correct the plugin manifest to make installation purely local | |
cd ${tmp_dir}/helm-s3 | |
sed -i "/^hooks:/,+2 d" plugin.yaml | |
sed -i "s/^version:.*$/version: ${plugin_version}/" plugin.yaml | |
helm plugin install ${tmp_dir}/helm-s3 | |
- name: Install minio client, prepare minio server | |
run: | | |
curl -sSL https://dl.minio.io/client/mc/release/linux-amd64/mc -o $(go env GOPATH)/bin/mc | |
chmod +x $(go env GOPATH)/bin/mc | |
mc config host add helm-s3-minio http://${AWS_ENDPOINT} ${AWS_ACCESS_KEY_ID} ${AWS_SECRET_ACCESS_KEY} | |
mc mb helm-s3-minio/test-bucket | |
- name: Run tests | |
run: | | |
go test -v ./tests/e2e/... | |
docker-images: | |
name: Build Docker images | |
needs: | |
- test-e2e | |
uses: ./.github/workflows/reusable-docker-images.yml | |
secrets: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
# This job's only purpose is to be used for the "Require status checks to pass | |
# before merging" feature. | |
status-check: | |
name: "Status check" | |
needs: | |
- build | |
- test-e2e | |
- docker-images | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
test-install: | |
name: Test plugin installation | |
needs: | |
- test-e2e | |
uses: ./.github/workflows/reusable-test-install.yml | |
if: github.ref_name == 'master' |