Skip to content

Commit

Permalink
testing release action
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmenendez committed Oct 19, 2023
1 parent fab2bca commit 5310823
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 67 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/gh-pages.yml

This file was deleted.

110 changes: 77 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,64 @@
name: Publish
name: Release new version

on:
push:
tags:
- '*'

jobs:
build:
name: Publish binaries
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.21.x
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout 5m --verbose
skip-cache: false
skip-pkg-cache: false
skip-build-cache: false
only-new-issues: true
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.21.x
cache: true
- name: run test
run: |
go test -v --race -timeout 15m -coverprofile=./cover.out -json ./... > tests.log
- name: convert coverage to html
run: go tool cover -html=cover.out -o cover.html
- name: print test report
run: |
set -o pipefail && cat tests.log | node .github/parse-tests.js >> $GITHUB_STEP_SUMMARY
echo $GITHUB_STEP_SUMMARY
- name: print coverage result
run: |
go tool cover -func=cover.out > ./cover.txt
echo "<details><summary>📏 Tests coverage</summary>" >> $GITHUB_STEP_SUMMARY
echo -e "\n\`\`\`" >> $GITHUB_STEP_SUMMARY
cat ./cover.txt >> $GITHUB_STEP_SUMMARY
echo -e "\`\`\`\n</details>" >> $GITHUB_STEP_SUMMARY
- name: store code coverage artifact
uses: actions/upload-artifact@v3
with:
name: report
path: |
tests.log
cover.txt
cover.out
cover.html
publish:
runs-on: ubuntu-latest
env:
GOOS: js
Expand All @@ -24,36 +75,29 @@ jobs:
- name: Copy go wasm js engine
run: |
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./web
- name: Upload mykeys.wasm
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: web/mykeys.wasm
asset_name: mykeys.wasm
tag: ${{ github.ref }}
overwrite: true
body: "mykeys.live release"
- name: Upload wasm_exec.js
uses: svenstaro/upload-release-action@v2
- name: Generate checksum
uses: jmgilman/actions-generate-checksum@v1
with:
output: sha256_checksums.txt
patterns: |
web/mykeys.wasm
web/wasm_exec.js
- name: Upload assets
uses: softprops/action-gh-release@v1
id: upload-release-asset
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: web/wasm_exec.js
asset_name: wasm_exec.js
tag: ${{ github.ref }}
overwrite: true
body: "wasm_exec.js release"
- name: Generate hash
uses: MCJack123/ghaction-generate-release-hashes@v3
with:
hash-type: sha1
file-name: web/hashes.txt
- name: Upload hash
uses: svenstaro/upload-release-action@v2
files: |
sha256_checksums.txt
web/mykeys.wasm
web/wasm_exec.js
- name: Print assets urls
run: |
echo "${{ fromJSON(steps.upload-release-asset.outputs.assets)[0].browser_download_url }}"
echo "${{ fromJSON(steps.upload-release-asset.outputs.assets)[1].browser_download_url }}"
echo "${{ fromJSON(steps.upload-release-asset.outputs.assets)[2].browser_download_url }}"
- name: Deploy to github pages
uses: JamesIves/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: web/hashes.txt
asset_name: hashes.txt
tag: ${{ github.ref }}
overwrite: true
body: "mykeys.live sha1 hash release"
branch: gh-pages
folder: web

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test
name: Lint and test
on: [push, pull_request]
jobs:
lint:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cli:
chmod +x ./bin/mykeys-cli

web:
+rm -rf ./web/main.wasm
GOOS=js GOARCH=wasm go build -o ./web/main.wasm ./cmd/webassembly/main.go
+rm -rf ./web/mykeys.wasm
GOOS=js GOARCH=wasm go build -o ./web/mykeys.wasm ./cmd/webassembly/main.go

all: cli web
5 changes: 2 additions & 3 deletions web/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import OpenPasswords from './components/OpenPasswords.js';
import SavePasswords from './components/SavePasswords.js';
import ListPasswords from './components/ListPasswords.js';

import { createApp } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'
// import { createApp } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.prod.js'
import { createApp } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.prod.js'

const app = createApp({
data() {
Expand Down Expand Up @@ -52,7 +51,7 @@ const app = createApp({
methods: {
async setupWebAssembly() {
const go = new Go();
const result = await WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject);
const result = await WebAssembly.instantiateStreaming(fetch("mykeys.wasm"), go.importObject);
go.run(result.instance);
},
checkURLParams() {
Expand Down

0 comments on commit 5310823

Please sign in to comment.