Skip to content

Commit

Permalink
working on ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
grantnelson-wf committed Jun 14, 2024
1 parent 1837628 commit a886ea6
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 81 deletions.
42 changes: 42 additions & 0 deletions .github/actions/setup-gopherjs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Setup GopherJS
description: Sets up Go, Node.js, and GopherJS
runs:
using: composite
steps:

- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Setup Node.js
# Make nodejs able to require installed modules from any working path
# and set extra flags to avoid installing node-syscall.
shell: bash
run: |
echo "NODE_PATH=$(npm root)" >> $GITHUB_ENV
npm install --no-optional --no-package-lock
- name: Fix TEMP variable
# see https://github.com/actions/runner-images/issues/712#issuecomment-613004302
shell: bash
if: ${{ inputs.os }} == 'windows-latest'
run: |
echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
echo "TMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
echo "TMPDIR=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
- name: Install GopherJS
shell: bash
run: go install -v

- name: Setup information
shell: bash
run: |
echo ::notice::$(go version)
echo ::notice::$(node -v)
echo ::notice::$(npm -v)
echo ::notice::$(gopherjs version)
87 changes: 87 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]

permissions:
contents: read

env:
GO_VERSION: 1.19.13
NODE_VERSION: 20
GOLANGCI_VERSION: v1.53.3
GOPHERJS_EXPERIMENT: generics
SOURCE_MAP_SUPPORT: true
GOPATH: ${{ github.workspace }}/go
GOPHERJS_PATH: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup GopherJS
uses: ./.github/actions/setup-gopherjs/
- name: Test GopherJS
run: go test -v -short ./...
- name: Smoke tests
run: |
gopherjs build -v net/http
gopherjs test -v --short fmt log os ./tests
lint:
name: Lint Checks
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup GopherJS
uses: ./.github/actions/setup-gopherjs/
# Uncomment when not in Workiva/gopherjs fork
#- name: Install golangci-lint
# uses: golangci/golangci-lint-action@v3
# with:
# version: ${{ env.GOLANGCI_VERSION }}
# only-new-issues: true
- name: Check go.mod
run: go mod tidy && git diff --exit-code
- name: Check natives build tags
# All those packages should have // +build js.
run: diff -u <(echo -n) <(go list ./compiler/natives/src/...)

windows_smoke:
name: Windows Smoke
needs: build
runs-on: windows-latest
env:
SOURCE_MAP_SUPPORT: false
steps:
- uses: actions/checkout@v4
- name: Setup GopherJS
uses: ./.github/actions/setup-gopherjs/
- name: Test GopherJS
run: go test -v -short ./...
- name: Smoke tests
run: |
gopherjs build -v net/http
gopherjs test -v --short fmt sort ./tests
darwin_smoke:
name: Darwin Smoke
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup GopherJS
uses: ./.github/actions/setup-gopherjs/
- name: Test GopherJS
run: |
go test -v -short ./...
- name: Smoke tests
run: |
gopherjs build -v net/http
gopherjs test -v --short fmt log os ./tests
29 changes: 0 additions & 29 deletions .github/workflows/lint.yaml

This file was deleted.

52 changes: 0 additions & 52 deletions .github/workflows/windows-test.yml

This file was deleted.

0 comments on commit a886ea6

Please sign in to comment.