From 064aa3a467d73a351262afeacd9eb64912b98a67 Mon Sep 17 00:00:00 2001 From: Grant Nelson Date: Fri, 14 Jun 2024 14:26:25 -0600 Subject: [PATCH] working on ci workflow --- .github/actions/setup-gopherjs/action.yml | 23 +++++++-------- .github/workflows/ci.yaml | 35 +++++++++++++++++++---- .github/workflows/lint.yaml | 29 ------------------- 3 files changed, 41 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/lint.yaml diff --git a/.github/actions/setup-gopherjs/action.yml b/.github/actions/setup-gopherjs/action.yml index c7d72df14..4823e8532 100644 --- a/.github/actions/setup-gopherjs/action.yml +++ b/.github/actions/setup-gopherjs/action.yml @@ -1,39 +1,38 @@ -name: Setup -description: Setup the environment for GopherJS - -inputs: - os: - description: 'Operating system to run on' - required: false - default: 'ubuntu-latest' +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: | - # Make nodejs able to require installed modules from any working path echo "NODE_PATH=$(npm root)" >> $GITHUB_ENV - # Extra flags to avoid installing node-syscall. 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 "SOURCE_MAP_SUPPORT=false" >> $env:GITHUB_ENV - # Fix TEMP variable, see https://github.com/actions/runner-images/issues/712#issuecomment-613004302 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: | diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d5f6afd90..290df6335 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,6 +12,7 @@ permissions: 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 @@ -23,7 +24,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-gopherjs/ + - name: Setup GopherJS + uses: ./.github/actions/setup-gopherjs/ - name: Test GopherJS run: go test -v -short ./... - name: Smoke tests @@ -31,13 +33,35 @@ jobs: gopherjs build -v net/http gopherjs test -v --short fmt log os ./tests - windows_smoke: + lint: + name: Lint Checks needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup GopherJS + uses: ./.github/actions/setup-gopherjs/ + - 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 - - uses: ./.github/actions/setup-gopherjs/ + - name: Setup GopherJS + uses: ./.github/actions/setup-gopherjs/ - name: Test GopherJS run: go test -v -short ./... - name: Smoke tests @@ -46,12 +70,13 @@ jobs: gopherjs test -v --short fmt sort ./tests darwin_smoke: - needs: build name: Darwin Smoke + needs: build runs-on: macos-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-gopherjs/ + - name: Setup GopherJS + uses: ./.github/actions/setup-gopherjs/ - name: Test GopherJS run: | go test -v -short ./... diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index 0e2af1ec4..000000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: Lint Checks -on: - pull_request: -permissions: - contents: read -jobs: - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-go@v3 - with: - go-version: "1.19.13" - - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.53.3 - only-new-issues: true - - - name: Check go.mod - run: | - go mod tidy && git diff --exit-code - - - name: Check natives build tags - run: | - diff -u <(echo -n) <(go list ./compiler/natives/src/...) # All those packages should have // +build js.