refactor for tautological condition non-nil not equal to nil #274
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: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
- '.gitignore' | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21' | |
- run: go version | |
- name: Get Go Paths | |
id: go-paths | |
run: | | |
echo ::set-output name=mod_cache::$(go env GOMODCACHE) | |
echo ::set-output name=build_cache::$(go env GOCACHE) | |
- name: Go modules and build cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.go-paths.outputs.mod_cache }} | |
${{ steps.go-paths.outputs.build_cache }} | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Go modules sync | |
run: go mod tidy | |
- name: Run Tests | |
run: make test | |
release: | |
name: Build Push Release | |
if: startsWith( github.ref, 'refs/tags/' ) | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21' | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get the version | |
id: get_version | |
run: | | |
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} | |
echo ::set-output name=TAG_NAME::${GITHUB_REF#refs/tags/} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Create release YAML (gatling-operator.yaml) | |
env: | |
VERSION: ${{ steps.get_version.outputs.VERSION }} | |
run: | | |
IMAGE_ID=$REGISTRY/$IMAGE_NAME | |
make manifests-release IMG=$IMAGE_ID:$VERSION | |
- name: Publish images to the registry | |
env: | |
VERSION: ${{ steps.get_version.outputs.VERSION }} | |
run: | | |
IMAGE_ID=$REGISTRY/$IMAGE_NAME | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
make docker-push IMG=$IMAGE_ID:$VERSION | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ steps.get_version.outputs.TAG_NAME }} | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
files: gatling-operator.yaml |