Skip to content

Commit

Permalink
Update github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdi-shojaee committed Oct 27, 2024
1 parent 0d741bb commit 0025b05
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 33 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/build-and-test.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/build-test-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Build, Test, and Deploy

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
# Add manual trigger
workflow_dispatch:

permissions:
contents: write
pages: write
id-token: write

# Add concurrency group for pages deployment
concurrency:
group: "pages"
cancel-in-progress: false

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

deploy-benchmark:
needs: build # This ensures deploy runs after successful build
# Only run deployment on master branch pushes or manual triggers
if: github.ref == 'refs/heads/master'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.18'

- name: Build benchmark results viewer
working-directory: ./charts
run: go run main.go -build

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './charts/benchmark-results-viewer'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 0025b05

Please sign in to comment.