Skip to content

Commit

Permalink
wrangle some github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeseda committed Jan 26, 2024
1 parent d38854b commit af06b70
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 125 deletions.
77 changes: 33 additions & 44 deletions .github/workflows/binary-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,51 +15,40 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [ 18.x ]
os: [ windows-latest, ubuntu-latest, macOS-latest, self-hosted ]

# Go
steps:
- name: Check out repo
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Env
run: |
echo "Event name: ${{ github.event_name }}"
echo "Git ref: ${{ github.ref }}"
echo "GH actor: ${{ github.actor }}"
echo "SHA: ${{ github.sha }}"
VER=`node --version`; echo "Node ver: $VER"
VER=`npm --version`; echo "npm ver: $VER"
- name: Install Globals
run: npm install -g @enhance/arc-plugin-enhance

- name: Install
run: npm install

- name: Build
run: npm run build
env:
BUILD_ALL: false

- name: Test
run: npm run test:integration
env:
BINARY_ONLY: true
CI: true

- name: Notify
uses: homoluctus/slatify@master
if: github.ref == 'refs/heads/main' && failure()
with:
type: ${{ job.status }}
job_name: '*Test*'
url: ${{ secrets.SLACK_WEBHOOK }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check out repo
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Env
run: |
echo "Event name: ${{ github.event_name }}"
echo "Git ref: ${{ github.ref }}"
echo "GH actor: ${{ github.actor }}"
echo "SHA: ${{ github.sha }}"
VER=`node --version`; echo "Node ver: $VER"
VER=`npm --version`; echo "npm ver: $VER"
- name: Install Globals
run: npm install -g @enhance/arc-plugin-enhance

- name: Install
run: npm install

- name: Build
run: npm run build
env:
BUILD_ALL: false

- name: Test
run: npm run test:integration
env:
BINARY_ONLY: true
CI: true
76 changes: 28 additions & 48 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,33 @@ jobs:

# Go
steps:
- name: Check out repo
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Env
run: |
echo "Event name: ${{ github.event_name }}"
echo "Git ref: ${{ github.ref }}"
echo "GH actor: ${{ github.actor }}"
echo "SHA: ${{ github.sha }}"
VER=`node --version`; echo "Node ver: $VER"
VER=`npm --version`; echo "npm ver: $VER"
- name: Check out repo
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Env
run: |
echo "Event name: ${{ github.event_name }}"
echo "Git ref: ${{ github.ref }}"
echo "GH actor: ${{ github.actor }}"
echo "SHA: ${{ github.sha }}"
VER=`node --version`; echo "Node ver: $VER"
VER=`npm --version`; echo "npm ver: $VER"
- name: Install Globals
run: npm install -g @enhance/arc-plugin-enhance

- name: Install
run: npm install

- name: Test
run: npm test
env:
CI: true

- name: Notify
uses: homoluctus/slatify@master
if: github.ref == 'refs/heads/main' && failure()
with:
type: ${{ job.status }}
job_name: '*Test*'
url: ${{ secrets.SLACK_WEBHOOK }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Globals
run: npm install -g @enhance/arc-plugin-enhance

- name: Install
run: npm install

- name: Test
run: npm test
env:
CI: true

# ----- Only git tag testing + release deployment beyond this point ----- #

Expand Down Expand Up @@ -87,7 +76,7 @@ jobs:

- name: Publish 'latest' (aka production) build
if: startsWith(github.ref, 'refs/tags/v')
run: npm run publish
run: npm run publish-binary
env:
DEPLOY: prod
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -98,7 +87,7 @@ jobs:

- name: Publish 'main' (aka canary) build
if: github.ref == 'refs/heads/main'
run: npm run publish
run: npm run publish-binary
env:
DEPLOY: main
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -147,12 +136,3 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CF_DISTRO: ${{ secrets.CF_DISTRO }}
LATEST_API: ${{ secrets.LATEST_API }}

- name: Notify
uses: homoluctus/slatify@master
with:
type: ${{ job.status }}
job_name: '*Deploy*'
url: ${{ secrets.SLACK_WEBHOOK }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}
49 changes: 49 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish to NPM

on: [ push, pull_request ]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [ 16, 18, 20 ]
os: [ windows-latest, ubuntu-latest, macOS-latest ]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- run: npm install

- name: test
run: npm run test:module

publish:
needs: test
if: startsWith(github.ref, 'refs/tags/v') ||
github.ref == 'refs/heads/main'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: lts/*
registry-url: https://registry.npmjs.org/

- name: Publish @RC to npm
if: contains(github.ref, 'RC')
run: npm publish --tag RC
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish @latest to npm
if: contains(github.ref, 'RC') == false
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
32 changes: 0 additions & 32 deletions .github/workflows/publish-now.yml

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
"test:unit": "cross-env tape 'test/unit/**/*-test.js' | tap-arc",
"test:integration": "cross-env NODE_ENV=testing tape 'test/integration/**/*-test.js' | tap-arc",
"test:integration:slow": "cross-env NODE_ENV=testing tape 'test/integration/**/*-test-slow.js' | tap-arc",
"test:module": "MODULE_ONLY=true npm run test",
"coverage": "nyc --reporter=lcov --reporter=text npm run test:unit",
"lint": "eslint . --fix",
"build": "cross-env scripts/binary-config && npx pkg scripts --compress GZip && rm -f commit",
"publish": "BUILD_ALL=true npm run build && scripts/publish",
"publish-binary": "BUILD_ALL=true npm run build && scripts/publish",
"deploy": "scripts/deploy"
},
"license": "Apache-2.0",
Expand Down

0 comments on commit af06b70

Please sign in to comment.