Merge pull request #58 from DomainDrivenArchitecture/improve_build

Improve build
This commit is contained in:
Dmitri Sotnikov 2020-07-13 14:15:00 -04:00 committed by GitHub
commit 8b4a0750d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 88 deletions

View file

@ -1,11 +1,11 @@
name: release prod name: stable
on: on:
push: push:
tags: '[0-9]+.[0-9]+.[0-9]+*' tags: '[0-9]+.[0-9]+.[0-9]+*'
jobs: jobs:
test-matrix: stable:
name: matrix test name: stable
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
@ -13,19 +13,6 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 uses: actions/setup-node@v1
@ -44,6 +31,7 @@ jobs:
chmod a+x mastodon-bot.js chmod a+x mastodon-bot.js
sha256sum mastodon-bot.js > target/mastodon-bot.js.sha256 sha256sum mastodon-bot.js > target/mastodon-bot.js.sha256
sha512sum mastodon-bot.js > target/mastodon-bot.js.sha512 sha512sum mastodon-bot.js > target/mastodon-bot.js.sha512
shadow-cljs run shadow.cljs.build-report app target/build-report.html
- name: Create Release - name: Create Release
id: create_release id: create_release
@ -65,7 +53,7 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./mastodon-bot.js asset_path: ./mastodon-bot.js
asset_name: mastodon-bot.js asset_name: mastodon-bot.js
asset_content_type: application/json asset_content_type: application/javascript
- name: Upload mastodon-bot.js.sha256 - name: Upload mastodon-bot.js.sha256
id: upload-mastodon-bot-js-sha256 id: upload-mastodon-bot-js-sha256
@ -76,7 +64,7 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/mastodon-bot.js.sha256 asset_path: ./target/mastodon-bot.js.sha256
asset_name: mastodon-bot.js.sha256 asset_name: mastodon-bot.js.sha256
asset_content_type: application/json asset_content_type: text/plain
- name: Upload mastodon-bot.js.sha512 - name: Upload mastodon-bot.js.sha512
id: upload-mastodon-bot-js-sha512 id: upload-mastodon-bot-js-sha512
@ -87,7 +75,18 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/mastodon-bot.js.sha512 asset_path: ./target/mastodon-bot.js.sha512
asset_name: mastodon-bot.js.sha512 asset_name: mastodon-bot.js.sha512
asset_content_type: application/json asset_content_type: text/plain
- name: Upload build-report
id: build-report
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/build-report
asset_name: build-report.html
asset_content_type: text/html
- name: upload to npm - name: upload to npm
env: env:
@ -99,4 +98,4 @@ jobs:
cp target/mastodon-bot.js.sha512 target/npm-build/mastodon_bot/ cp target/mastodon-bot.js.sha512 target/npm-build/mastodon_bot/
cp package.json target/npm-build/mastodon_bot/ cp package.json target/npm-build/mastodon_bot/
cp README.md target/npm-build/mastodon_bot/ cp README.md target/npm-build/mastodon_bot/
npm publish ./target/npm-build --access public --dry-run npm publish ./target/npm-build --access public

View file

@ -1,42 +0,0 @@
name: test PR
on:
pull_request:
branches: [ master ]
push:
ingnored-branches: [ 'master' ]
jobs:
test-matrix:
name: matrix test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: /usr/lib/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: test em
run: |
npm install
npm install -g --save-dev shadow-cljs
shadow-cljs compile test

View file

@ -2,44 +2,36 @@
## dev release ## dev release
``` ```
# run the tests
shadow-cljs compile test shadow-cljs compile test
# release the app
shadow-cljs release app shadow-cljs release app
chmod a+x mastodon-bot.js chmod a+x mastodon-bot.js
rm -rf target/npm-build
mkdir target/npm-build
cp mastodon-bot.js target/npm-build
cp package.json target/npm-build
cp README.md target/npm-build
# publish to npm
mkdir -p target/npm-build/mastodon_bot
cp mastodon-bot.js target/npm-build/mastodon_bot/
cp target/mastodon-bot.js.sha256 target/npm-build/mastodon_bot/
cp target/mastodon-bot.js.sha512 target/npm-build/mastodon_bot/
cp package.json target/npm-build/mastodon_bot/
cp README.md target/npm-build/mastodon_bot/
npm publish ./target/npm-build --access public npm publish ./target/npm-build --access public
``` ```
## prod release (should be done from master) ## stable release (should be done from master)
``` ```
shadow-cljs compile test shadow-cljs compile test
#adjust version #adjust [version]
vi shadow-cljs.edn vi package.json
git commit -am "releasing" git commit -am "releasing"
git tag [version] git commit -am [version]
git push && git push --tag git push --follow-tags
shadow-cljs release app # Bump [version]
vi package.json
shadow-cljs release app
chmod a+x mastodon-bot.js
rm -rf target/npm-build
mkdir target/npm-build
cp mastodon-bot.js target/npm-build
cp package.json target/npm-build
cp README.md target/npm-build
npm publish ./target/npm-build --access public
# Bump version
vi shadow-cljs.edn
git commit -am "version bump" && git push git commit -am "version bump" && git push
``` ```

View file

@ -8,5 +8,4 @@
:repl-pprint true} :repl-pprint true}
:app {:target :node-script :app {:target :node-script
:output-to "mastodon-bot.js" :output-to "mastodon-bot.js"
:main mastodon-bot.core/main :main mastodon-bot.core/main}}}
:compiler-options {:optimizations :simple}}}}