Skip to content

Commit

Permalink
fix: Do 2153 pr artifacts (#1331)
Browse files Browse the repository at this point in the history
* only run for PRs to main

* using goreleaser

* updated main to use go releaser

* remove working dir

* fetch-depth: 0

* adding goreleaser config files

* added docker

* added config to lavap and visor

* added nfpms

* added id and binary

* update  pipeline

* --skip=validate

* no need for both snapshot and skip

* use: buildx

* update config

* rename workflow files

* update job name

* matrix strategy

* running on macos as well

* artifact names

* fronJson

* naming

* windows-latest

* update goreleasr files

* update releaser files

* single goreleaser file

* cmd

* upload pattern

* cache

* checkout first

* fixed merge

* not using goreleaser for ci

* using env

* uploading pr artifacts

* change binary path

* -o

* update release

---------

Co-authored-by: amitz <[email protected]>
Co-authored-by: Amit Zafran <[email protected]>
  • Loading branch information
3 people authored Mar 25, 2024
1 parent c5c55a6 commit 4a47168
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 247 deletions.
73 changes: 25 additions & 48 deletions .github/workflows/lava.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,68 +8,45 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
ci:
name: ${{ matrix.binary }}-${{ matrix.targetos }}-${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
matrix:
binary: [lavad, lavap, lavavisor]
targetos: [darwin, linux]
arch: [amd64, arm64]
runs-on: ubuntu-latest
env:
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}
targetos: [darwin, linux]
binary: [lavad, lavap, lavavisor]
include:
- targetos: darwin
arch: arm64

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Run GoReleaser
id: releaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: build --single-target --snapshot --clean
workdir: cmd/${{ matrix.binary }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}

- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.artifacts)[0].goos }}-${{ fromJson(steps.releaser.outputs.artifacts)[0].goarch }}
path: cmd/${{ matrix.binary }}/${{ fromJson(steps.releaser.outputs.artifacts)[0].path }}
- name: Download Dependencies
run: go mod download

# - name: Docker meta
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: |
# lava/${{ matrix.binary }}
# ghcr.io/lavanet/${{ matrix.binary }}
# tags: |
# type=raw,value=latest,enable={{is_default_branch}}
# type=schedule
# type=ref,event=branch
# type=ref,event=pr
# type=semver,pattern={{version}}
# type=semver,pattern={{major}}.{{minor}}
# type=semver,pattern={{major}}
# type=sha
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Build and push
# uses: docker/build-push-action@v5
# with:
# context: .
# push: ${{ github.event_name != 'pull_request' }}
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}

- name: Build ${{ matrix.binary }}
run: |
GOWRK=off go build -o out/${{ matrix.binary }} cmd/${{ matrix.binary }}/main.go
- name: Upload Lava Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}-${{ matrix.targetos }}-${{ matrix.arch }}
path: out/${{ matrix.binary }}
9 changes: 0 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@ permissions:
jobs:
release:
name: 'release'
strategy:
matrix:
binary: [lavad, lavap, lavavisor]
targetos: [darwin, linux]
arch: [amd64, arm64]
runs-on: ubuntu-latest
env:
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}

permissions:
contents: write
Expand All @@ -46,7 +38,6 @@ jobs:
with:
version: latest
args: release --clean --timeout 90m
workdir: cmd/${{ matrix.binary }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
60 changes: 58 additions & 2 deletions cmd/lavavisor/.goreleaser.yaml → .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
project_name: lavavisor
project_name: lava
before:
hooks:
# You may remove this if you don't use go modules.
Expand All @@ -15,6 +15,62 @@ before:

builds:
- id: lavavisor
binary: lavavisor
dir: cmd/lavavisor
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: darwin
goarch: s390x
- goos: darwin
goarch: ppc64le
- goos: windows
goarch: s390x
- goos: windows
goarch: ppc64le
- goos: windows
goarch: arm64
flags:
- -mod=readonly
- -trimpath

- id: lavad
binary: lavad
dir: cmd/lavad
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: darwin
goarch: s390x
- goos: darwin
goarch: ppc64le
- goos: windows
goarch: s390x
- goos: windows
goarch: ppc64le
- goos: windows
goarch: arm64
flags:
- -mod=readonly
- -trimpath

- id: lavap
binary: lavap
dir: cmd/lavap
env:
- CGO_ENABLED=0
goos:
Expand Down Expand Up @@ -91,4 +147,4 @@ release:
replace_existing_draft: true
name_template: "Lava v{{.Version}} 🌋"
mode: replace
draft: true
draft: true
94 changes: 0 additions & 94 deletions cmd/lavad/.goreleaser.yaml

This file was deleted.

94 changes: 0 additions & 94 deletions cmd/lavap/.goreleaser.yaml

This file was deleted.

0 comments on commit 4a47168

Please sign in to comment.