1
0
mirror of https://github.com/nikolaydubina/calendarheatmap.git synced 2024-12-04 03:39:18 +02:00
This commit is contained in:
Nikolay Dubina 2024-08-22 15:41:47 +08:00
parent 0348ca7f76
commit be989e2168
3 changed files with 98 additions and 43 deletions

View File

@ -2,49 +2,40 @@ name: Tests
on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
permissions: read-all
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.16
id: go
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.16
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Test
run: |
go get -v -t -d ./...
go install github.com/jstemmer/go-junit-report/v2@latest
go test -coverprofile=coverage.out -covermode=atomic -cover -json -v ./charts 2>&1 | go-junit-report -set-exit-code > tests.xml
- name: Get dependencies
run: go get -v -t -d ./...
- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: tests.xml
- name: Test that can build
run: go build
- name: Test
run: go test -v -coverprofile=coverage.out -covermode=atomic ./charts
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.out
verbose: true
- name: Build web
run: make build-web
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: web
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.out

55
.github/workflows/web.yaml vendored Normal file
View File

@ -0,0 +1,55 @@
name: Build and Deploy web
on:
workflow_run:
workflows: ["Tests"]
branches: [master]
types:
- completed
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.16
id: go
- name: Build web
env:
GTAG: ${{ vars.GTAG }}
run: |
go get -v -t -d ./...
envsubst < web/index.html | sponge web/index.html
make build-web
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

View File

@ -4,11 +4,13 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Create GitHub like Calendar Heatmaps in SVG, PNG, JPEG. Built with: Go; WebAssembly; Bootstrap; GitHub Pages.">
<meta name="description"
content="Create GitHub like Calendar Heatmaps in SVG, PNG, JPEG. Built with: Go; WebAssembly; Bootstrap; GitHub Pages.">
<title>Calendar Heatmap</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Bungee+Shade">
@ -38,7 +40,7 @@
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-D6NR6EJGD7"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=$GTAG"></script>
<script>
window.dataLayer = window.dataLayer || [];
@ -47,12 +49,14 @@
}
gtag('js', new Date());
gtag('config', 'G-D6NR6EJGD7');
gtag('config', '$GTAG');
</script>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
<div class="container">
<div class="mx-auto" style="width: 700px;">
@ -63,7 +67,9 @@
CALENDAR HEATMAP
</p>
<div class="d-flex justify-content-center">
<a class="github-button" href="https://github.com/nikolaydubina/calendarheatmap" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star nikolaydubina/calendarheatmap on GitHub">Star</a>
<a class="github-button" href="https://github.com/nikolaydubina/calendarheatmap"
data-icon="octicon-star" data-size="large" data-show-count="true"
aria-label="Star nikolaydubina/calendarheatmap on GitHub">Star</a>
</div>
</div>
</div>
@ -75,18 +81,21 @@
<form id="inputConfig">
<div class="d-grid gap-1">
<div class="mb-3">
<input type="radio" class="btn-check" name="formatOption" id="formatSVG" autocomplete="off" checked>
<input type="radio" class="btn-check" name="formatOption" id="formatSVG" autocomplete="off"
checked>
<label class="btn btn-outline-secondary" for="formatSVG">SVG</label>
<input type="radio" class="btn-check" name="formatOption" id="formatPNG" autocomplete="off">
<label class="btn btn-outline-secondary" for="formatPNG">PNG</label>
<input type="radio" class="btn-check" name="formatOption" id="formatJPEG" autocomplete="off">
<input type="radio" class="btn-check" name="formatOption" id="formatJPEG"
autocomplete="off">
<label class="btn btn-outline-secondary" for="formatJPEG">JPEG</label>
</div>
<div class="mb-3">
<textarea class="form-control" id="inputData" rows="10" style="resize: vertical; width: 100%; height: auto;">
<textarea class="form-control" id="inputData" rows="10"
style="resize: vertical; width: 100%; height: auto;">
{
"2020-05-16": 8,
"2020-05-17": 13,
@ -152,4 +161,4 @@
</div>
</body>
</html>
</html>