Skip to content

Commit

Permalink
Merge pull request #1098 from pact-foundation/upgrade-pact-js-core-pr…
Browse files Browse the repository at this point in the history
…ebuilds-ci

Upgrade pact js core prebuilds ci
  • Loading branch information
YOU54F committed Jul 10, 2023
2 parents 79d0f3a + dc0247b commit a8e53d9
Show file tree
Hide file tree
Showing 43 changed files with 9,986 additions and 29,729 deletions.
105 changes: 105 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
env:
ENABLE_FEATURE_V4: "true"
SKIP_EXAMPLES: "true"
LOG_LEVEL: info
GIT_COMMIT: ${{ github.sha }}
GIT_REF: ${{ github.ref }}

BUILD_TEST_TASK_TEMPLATE: &BUILD_TEST_TASK_TEMPLATE
arch_check_script:
- uname -am
# https://github.com/pact-foundation/pact_broker-client/blob/7edfd58c92fc234aa6aab647ef3b816a3553a412/lib/pact_broker/client/git.rb#L28-L30
# Update required for pact-broker-client to read CIRRUS env vars
# so that pact-broker publish --auto-detect-version-properties
# works correctly
pr_script: |
echo CIRRUS_PR=$CIRRUS_PR
echo CIRRUS_BASE_SHA=$CIRRUS_BASE_SHA
echo CIRRUS_BASE_BRANCH=$CIRRUS_BASE_BRANCH
echo CIRRUS_CHANGE_IN_REPO=$CIRRUS_CHANGE_IN_REPO
echo CIRRUS_BRANCH=$CIRRUS_BRANCH
echo GIT_SHA=$GIT_SHA
echo GIT_BRANCH=$GIT_BRANCH
if [ $CIRRUS_PR ]; then
echo "GIT_SHA=$CIRRUS_BASE_SHA" >> $CIRRUS_ENV
echo "GIT_BRANCH=$CIRRUS_BASE_BRANCH" >> $CIRRUS_ENV
else
echo "GIT_SHA=$CIRRUS_CHANGE_IN_REPO" >> $CIRRUS_ENV
echo "GIT_BRANCH=$CIRRUS_BRANCH" >> $CIRRUS_ENV
fi
pr_check_script: |
echo CIRRUS_PR=$CIRRUS_PR
echo CIRRUS_BASE_SHA=$CIRRUS_BASE_SHA
echo CIRRUS_BASE_BRANCH=$CIRRUS_BASE_BRANCH
echo CIRRUS_CHANGE_IN_REPO=$CIRRUS_CHANGE_IN_REPO
echo CIRRUS_BRANCH=$CIRRUS_BRANCH
echo GIT_SHA=$GIT_SHA
echo GIT_BRANCH=$GIT_BRANCH
build_script:
- node --version
- npx --yes absolute-version
- scripts/ci/build-and-test.sh
dist_setup_for_examples:
- SETUP_DIST_ONLY=true scripts/ci/test-examples.sh
# example_jest_script:
# - cd examples/jest && npm install --ignore-scripts && npm test
# example_mocha_script:
# - cd examples/mocha && npm install --ignore-scripts && npm test
example_e2e_script:
- cd examples/e2e && npm install --ignore-scripts && npm test
example_graphql_script:
- cd examples/graphql && npm install --ignore-scripts && npm test
example_messages_script:
- cd examples/messages && npm install --ignore-scripts && npm test
example_serverless_script:
- cd examples/serverless && npm install --ignore-scripts && npm test
example_typescript_script:
- cd examples/typescript && npm install --ignore-scripts && npm test
example_v3_e2e_script:
- cd examples/v3/e2e && npm install --ignore-scripts && npm test
example_v3_provider-state-injected_script:
- cd examples/v3/provider-state-injected && npm install --ignore-scripts && npm test
example_v3_run-specific-verifications_script:
- cd examples/v3/run-specific-verifications && npm install --ignore-scripts && npm test
example_v3_todo-consumer_script:
- cd examples/v3/todo-consumer && npm install --ignore-scripts && npm test
example_v3_typescript_script:
- cd examples/v3/typescript && npm install --ignore-scripts && npm test
example_v4_plugins_script:
- cd examples/v4/plugins && npm install --ignore-scripts && npm test

linux_arm_task:
arm_container:
matrix:
# - image: node:slim
- image: node:20.2-slim # https://github.com/nodejs/docker-node/issues/1912
- image: node:18-slim
- image: node:16-slim
cpu: 4
memory: 12G
setup_script:
- apt update --yes && apt install --yes jq git curl
<< : *BUILD_TEST_TASK_TEMPLATE

