Tests #1036
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'Release' | |
required: true | |
default: 'true' | |
new_version: | |
description: 'New version' | |
required: true | |
default: 'one of <newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease' | |
jobs: | |
ci: | |
strategy: | |
matrix: | |
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 18.x | |
- run: git config --global core.autocrlf false | |
- uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.CI_PAT || github.token }} | |
- run: git config --global user.email "mail@felix.at" | |
- run: git config --global user.name "Felix (GitHub Action)" | |
- uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} | |
- run: npm ci | |
- run: npm run build | |
- if: ${{ matrix.os != 'macos-latest' && matrix.os != 'windows-latest' }} | |
run: | | |
timeout 0.2s time ./bin/attranslate --version | |
timeout 0.2s time ./bin/attranslate --help | |
- if: ${{ matrix.os != 'windows-latest' }} | |
run: npm run test | |
- if: ${{ matrix.os == 'windows-latest' }} | |
run: npm run test:windows | |
- run: git diff --exit-code | |
- name: Release | |
if: ${{ github.event.inputs.release == 'true' && matrix.os == 'ubuntu-latest' }} | |
run: | | |
npm version ${{ github.event.inputs.new_version }} --git-tag-version=true | |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | |
npm publish | |
git push origin && git push origin --tags | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
production_install: | |
strategy: | |
matrix: | |
node: [ '16', '18' ] | |
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node }} | |
- run: node --version | |
- run: npm install --global attranslate | |
- run: attranslate --help | |
- run: attranslate --version |