ci: DO-2153 Create Artifacts for PR #21
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 | |
pull_request: | |
branches: | |
- main | |
jobs: | |
ci: | |
strategy: | |
matrix: | |
binary: [lavad, lavap, lavavisor] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.20.5 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- 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 }} | |
- name: Test build | |
continue-on-error: true | |
if: ${{ matrix.binary }} == "lavad" | |
run: | | |
response=$(cmd/lavad/${{ fromJson(steps.releaser.outputs.artifacts)[0].path }} status --node http://public-rpc.lavanet.xyz:80/rpc/ | jq '.NodeInfo') | |
if [ -z "${response}" ]; then | |
echo "The binary fails to connect to a node." | |
exit 1 | |
else | |
echo $response | |
echo "The binary is working as expected." | |
fi | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.binary }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.metadata).runtime.goos }}-${{ fromJson(steps.releaser.outputs.metadata).runtime.goarch }} | |
path: cmd/${{ matrix.binary }}/dist/* |