Skip to content

Commit

Permalink
fix indent
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Niedbalski <[email protected]>
  • Loading branch information
niedbalski committed Aug 6, 2023
1 parent b995a0e commit eefa912
Showing 1 changed file with 2 additions and 114 deletions.
116 changes: 2 additions & 114 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,53 +10,16 @@ on:

jobs:
build-internal:
name: Build and test
permissions:
contents: write
packages: write
name: Test
runs-on: ubuntu-latest
env:
goreleaser-flags: ""
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# required for goreleaser to work properly.
fetch-depth: 0

- run: git fetch --force --tags

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.CI_USERNAME }}
password: ${{ secrets.CI_PAT }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18

- name: Install cmetrics
run: |
CMETRICS_VERSION=0.5.8
CMETRICS_RELEASE=v0.5.8
echo "Using release: CMETRICS_RELEASE"
echo "Using version: CMETRICS_VERSION"
wget https://github.com/calyptia/cmetrics/releases/download/${CMETRICS_RELEASE}/cmetrics_${CMETRICS_VERSION}_${TARGETARCH}-headers.deb
wget https://github.com/calyptia/cmetrics/releases/download/${CMETRICS_RELEASE}/cmetrics_${CMETRICS_VERSION}_${TARGETARCH}.deb
sudo dpkg -i *.deb
rm *.deb
shell: bash
env:
TARGETARCH: amd64
go-version: 1.20

- name: Unit tests
run: |
Expand All @@ -69,78 +32,3 @@ jobs:
file: ./coverage.out
flags: ${{ runner.os }}
token: ${{ secrets.CODECOV_TOKEN }}

- name: Extract metadata from ghcr image
id: meta-github-image
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=pr
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
- name: Build AMD64 docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta-github-image.outputs.tags }}
labels: ${{ steps.meta-github-image.outputs.labels }}

- name: Setup BATS
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
uses: mig4/setup-bats@v1
with:
bats-version: 1.8.2

- name: Integration tests
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |
./testing/run-bats.sh
shell: bash
timeout-minutes: 10
env:
PLUGIN_IMAGE: ${{ steps.meta-github-image.outputs.tags }}

- name: Install Syft for sboms
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
shell: bash

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.CALYPTIA_GPG_KEY }}
passphrase: ${{ secrets.CALYPTIA_GPG_KEY_PASSPHRASE }}

- name: Build artefacts on top of cross compile image.
run: |
make build-amd64
sudo rm -rf go
make build-arm64
shell: bash
env:
GORELEASER_IMAGE: ghcr.io/calyptia/lts-advanced-plugin-template/goreleaser-cross:latest
GORELEASER_SNAPSHOT: ${{ github.event_name == 'pull_request' }}

# Note snapshot removal in v4: https://github.com/caarlos0/goreleaser-action-v4-auto-snapshot-example
- name: Set up snapshot build
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: echo "goreleaser-flags=--snapshot" >> $GITHUB_ENV

- name: Set up PR build
if: ${{ github.event_name == 'pull_request' }}
run: echo "goreleaser-flags=--skip-publish --skip-sign --skip-sbom --snapshot" >> $GITHUB_ENV

- name: Run GoReleaser with flags
uses: goreleaser/goreleaser-action@v4
with:
version: latest
distribution: goreleaser-pro
args: release --skip-validate --clean ${{ env.goreleaser-flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GORELEASER_KEY: ${{ secrets.GORELEASER_PRO_KEY }}

0 comments on commit eefa912

Please sign in to comment.