macos_arm_task:
env:
CIRRUS_SHELL: zsh
NVM_DIR: "$HOME/.nvm"
matrix:
NODE_VERSION: 20
NODE_VERSION: 18
NODE_VERSION: 16
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
setup_node_script: |
if [ "$NODE_VERSION" != "20" ]; then
brew uninstall node
rm '/opt/homebrew/bin/npm'
rm '/opt/homebrew/bin/npx'
rm -rf '/opt/homebrew/lib/node_modules'
brew install node@$NODE_VERSION
brew link node@$NODE_VERSION
fi
node --version
find . -name '*.sh' -exec chmod +x {} \;
<< : *BUILD_TEST_TASK_TEMPLATE
116 changes: 82 additions & 34 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ env:
LOG_LEVEL: info

jobs:
build-and-test-ubuntu:
runs-on: ubuntu-latest
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x, 20.x]
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v3
Expand All @@ -27,50 +29,96 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: scripts/ci/build-and-test.sh
env:
NODE_VERSION: ${{ matrix.node-version }}

build-and-test-windows:
runs-on: windows-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Fix node-gyp
run: |-
npm install --global node-gyp@latest
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
shell: pwsh
- run: bash scripts/ci/build-and-test.sh
shell: bash
env:
NODE_VERSION: ${{ matrix.node-version }}
SKIP_EXAMPLES: true
- run: scripts/ci/test-examples.sh
shell: bash
env:
SETUP_DIST_ONLY: true

## require jest-pact and mocha-pact to update peer deps
# - name: example_mocha
# run: cd examples/mocha && npm install --ignore-scripts && npm test
# - name: example_jest
# run: cd examples/jest && npm install --ignore-scripts && npm test


# passing
- name: example_e2e
run: cd examples/e2e && npm install --ignore-scripts && npm test
- name: example_graphql
run: cd examples/graphql && npm install --ignore-scripts && npm test
- name: example_messages
run: cd examples/messages && npm install --ignore-scripts && npm test
- name: example_serverless
run: cd examples/serverless && npm install --ignore-scripts && npm test
- name: example_typescript
run: cd examples/typescript && npm install --ignore-scripts && npm test
- name: example_v3_e2e
run: cd examples/v3/e2e && npm install --ignore-scripts && npm test
- name: example_v3_provider-state-injected
run: cd examples/v3/provider-state-injected && npm install --ignore-scripts && npm test
- name: example_v3_run-specific-verifications
run: cd examples/v3/run-specific-verifications && npm install --ignore-scripts && npm test
- name: example_v3_todo-consumer
run: cd examples/v3/todo-consumer && npm install --ignore-scripts && npm test
- name: example_v3_typescript
run: cd examples/v3/typescript && npm install --ignore-scripts && npm test
- name: example_v4_plugins
run: cd examples/v4/plugins && npm install --ignore-scripts && npm test
# - name: Upload dist folder
# if: runner.os == 'Linux'
# uses: actions/upload-artifact@v3
# with:
# path: dist

# Failures not reproducible locally on an M1 Mac
# build-and-test-macos:
# runs-on: macos-latest
# examples:
# needs: [build-and-test]
# strategy:
# matrix:
# node-version: [14.x, 16.x, 18.x]
# node-version: [16,18,20]
# os: [macos-latest, ubuntu-latest, windows-latest]
# example:
# [
# e2e,
# graphql,
# jest, # requires jest-pact updating
# messages,
# mocha, # requires mocha-pact updating
# serverless,
# typescript,
# v3/e2e,
# v3/provider-state-injected,
# v3/run-specific-verifications,
# v3/todo-consumer,
# v3/typescript,
# v4/plugins,
# ]
# fail-fast: false
# runs-on: ${{ matrix.os }}

# steps:
# - uses: actions/checkout@v2
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Download dist folder
# uses: actions/download-artifact@v3
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v3
# with:
# node-version: ${{ matrix.node-version }}
# - run: scripts/ci/build-and-test.sh
# - run: scripts/ci/test-examples.sh
# shell: bash
# env:
# NODE_VERSION: ${{ matrix.node-version }}
# SETUP_DIST_ONLY: true
# if: matrix.example != 'jest' || matrix.example != 'mocha'
# - run: bash scripts/install-plugins.sh
# if: matrix.example == 'v4/plugins'
# - name: run example ${{ matrix.example }}
# run: |
# npm install --ignore-scripts
# npm test
# shell: bash
# working-directory: examples/${{ matrix.example }}
Loading

0 comments on commit a8e53d9

Please sign in to comment.