Skip to content

remove unnecessary non-nil == nil check #21608

remove unnecessary non-nil == nil check

remove unnecessary non-nil == nil check #21608

Workflow file for this run

name: Go
on:
push:
branches:
- main
- release-*
pull_request:
branches:
- main
- release-*
merge_group:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
env:
# renovate: datasource=docker depName=docker.io/multiarch/qemu-user-static versioning=regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)-(?<build>\\d+)$
QEMU_VERSION: 7.0.0-7
# renovate: datasource=docker depName=docker.io/buildpack-deps versioning=ubuntu
BUILDPACK_DEPS_VERSION: '22.04'
# renovate: datasource=npm depName=pnpm versioning=npm
PNPM_VERSION: '8.15.9'
jobs:
build-and-test-multi-arch:
name: Test on ${{ matrix.arch }}
runs-on: ubuntu-latest
timeout-minutes: 90
# Run steps on a matrix of 2 arch.
strategy:
matrix:
arch:
- amd64
- arm64
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1
continue-on-error: true
with:
do_not_skip: '["schedule", "workflow_dispatch"]'
paths: |-
[
"**.go",
".github/workflows/build-test.yml",
".go-version",
".node-version",
"go.mod",
"go.sum",
"ui/**"
]
skip_after_successful_duplicate: false
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: ${{ steps.skip-check.outputs.should_skip != 'true' }}
- name: Set up Go
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: .go-version
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
with:
version: ${{ env.PNPM_VERSION }}
- name: Set up Node.js
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
with:
node-version-file: .node-version
cache: 'pnpm'
cache-dependency-path: ui/pnpm-lock.yaml
- name: Build
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
run: |
make build
- name: Test
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
run: |
make test ENABLE_RACE=yes
- name: Benchmark
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
run: |
make go/bench
- name: Archive generated artifacts
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch == 'amd64' }}
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1
with:
name: parca-bin
if-no-files-found: error
path: |
bin
- name: 'Run ${{ matrix.arch }}'
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch != 'amd64' }}
run: |
# Register QEMU
docker run --rm --privileged "docker.io/multiarch/qemu-user-static:${QEMU_VERSION}" --reset -p yes
# Run platform specific based buildpack-deps image. Run it as a daemon in the background.
# Sleep the container for 1 day so that it keeps running until
# other steps are completed and the steps below can use the same container.
docker run \
--name=buildpack-deps \
--detach \
--platform 'linux/${{ matrix.arch }}' \
--volume /home/runner/work:/home/runner/work \
--workdir "${PWD}" \
"docker.io/buildpack-deps:${BUILDPACK_DEPS_VERSION}" \
bash -c 'uname -m && sleep 1d'
# Install Golang, which will be used to build the code.
- name: 'Setup Go on ${{ matrix.arch }}'
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch != 'amd64' }}
shell: docker exec buildpack-deps bash -e {0}
run: |
GO_VERSION="$(<.go-version)"
wget --directory-prefix=/tmp "https://dl.google.com/go/go${GO_VERSION}.linux-${{ matrix.arch }}.tar.gz"
tar -C /usr/local/ -xzf "/tmp/go${GO_VERSION}.linux-${{ matrix.arch }}.tar.gz"
export PATH="${PATH}:/usr/local/go/bin"
go version
# Run Go Tests. This is a very slow operation on ARM container.
- name: 'Test on ${{ matrix.arch }}'
if: ${{ steps.skip-check.outputs.should_skip != 'true' && matrix.arch != 'amd64' }}
shell: docker exec buildpack-deps bash -e {0}
run: |
export PATH="${PATH}:/usr/local/go/bin"
mkdir -p ui/packages/app/web/build
touch ui/packages/app/web/build/index.html
go test -buildvcs=false -v ./...