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

Feature/migrate to gh actions #44

Merged
merged 4 commits into from
Nov 19, 2022
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
138 changes: 138 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# This is a Github Workflow that runs tests on any push or pull request.
# If the tests pass and this is a push to the master branch it also runs Semantic Release.
name: CI
on: [push, pull_request]
jobs:
build:
name: build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Fetch deps
run: yarn

- name: Build target
run: yarn build

- name: Save artifact
uses: actions/upload-artifact@v3
with:
name: artifact-${{ github.run_id }}
retention-days: 1
path: |
docs
target
flow-typed
typings
buildstamp.json
package.json

test_push:
needs: build
if: github.event_name == 'push'
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Restore artifact
uses: actions/download-artifact@v3
with:
name: artifact-${{ github.run_id }}

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Yarn install
run: |
sudo apt-get install -y moreutils
yarn

- name: Unit tests
run: yarn test

- name: Update coverage
if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v3
with:
name: artifact-${{ github.run_id }}
retention-days: 1
path: |
coverage
.nyc_output

test_pr:
if: github.event_name == 'pull_request'
needs: build
strategy:
matrix:
os: [ ubuntu-22.04 ]
node-version: [ 14, 18 ]
name: Test (Node v${{ matrix.node-version }}, OS ${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Restore artifact
uses: actions/download-artifact@v3
with:
name: artifact-${{ github.run_id }}

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn
- name: Test only
if: matrix.node-version != '18' || matrix.os != 'ubuntu-22.04'
run: yarn test

- name: Test & push coverage
if: matrix.node-version == '18' && matrix.os == 'ubuntu-22.04'
run: yarn test

release:
name: Release
# https://github.uint.cloudmunity/t/trigger-job-on-tag-push-only/18076
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: test_push
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false

- name: Restore artifact
uses: actions/download-artifact@v3
with:
name: artifact-${{ github.run_id }}

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Codeclimate
uses: paambaati/codeclimate-action@v3.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
${{github.workspace}}/coverage/lcov.info:lcov

- name: Release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GIT_COMMITTER_EMAIL: 'opensource@qiwi.com'
GIT_COMMITTER_NAME: 'qiwibot'
run: npm_config_yes=true npx zx-semrel
67 changes: 67 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: "41 17 * * 4"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
File renamed without changes.
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test": "npm-run-all -p -l lint test:unit test:depcheck test:depaudit",
"test:unit": "jest --config=jest.config.json --runInBand",
"test:deps": "npm-run-all -p -l test:depcheck test:depauditfix",
"test:depcheck": "npx depcheck --ignores tslib,@swissquote/crafty-preset-jest,@types/jest,@types/node",
"test:depcheck": "npx depcheck --ignores tslib,@swissquote/crafty-preset-jest,@types/jest,typedoc,@types/node",
"test:depaudit": "yarn audit --level=moderate; [[ $? -ge 4 ]] && exit 1 || exit 0",
"test:depauditfix": "npx yarn-audit-fix --audit-level=moderate",
"test:report": "yarn test && yarn push:report",
Expand Down Expand Up @@ -53,26 +53,26 @@
"author": "Anton Golub <a.golub@qiwi.com>",
"license": "MIT",
"devDependencies": {
"@qiwi/libdefkit": "^2.1.6",
"@qiwi/npm-run-all": "^4.1.6",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.33",
"coveralls": "^3.1.0",
"jest": "^26.6.3",
"microbundle": "^0.13.0",
"@qiwi/libdefkit": "^4.0.8",
"@qiwi/npm-run-all": "^4.1.7",
"@types/jest": "^29.2.2",
"@types/node": "^18.11.9",
"coveralls": "^3.1.1",
"jest": "^29.2.2",
"microbundle": "^0.15.1",
"mkdirp": "^1.0.4",
"rimraf": "^3.0.2",
"terser": "^5.6.0",
"cpy-cli": "^3.1.1",
"eslint": "^7.21.0",
"eslint-config-prettier": "^8.1.0",
"eslint-config-qiwi": "^1.10.7",
"typedoc": "^0.20.30",
"typescript": "4.2.4",
"ts-jest": "^26.5.3"
"terser": "^5.15.1",
"cpy-cli": "^4.2.0",
"eslint": "^8.27.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-qiwi": "^1.17.8",
"typedoc": "^0.23.20",
"typescript": "4.8.4",
"ts-jest": "^29.0.3"
},
"dependencies": {
"tslib": "^2.1.0",
"@qiwi/substrate": "^1.20.4"
"tslib": "^2.4.1",
"@qiwi/substrate": "^1.20.15"
}
}
2 changes: 1 addition & 1 deletion typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"excludePrivate": false,
"hideGenerator": true,
"readme": "README.md",
"theme": "minimal",
"theme": "default",
"tsconfig": "./tsconfig.es5.json"
}
Loading