diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 201931ee51..453780df57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # without this, setup-node errors on mismatched yarn versions - run: corepack enable @@ -75,7 +75,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # without this, setup-node errors on mismatched yarn versions - run: corepack enable @@ -121,7 +121,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # without this, setup-node errors on mismatched yarn versions - run: corepack enable @@ -158,7 +158,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # without this, setup-node errors on mismatched yarn versions - run: corepack enable @@ -194,7 +194,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # without this, setup-node errors on mismatched yarn versions - run: corepack enable @@ -230,7 +230,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # without this, setup-node errors on mismatched yarn versions - run: corepack enable @@ -271,12 +271,15 @@ jobs: fail-fast: false matrix: node-version: [20.x] - moddable-version: [5.0.0] + # Including one of each category, named release and git ref, to ensure + # we support both cases for the duration of the PR that introduces this + # CI job. + moddable-version: [5.0.0, 1f49b61d52987bce8d430ac2fe1fab5365bc2043] platform: [ubuntu-latest] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # without this, setup-node errors on mismatched yarn versions - run: corepack enable @@ -295,71 +298,46 @@ jobs: - name: Run yarn build run: yarn build - - name: Get XS + - name: Choose download or build + id: check-release run: | - wget https://github.com/Moddable-OpenSource/moddable/releases/download/${{ matrix.moddable-version }}/xst-lin64.zip - mkdir -p bin - unzip xst-lin64.zip -d bin - chmod 755 bin/xst + if curl -f -s -o /dev/null -I -L https://api.github.com/repos/Moddable-OpenSource/moddable/releases/tags/${{ matrix.moddable-version }} + then + echo release=download + else + echo release=build + fi >> $GITHUB_OUTPUT + + - name: Download XS + if: steps.check-release.outputs.release == 'download' + working-directory: .. + run: | + BINDIR=$GITHUB_WORKSPACE/moddable/build/bin/lin/debug + wget "https://github.com/Moddable-OpenSource/moddable/releases/download/${{ matrix.moddable-version }}/xst-lin64.zip" + mkdir -p "$BINDIR" + unzip xst-lin64.zip -d "$BINDIR" + chmod 755 "$BINDIR/xst" + + - name: Checkout XS + if: steps.check-release.outputs.release == 'build' + uses: actions/checkout@v4 + with: + repository: moddable-OpenSource/moddable + ref: ${{ matrix.moddable-version }} + path: moddable - - name: Is this thing on? + - name: Build XS + if: steps.check-release.outputs.release == 'build' + working-directory: moddable/xs/makefiles/lin run: | - PATH=$PATH:$GITHUB_WORKSPACE/bin + make debug MODDABLE=$GITHUB_WORKSPACE/moddable CC='cc "-D__has_builtin(x)=1"' # give the syntax highlighter a hand: ' + + - name: Validate XS Build or Download + run: | + PATH=$PATH:$GITHUB_WORKSPACE/moddable/build/bin/lin/debug xst -e true && ! xst -e null.reference - name: Run XS tests run: | - PATH=$PATH:$GITHUB_WORKSPACE/bin + PATH=$PATH:$GITHUB_WORKSPACE/moddable/build/bin/lin/debug yarn lerna run test:xs - - # for testing a version with a particular hash, when pre-built binaries are unavailable - # make-and-test-xs: - # name: make-and-test-xs - # - # # begin macro - # - # runs-on: ${{ matrix.platform }} - # strategy: - # fail-fast: false - # matrix: - # moddable-version: [] - # node-version: [20.x] - # platform: [ubuntu-latest] - # - # steps: - # - name: Checkout - # uses: actions/checkout@v3 - # - # # without this, setup-node errors on mismatched yarn versions - # - run: corepack enable - # - # - name: Use Node.js ${{ matrix.node-version }} - # uses: actions/setup-node@v3 - # with: - # node-version: ${{ matrix.node-version }} - # cache: yarn - # - # - name: Install dependencies - # run: yarn install --immutable - # - # # end macro - # - # - name: Run yarn build - # run: yarn build - # - # - name: Clone XS - # run: git clone https://github.com/moddable-OpenSource/moddable --branch "${{ matrix.moddable-version }}" --depth 1 - # - # - name: Build XS - # working-directory: moddable/xs/makefiles/lin - # run: make debug MODDABLE=$GITHUB_WORKSPACE/moddable CC='cc "-D__has_builtin(x)=1"' # give the syntax highlighter a hand: ' - # - # - name: Is this thing on? - # run: | - # PATH=$PATH:$GITHUB_WORKSPACE/moddable/build/bin/lin/debug - # xst -e true && ! xst -e null.reference - # - # - name: Run XS tests - # run: | - # PATH=$PATH:$GITHUB_WORKSPACE/moddable/build/bin/lin/debug - # yarn lerna run test:xs