Skip to content

fix: set SSL properly for created dynamic backends #4829

fix: set SSL properly for created dynamic backends

fix: set SSL properly for created dynamic backends #4829

Workflow file for this run

name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches: [main]
defaults:
run:
shell: bash
env:
# Note: when updated, also update version in ensure-cargo-installs
viceroy_version: 0.12.0
# Note: when updated, also update version in ensure-cargo-installs ! AND ! release-please.yml
wasm-tools_version: 1.216.0
fastly-cli_version: 10.13.3
jobs:
check-changelog:
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- run: npm ci
- run: npm run format-changelog
check-docusaurus:
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- run: cd documentation && npm run add-fastly-prefix
- run: cd documentation && npm ci
- run: cd documentation && npm run build
ensure-cargo-installs:
name: Ensure that all required "cargo install" commands are run, or we have a cache hit
strategy:
matrix:
include:
- crate: viceroy
version: 0.12.0 # Note: workflow-level env vars can't be used in matrix definitions
options: ""
- crate: wasm-tools
version: 1.216.0 # Note: workflow-level env vars can't be used in matrix definitions
options: ""
runs-on: ubuntu-latest
steps:
- name: Cache ${{ matrix.crate }} ${{ matrix.version }}
id: cache-crate
uses: actions/cache@v3
with:
path: "/home/runner/.cargo/bin/${{ matrix.crate }}"
key: crate-cache-${{ matrix.crate }}-${{ matrix.version }}
- name: Install ${{ matrix.crate }} ${{ matrix.version }}
if: steps.cache-crate.outputs.cache-hit != 'true'
run: cargo install ${{ matrix.crate }} ${{ matrix.options }} --version ${{ matrix.version }} --force
shellcheck:
env:
SHELLCHECK_VERSION: v0.8.0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cache-shellcheck
with:
path: ${{ runner.tool_cache }}/shellcheck
key: shellcheck-${{ runner.os }}-${{ env.SHELLCHECK_VERSION }}
- name: Download shellcheck
if: steps.cache-shellcheck.output.cache-hit != 'true'
run: |
version="${{ env.SHELLCHECK_VERSION }}"
baseurl="https://github.com/koalaman/shellcheck/releases/download"
curl -Lso "shellcheck.tar.xz" \
"${baseurl}/${version}/shellcheck-${version}.linux.x86_64.tar.xz"
mkdir -p "${{ runner.tool_cache }}/shellcheck/bin"
tar -xf shellcheck.tar.xz -C "${{ runner.tool_cache }}/shellcheck/bin"
- name: Add shellcheck to path
run: echo "${{ runner.tool_cache }}/shellcheck/bin" >> $GITHUB_PATH
- name: Run shellcheck
run: ci/shellcheck.sh
format:
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install wasi-sdk-20 (linux)"
run: |
set -x
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz
tar xf wasi-sdk-20.0-linux.tar.gz
sudo mkdir -p /opt/wasi-sdk
sudo mv wasi-sdk-20.0/* /opt/wasi-sdk/
ls /opt/wasi-sdk/
- run: |
/opt/wasi-sdk/bin/clang-format --version
ci/clang-format.sh
- run: |
ci/rustfmt.sh
- run: npm install
- run: npm run format:check
test-npm-package:
if: github.ref != 'refs/heads/main'
needs: [build]
strategy:
matrix:
node-version: [18, 22]
os: [
ubuntu-latest,
windows-latest,
macos-latest
]
exclude:
- os: macos-latest
node-version: 18
- os: windows-latest
node-version: 18
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Download Engine
uses: actions/download-artifact@v3
with:
name: fastly-release
- name: Download Engine
uses: actions/download-artifact@v3
with:
name: fastly-debug
- name: Download Engine
uses: actions/download-artifact@v3
with:
name: fastly-weval
- name: Download Engine Weval Cache
uses: actions/download-artifact@v3
with:
name: fastly-weval-ic-cache
- run: npm install
- run: npm test
build-debug:
name: Debug Build
needs: [ensure-cargo-installs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust 1.77.1
run: |
rustup toolchain install 1.77.1
rustup target add wasm32-wasi --toolchain 1.77.1
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
with:
path: "/home/runner/.cargo/bin/wasm-tools"
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
- name: Build with full debug info
run: npm run build:debug:info
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: fastly-debug
path: fastly.debug.wasm
build:
name: Build
needs: [ensure-cargo-installs]
runs-on: ubuntu-latest
strategy:
matrix:
profile: [release, weval]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust 1.77.1
run: |
rustup toolchain install 1.77.1
rustup target add wasm32-wasi --toolchain 1.77.1
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
with:
path: "/home/runner/.cargo/bin/wasm-tools"
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
- name: Build
if: matrix.profile == 'release'
run: npm run build
- name: Build
if: matrix.profile == 'weval'
run: npm run build:weval
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: fastly-${{ matrix.profile }}
path: fastly${{ matrix.profile == 'debug' && '.debug.wasm' || (matrix.profile == 'weval' && '-weval.wasm' || '.wasm') }}
- uses: actions/upload-artifact@v3
if: matrix.profile == 'weval'
with:
name: fastly-${{ matrix.profile }}-ic-cache
path: fastly-ics.wevalcache
run-wpt-debug:
if: github.ref != 'refs/heads/main'
name: Run Web Platform Tests Debug
needs: [build-debug, ensure-cargo-installs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: Download Engine
uses: actions/download-artifact@v3
with:
name: fastly-debug
- name: Restore Viceroy from cache
uses: actions/cache@v3
with:
path: "/home/runner/.cargo/bin/viceroy"
key: crate-cache-viceroy-${{ env.viceroy_version }}
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
with:
path: "/home/runner/.cargo/bin/wasm-tools"
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
- run: npm install
- name: Build WPT runtime
run: tests/wpt-harness/build-wpt-runtime.sh --debug-build
- name: Prepare WPT hosts
run: |
cd tests/wpt-harness/wpt
./wpt make-hosts-file | sudo tee -a /etc/hosts
- name: Run tests
timeout-minutes: 20
run: node ./tests/wpt-harness/run-wpt.mjs -vv
run-wpt:
strategy:
matrix:
profile: [release, weval]
if: github.ref != 'refs/heads/main'
name: Run Web Platform Tests
needs: [build, ensure-cargo-installs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: Download Engine
uses: actions/download-artifact@v3
with:
name: fastly-${{ matrix.profile }}
- name: Download Engine Weval Cache
if: matrix.profile == 'weval'
uses: actions/download-artifact@v3
with:
name: fastly-weval-ic-cache
- name: Restore Viceroy from cache
uses: actions/cache@v3
with:
path: "/home/runner/.cargo/bin/viceroy"
key: crate-cache-viceroy-${{ env.viceroy_version }}
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
with:
path: "/home/runner/.cargo/bin/wasm-tools"
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
- run: npm install
- name: Build WPT runtime
run: tests/wpt-harness/build-wpt-runtime.sh ${{matrix.profile == 'weval' && '--enable-experimental-aot' || matrix.profile == 'debug' && '--debug-build' || ''}}
- name: Prepare WPT hosts
run: |
cd tests/wpt-harness/wpt
./wpt make-hosts-file | sudo tee -a /etc/hosts
- name: Run tests
timeout-minutes: 20
run: node ./tests/wpt-harness/run-wpt.mjs -vv
sdktest:
concurrency:
group: ${{ github.head_ref }}--sdktest-${{matrix.profile}}-${{matrix.platform}}
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform: [viceroy, compute]
profile: [release, weval]
needs: [build, ensure-cargo-installs]
steps:
- name: Checkout fastly/js-compute-runtime
uses: actions/checkout@v3
with:
submodules: false
ref: ${{ github.head_ref || github.ref_name }}
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: Set up Fastly CLI
uses: fastly/compute-actions/setup@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
cli_version: ${{ env.fastly-cli_version }}
- name: Restore Viceroy from cache
if: matrix.platform == 'viceroy'
uses: actions/cache@v3
id: viceroy
with:
path: "/home/runner/.cargo/bin/viceroy"
key: crate-cache-viceroy-${{ env.viceroy_version }}
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
with:
path: "/home/runner/.cargo/bin/wasm-tools"
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
- name: Download Engine
uses: actions/download-artifact@v3
with:
name: fastly-${{ matrix.profile }}
- name: Download Engine (AOT weval cache)
uses: actions/download-artifact@v3
if: matrix.profile == 'weval'
with:
name: fastly-${{ matrix.profile }}-ic-cache
- name: Npm install
run: npm install && cd ./integration-tests/js-compute && npm install
- name: Run Tests
run: SUFFIX_STRING=${{matrix.profile}} node integration-tests/js-compute/test.js ${{ matrix.platform == 'viceroy' && '--local' || '' }} ${{ matrix.profile == 'weval' && '--aot' || '' }}
env:
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}
- name: Run TLA Tests
run: SUFFIX_STRING=${{matrix.profile}} node integration-tests/js-compute/test.js --tla ${{ matrix.platform == 'viceroy' && '--local' || '' }} ${{ matrix.profile == 'weval' && '--aot' || '' }}
env:
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}
sdktest-debug:
concurrency:
group: ${{ github.head_ref }}--sdktest-debug-${{matrix.platform}}
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform: [viceroy, compute]
needs: [build-debug, ensure-cargo-installs]
steps:
- name: Checkout fastly/js-compute-runtime
uses: actions/checkout@v3
with:
submodules: false
ref: ${{ github.head_ref || github.ref_name }}
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: Set up Fastly CLI
uses: fastly/compute-actions/setup@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
cli_version: ${{ env.fastly-cli_version }}
- name: Restore Viceroy from cache
if: matrix.platform == 'viceroy'
uses: actions/cache@v3
id: viceroy
with:
path: "/home/runner/.cargo/bin/viceroy"
key: crate-cache-viceroy-${{ env.viceroy_version }}
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
with:
path: "/home/runner/.cargo/bin/wasm-tools"
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
- name: Download Engine
uses: actions/download-artifact@v3
with:
name: fastly-debug
- name: Strip debug sections (compute only)
if: matrix.platform == 'compute'
run: wasm-tools strip fastly.debug.wasm -d ".debug_(info|loc|ranges|abbrev|line|str)" -o fastly.debug.wasm
- name: Npm install
run: npm install && cd ./integration-tests/js-compute && npm install
- name: Run Tests
run: SUFFIX_STRING=debug node integration-tests/js-compute/test.js --debug-build ${{ matrix.platform == 'viceroy' && '--local' || '' }}
env:
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}
- name: Run TLA Tests
run: SUFFIX_STRING=debug node integration-tests/js-compute/test.js --tla --debug-build ${{ matrix.platform == 'viceroy' && '--local' || '' }}
env:
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}