Skip to content

Commit

Permalink
fix: embedded ui handler panic, go test matrix, refactor workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Apr 22, 2024
1 parent 6915835 commit 856b738
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 40 deletions.
7 changes: 7 additions & 0 deletions .changeset/red-wasps-push.md
@@ -0,0 +1,7 @@
---
'hostd': patch
'renterd': patch
'walletd': patch
---

Fixed an issue where the daemon would panic trying to read the embedded UI files on Windows. Closes https://github.com/SiaFoundation/web/issues/599
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
*.go text eol=lf
27 changes: 27 additions & 0 deletions .github/actions/setup-all/action.yml
@@ -0,0 +1,27 @@
name: Setup all

description: Setup all

inputs:
node_version:
description: Node.js version
required: false
default: '20.10.0'
go_version:
description: Go version
required: false
default: '1.21.7'

runs:
using: composite
steps:
- name: Setup Git
uses: ./.github/actions/setup-git
- name: Setup JS
uses: ./.github/actions/setup-js
with:
node_version: ${{ inputs.node_version }}
- name: Setup Go
uses: ./.github/actions/setup-go
with:
go_version: ${{ inputs.go_version }}
15 changes: 15 additions & 0 deletions .github/actions/setup-git/action.yml
@@ -0,0 +1,15 @@
name: Setup Git

description: Setup Git

runs:
using: composite
steps:
- name: git user config
shell: bash
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Configure git # required for golangci-lint on Windows
shell: bash
run: git config --global core.autocrlf false
21 changes: 21 additions & 0 deletions .github/actions/setup-go/action.yml
@@ -0,0 +1,21 @@
name: Setup Go

description: Setup Go environment and dependencies

inputs:
go_version:
description: Go version
required: false
default: '1.21.7'

runs:
using: composite
steps:
- uses: actions/setup-go@v4
with:
go-version: ${{ inputs.go_version }}
- name: Install Go dependencies
shell: bash
run: |
go mod tidy
go mod download
@@ -1,6 +1,6 @@
name: Setup
name: Setup JS

description: Setup
description: Setup JS environment and dependencies

inputs:
node_version:
Expand All @@ -11,23 +11,12 @@ inputs:
runs:
using: composite
steps:
- name: git user config
shell: bash
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node_version }}
registry-url: https://registry.npmjs.org
- uses: actions/setup-go@v4
with:
go-version: '1.21.7'
- uses: acifani/setup-tinygo@v2
with:
tinygo-version: '0.30.0'
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
- name: Set up node cache
uses: actions/cache@v3
with:
Expand All @@ -46,8 +35,3 @@ runs:
# run: npm ci
run: npm install
shell: bash
- name: Install Go dependencies
run: |
go mod tidy
go mod download
shell: bash
42 changes: 32 additions & 10 deletions .github/workflows/pr.yml
Expand Up @@ -10,28 +10,26 @@ concurrency:
cancel-in-progress: true

jobs:
pr:
test:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
steps:
- name: Checkout all commits
uses: actions/checkout@v3
with:
fetch-depth: 0
# Full setup required since building the JS SDK requires Go
- name: Setup
uses: ./.github/actions/setup
uses: ./.github/actions/setup-all
with:
node_version: 20.10.0
go_version: 1.21.7
- name: Commit lint
shell: bash
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }}
- name: Lint TypeScript
shell: bash
run: npx nx affected --target=lint --parallel=5
- name: Lint Go
uses: golangci/golangci-lint-action@v3
with:
skip-cache: true
# The SDK is referenced via dist in the tsconfig.base.json
# because the next executor does not actually support
# buildLibsFromSource=false
Expand All @@ -43,10 +41,6 @@ jobs:
- name: Test TypeScript
shell: bash
run: npx nx affected --target=test --parallel=5
- name: Test Go
uses: n8maninger/action-golang-test@v1
with:
args: '-race'
- name: Install playwright deps for e2e
shell: bash
run: npx playwright install-deps
Expand All @@ -65,3 +59,31 @@ jobs:
shell: bash
# issue with parallelism
run: npx nx affected --target=build --configuration=export --parallel=5
test-go:
# Run matrix since Go modules are used across all platforms
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
steps:
- name: Checkout all commits
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Git
uses: ./.github/actions/setup-git
# Only Go setup is necessary for running Go tests
- name: Setup Go
uses: ./.github/actions/setup-go
with:
go_version: 1.21.7
- name: Lint Go
uses: golangci/golangci-lint-action@v4
with:
skip-cache: true
- name: Test Go
uses: n8maninger/action-golang-test@v2
with:
args: '-race'
3 changes: 2 additions & 1 deletion .github/workflows/release-go.yml
Expand Up @@ -18,9 +18,10 @@ jobs:
fetch-depth: 0
token: ${{ secrets.PAT_REPOSITORY_DISPATCH }}
- name: Setup
uses: ./.github/actions/setup
uses: ./.github/actions/setup-all
with:
node_version: 20.10.0
go_version: 1.21.7
- name: Release
run: ./scripts/release-go.sh
- name: Commit
Expand Down
42 changes: 33 additions & 9 deletions .github/workflows/release-main.yml
Expand Up @@ -21,9 +21,10 @@ jobs:
with:
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
uses: ./.github/actions/setup-all
with:
node_version: 20.10.0
go_version: 1.21.7
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
Expand All @@ -33,10 +34,6 @@ jobs:
- name: Lint TypeScript
shell: bash
run: npx nx run-many --target=lint --all --parallel=5
- name: Lint Go
uses: golangci/golangci-lint-action@v3
with:
skip-cache: true
# The SDK is referenced via dist in the tsconfig.base.json
# because the next executor does not actually support
# buildLibsFromSource=false
Expand All @@ -48,10 +45,6 @@ jobs:
- name: Test TypeScript
shell: bash
run: npx nx run-many --target=test --all --parallel=5
- name: Test Go
uses: n8maninger/action-golang-test@v1
with:
args: '-race'
- name: Install playwright deps for e2e
shell: bash
run: npx playwright install-deps
Expand Down Expand Up @@ -111,3 +104,34 @@ jobs:
token: ${{ secrets.PAT_REPOSITORY_DISPATCH }}
repository: siafoundation/web
event-type: release-go
# This job should always pass because the workflow is running run against code that
# was already linted and tested in PR.
# This runs in parallel to the build and release process as an extra check but does
# not actually block the release if the Go tests fail.
test-go:
# Run matrix since Go modules are used across all platforms
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout all commits
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Git
uses: ./.github/actions/setup-git
# Only Go setup is necessary for running Go tests
- name: Setup Go
uses: ./.github/actions/setup-go
with:
go_version: 1.21.7
- name: Lint Go
uses: golangci/golangci-lint-action@v4
with:
skip-cache: true
- name: Test Go
uses: n8maninger/action-golang-test@v2
with:
args: '-race'

0 comments on commit 856b738

Please sign in to comment.