Port SubtreeFacts (nee TransformFlags) from Strada (#707) #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: read | |
# Ensure scripts are run with pipefail. See: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | |
- uses: ./.github/actions/setup-go | |
with: | |
cache-name: build | |
- run: npm ci | |
- run: npx hereby build | |
extension: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | |
- run: npm ci | |
- run: npm run extension:build | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
- os: windows-latest | |
- os: macos-latest | |
- os: ubuntu-latest | |
name: 'no submodules' | |
no-submodules: true | |
- os: ['self-hosted', '1ES.Pool=TypeScript-1ES-GitHub-XL', '1ES.ImageOverride=mariner-2.0'] | |
name: 'race mode' | |
race: true | |
- os: ubuntu-latest | |
name: 'noembed' | |
noembed: true | |
- os: ubuntu-latest | |
name: 'concurrent test programs' | |
concurrent-test-program: true | |
name: test (${{ matrix.name || matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
steps: | |
- run: git config --system core.longpaths true | |
if: ${{ matrix.os == 'windows-latest' }} | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
submodules: ${{ !matrix.no-submodules }} | |
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | |
with: | |
node-version: 'lts/*' | |
- uses: ./.github/actions/setup-go | |
with: | |
cache-name: test | |
- run: npm ci | |
- run: go install gotest.tools/gotestsum@latest | |
# Installing gotestsum is super slow on Windows. | |
# Also, avoid using it in race mode so we get the full output. | |
if: ${{ matrix.os != 'windows-latest' && !matrix.race }} | |
- name: Tests | |
id: test | |
run: npx hereby test:all ${RACE_FLAG:+"$RACE_FLAG"} ${NOEMBED_FLAG:+"$NOEMBED_FLAG"} ${CONCURRENTTESTPROGRAM_FLAG:+"$CONCURRENTTESTPROGRAM_FLAG"} | |
env: | |
RACE_FLAG: ${{ (matrix.race && '--race') || '' }} | |
NOEMBED_FLAG: ${{ (matrix.noembed && '--noembed') || '' }} | |
CONCURRENTTESTPROGRAM_FLAG: ${{ (matrix.concurrent-test-program && '--concurrentTestPrograms') || '' }} | |
- run: git add . | |
- run: git diff --staged --exit-code --stat | |
- name: Print baseline diff on failure | |
if: ${{ failure() && steps.test.conclusion == 'failure' }} | |
run: | | |
npx hereby baseline-accept | |
git add testdata/baselines/reference | |
git diff --staged --exit-code | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
if: ${{ failure() && steps.test.conclusion == 'failure' }} | |
with: | |
name: ${{ matrix.os }}-${{ (matrix.race && 'race') || 'norace' }}-new-baselines-artifact | |
path: testdata/baselines/local | |
lint: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
- os: windows-latest | |
- os: macos-latest | |
- os: ubuntu-latest | |
name: 'noembed' | |
noembed: true | |
name: lint (${{ matrix.name || matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | |
- uses: ./.github/actions/setup-go | |
with: | |
cache-name: lint${{ (matrix.noembed && '-noembed') || ''}} | |
- run: npm ci | |
- run: npx hereby install-tools | |
- run: npx hereby lint ${NOEMBED_FLAG:+"$NOEMBED_FLAG"} | |
env: | |
NOEMBED_FLAG: ${{ (matrix.noembed && '--noembed') || '' }} | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | |
- uses: ./.github/actions/setup-go | |
with: | |
cache-name: format | |
- run: npm ci | |
- run: npx hereby install-tools | |
- run: npx hereby check:format | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
submodules: true | |
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | |
- uses: ./.github/actions/setup-go | |
with: | |
cache-name: generate | |
- run: npm ci | |
- run: npx hereby generate | |
- run: git add . | |
- run: git diff --staged --exit-code --stat | |
tidy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: ./.github/actions/setup-go | |
with: | |
cache-name: tidy | |
- run: go mod tidy -diff | |
- run: go -C ./_tools mod tidy -diff | |
smoke: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
submodules: true | |
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | |
- uses: ./.github/actions/setup-go | |
with: | |
cache-name: smoke | |
- run: npm ci | |
- run: npx hereby build --race | |
- run: npm ci && npx hereby generate-diagnostics | |
working-directory: ./_submodules/TypeScript | |
- run: ./built/local/tsgo -p ./_submodules/TypeScript/src/compiler --singleThreaded | |
- run: ./built/local/tsgo -p ./_submodules/TypeScript/src/compiler | |
misc: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: ./.github/actions/setup-go | |
with: | |
cache-name: misc | |
- run: go -C ./_tools run ./cmd/checkmodpaths $PWD | |
required: | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: | |
- build | |
- test | |
- lint | |
- format | |
- generate | |
- tidy | |
- smoke | |
steps: | |
- name: Check required jobs | |
env: | |
NEEDS: ${{ toJson(needs) }} | |
run: | | |
! echo $NEEDS | jq -e 'to_entries[] | { job: .key, result: .value.result } | select(.result != "success")' |