Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow #1902

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: CI/CD

on:
push:
branches:
- main
- beta
pull_request:
workflow_dispatch:
inputs:
node-version:
description: Comma-separated list of Node.js versions
required: true
default: '16, 18, 20'
test-browsers:
description: 'Comma-separated list of browsers'
required: true
default: 'ChromeHeadlessNoSandbox,FirefoxHeadless,sl_edge,sl_safari,sl_ios_safari,bs_android_chrome'

jobs:
build:
name: Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest

# Most pipelines finish in under 15 minutes.
timeout-minutes: 30

strategy:
fail-fast: false
matrix:
# Use the input, or fallback to the array.
node-version: ${{ fromJSON(format('[{0}]', inputs.node-version || '16, 18, 20')) }}

steps:
- uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install dependencies
run: npm ci

- name: Run tests
run: |
# Use X Virtual Frame Buffer (xvfb) to run headless in CI
xvfb-run --auto-servernum --server-args='-screen 0, 1920x1080x24' npm test
env:
BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
TEST_BROWSERS: ${{ inputs.test-browsers || 'ChromeHeadlessNoSandbox,FirefoxHeadless,sl_edge,sl_safari,sl_ios_safari,bs_android_chrome' }}

- name: Save npm-tarball.tgz
if: always()
uses: actions/upload-artifact@v4
with:
name: 'node-v${{ matrix.node-version }}-npm-tarball.tgz'
path: 'isomorphic-git-0.0.0-development.tgz'

- name: 'Save index.umd.min.js'
if: always()
uses: actions/upload-artifact@v4
with:
name: 'node-v${{ matrix.node-version }}-index.umd.min.js'
path: 'index.umd.min.js'

- name: 'Publish to npm'
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' }}
run: npm run semantic-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: 'Update website'
if: ${{ github.ref == 'refs/heads/main' }}
run: npm run publish-website
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.20.2
2 changes: 0 additions & 2 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ branches:
prerelease: true
success:
- '@semantic-release/github'
- path: '@semantic-release/exec'
cmd: "node __tests__/__helpers__/tweet.cjs 'v${nextRelease.version} has been published! https://github.com/isomorphic-git/isomorphic-git/releases/tag/v${nextRelease.version}'"
20 changes: 0 additions & 20 deletions __tests__/__helpers__/tweet.cjs

This file was deleted.

28 changes: 14 additions & 14 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ jobs:
artifactName: 'index.umd.min.js'
PathtoPublish: '$(System.DefaultWorkingDirectory)/index.umd.min.js'

- script: npm run semantic-release
displayName: 'Publish to npm'
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq(variables['Build.SourceBranch'], 'refs/heads/beta')))
env:
GH_TOKEN: $(GITHUB_TOKEN)
NPM_TOKEN: $(Npm.Token)
TWITTER_ACCESS_TOKEN_SECRET: $(TWITTER_ACCESS_TOKEN_SECRET)
TWITTER_CONSUMER_SECRET: $(TWITTER_CONSUMER_SECRET)
# - script: npm run semantic-release
# displayName: 'Publish to npm'
# condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq(variables['Build.SourceBranch'], 'refs/heads/beta')))
# env:
# GH_TOKEN: $(GITHUB_TOKEN)
# NPM_TOKEN: $(Npm.Token)
# TWITTER_ACCESS_TOKEN_SECRET: $(TWITTER_ACCESS_TOKEN_SECRET)
# TWITTER_CONSUMER_SECRET: $(TWITTER_CONSUMER_SECRET)

- script: npm run publish-website
displayName: 'Update website'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
NPM_TOKEN: $(Npm.Token)
# - script: npm run publish-website
# displayName: 'Update website'
# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
# env:
# GITHUB_TOKEN: $(GITHUB_TOKEN)
# NPM_TOKEN: $(Npm.Token)
47 changes: 10 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 14 additions & 6 deletions package-scripts.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ const optional = cmd =>
const timeout = n => cmd => `timeout -t ${n}m -- ${cmd}`
const timeout5 = timeout(5)

// Node.js v17 restricted the use of certain OpenSSL algorithms and key sizes.
// See https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V17.md#2021-10-19-version-1700-current-bethgriggs.
//
// To use Webpack v4 with Node >= 17 we must use set NODE_OPTIONS=--openssl-legacy-provider.
const NODE_MAJOR_VERSION = Number(process.versions.node.split('.')[0])
let NODE_OPTIONS = process.env.NODE_OPTIONS || '';
if (NODE_MAJOR_VERSION >= 17) {
NODE_OPTIONS += `${process.env.NODE_OPTIONS ? ' ' : ''}--openssl-legacy-provider`;
}

module.exports = {
scripts: {
clean: {
Expand Down Expand Up @@ -58,7 +68,7 @@ module.exports = {
rollup: 'rollup -c --no-treeshake',
typings:
'tsc -p declaration.tsconfig.json && cp index.d.ts index.umd.min.d.ts',
webpack: 'webpack --config webpack.config.cjs',
webpack: `cross-env NODE_OPTIONS=${NODE_OPTIONS} webpack --config webpack.config.cjs`,
indexjson: `node __tests__/__helpers__/make_http_index.cjs`,
treeshake: 'agadoo',
docs: 'node ./__tests__/__helpers__/generate-docs.cjs',
Expand Down Expand Up @@ -133,12 +143,10 @@ module.exports = {
typecheck: 'tsc -p tsconfig.json',
setup: series.nps('proxy.start', 'gitserver.start'),
teardown: series.nps('proxy.stop', 'gitserver.stop'),
jest: process.env.CI
? retry3(`${timeout5('jest --ci --coverage')}`)
: `jest --ci --coverage`,
jest: `jest --ci --coverage`,
karma: process.env.CI
? retry3('karma start ./karma.conf.cjs --single-run')
: 'cross-env karma start ./karma.conf.cjs --single-run -log-level debug',
? retry3(`cross-env NODE_OPTIONS=${NODE_OPTIONS} karma start ./karma.conf.cjs --single-run`)
: 'cross-env NODE_OPTIONS=${NODE_OPTIONS} karma start ./karma.conf.cjs --single-run -log-level debug',
karmore: 'cross-env TEST_NO_BROWSERS=1 karma start --no-single-run',
},
prepublish: {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@
"semantic-release": "17.4.7",
"standard": "13.1.0",
"timeout-cli": "0.3.2",
"tweet-tweet": "1.0.4",
"typescript": "3.9.0-dev.20200223",
"webpack": "4.41.5",
"webpack-bundle-analyzer": "3.4.1",
Expand Down
Loading