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

chore: Add workflows #123

Merged
merged 1 commit into from
Oct 18, 2024
Merged
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
32 changes: 32 additions & 0 deletions .github/workflows/mobx-devtools-mst-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish mobx-devtools-mst

on:
push:
paths: [ "packages/mobx-devtools-mst/**", ".github/**" ]
branches: [ "master" ]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm run bootstrap
- name: Resolve new package version & Publish
working-directory: ./packages/mobx-devtools-mst
run: |
NAME=$(node -p "require('./package.json').name")
VERSION=$(node -p "require('./package.json').version")
export LATEST=$(npm show "$NAME@$VERSION" version --json)
NEXT=$(node -p "JSON.parse(process.env.LATEST).split('.').map((n, i) => i === 2 ? ++n : n).join('.')")
echo "NEXT: $NEXT"
npm version $NEXT --git-tag-version false
npm run build
cat ./package.json
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release

on: workflow_dispatch

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 17
registry-url: https://registry.npmjs.org/
- run: npm run bootstrap
- run: npm run build
- run: |
TAG=$(echo $TAG | cut -c1-8)
gh release create "$TAG" \
--repo="$GITHUB_REPOSITORY" \
--title="${TAG#v}" \
--generate-notes \
./lib/*.zip
env:
TAG: ${{ github.event.pull_request.head.sha || github.sha }}
GH_TOKEN: ${{ github.token }}
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 17
registry-url: https://registry.npmjs.org/
- run: npm run bootstrap
- run: npm run lint
- run: npm run build
- run: npm run test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build:chrome": "cross-env NODE_ENV=production cross-env NODE_OPTIONS='--openssl-legacy-provider' TARGET_BROWSER=chrome node scripts/webextension/build.js && echo 'Chrome built'",
"start:firefox": "cross-env NODE_ENV=development cross-env TARGET_BROWSER=firefox NODE_OPTIONS='--openssl-legacy-provider' node scripts/webextension/dev-server.js",
"build:firefox": "cross-env NODE_ENV=production TARGET_BROWSER=firefox NODE_OPTIONS='--openssl-legacy-provider' node scripts/webextension/build.js",
"test": "npm run test:unit ; npm run test:e2e",
"test": "npm run test:unit",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e2e tests are broken, excluded them from running in CI

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andykog - I think only Firefox e2e is broken. Maybe worthwhile to change this to test:e2e:chrome to at least run something.

Those tests don't do much, so I don't feel very strongly about it one way or another.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason chrome seems to hang: https://github.com/mobxjs/mobx-devtools/actions/runs/11405976300/job/31738662591
Maybe there's some problem with the invironment
Merging like this for now

"test:unit": "cross-env NODE_ENV=test NODE_OPTIONS='--openssl-legacy-provider' mocha --require 'babel-core/register' 'src/**/*-test.js'",
"test:e2e": "npm run test:e2e:chrome",
"test:e2e:chrome": "cross-env NODE_ENV=test TARGET_BROWSER=chrome NODE_OPTIONS='--openssl-legacy-provider' node scripts/webextension/build.js && npm run test:e2e:chrome:now",
Expand Down
Loading