Migrate from travis to github actions

This commit is contained in:
Slava Bacherikov 2022-02-10 12:58:59 +02:00
parent e745165cbb
commit da4fd08c3f
6 changed files with 103 additions and 47 deletions

43
.github/workflows/build-test.yml vendored Normal file
View file

@ -0,0 +1,43 @@
name: Tests
on:
push:
branches: [main]
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup node 14
uses: actions/setup-node@v2
with:
node-version: '14'
cache: npm
- name: Node checks
run: |
npm ci
npm test
npm run lint
- name: Install browsers
env:
DEBIAN_FRONTEND: noninteractive
TZ: Etc/UTC
run: |
sudo apt-get update -q -y
sudo apt-get install -q -y chromium-chromedriver firefoxdriver
- name: Run browser tests
run: npm run browser-test
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

54
.github/workflows/deploy.yml vendored Normal file
View file

@ -0,0 +1,54 @@
name: Deploy
on:
workflow_dispatch:
workflow_run:
workflows: ["Tests"]
branches: [main]
types: [completed]
jobs:
staging-deploy:
name: Deploy to beta.bios-pw.org
if: ${{ github.event.workflow_run.conclusion == 'success' }} || ${{ github.event.workflow_dispatch.sender.site_admin == true }}
runs-on: ubuntu-latest
concurrency: beta
environment:
name: beta
url: https://beta.bios-pw.org/
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: ./ci/requirements.txt
- name: Install boto3
run: pip install -r ./ci/requirements.txt
- name: Setup node 14
uses: actions/setup-node@v2
with:
node-version: '14'
cache: npm
- name: Build scripts and assets
run: |
npm ci
npm run build-stage
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Upload assets to S3
run: ./ci/deploy.py ./dist/ beta.bios-pw.org

View file

@ -1,34 +0,0 @@
sudo: false
dist: trusty
language: node_js
node_js:
- '14'
env:
matrix:
- SAUCE=true
addons:
chrome: stable
firefox: latest
apt:
packages:
- python3-pip
script:
- npm test
- npm run browser-test
- npm run lint
after_sucess:
- cat coverage/lcov.info | ./node_modules/.bin/coveralls
git:
depth: 1
submodules: false
cache:
directories:
- node_modules
before_deploy:
- npm run build-stage
deploy:
skip_cleanup: true
provider: script
script: ci/travis_deploy.sh
on:
branch: master

View file

@ -1,6 +1,6 @@
Password generator for BIOS
================================
[![travis status][build-status]][travis]
[![github actions status][build-status]][tests]
[![coverage here][coverage-status]][coverage]
[![tested-browsers][sauce-matrix]][sauce-link]
@ -36,8 +36,8 @@ Latest released version available [here][bios-pw] and latest testing version (*s
* hpgl — for dell generator
* [let-def](https://github.com/let-def) — for Acer Insyde 10 digit
[build-status]: https://api.travis-ci.org/bacher09/pwgen-for-bios.svg?branch=master
[travis]: https://travis-ci.org/bacher09/pwgen-for-bios
[build-status]: https://github.com/bacher09/pwgen-for-bios/actions/workflows/build-test.yml/badge.svg
[tests]: https://github.com/bacher09/pwgen-for-bios/actions/workflows/build-test.yml
[coverage-status]: https://coveralls.io/repos/github/bacher09/pwgen-for-bios/badge.svg?branch=master
[coverage]: https://coveralls.io/github/bacher09/pwgen-for-bios?branch=master
[sauce-matrix]: https://saucelabs.com/browser-matrix/bacher09.svg

1
ci/requirements.txt Normal file
View file

@ -0,0 +1 @@
boto3==1.20.52

View file

@ -3,19 +3,11 @@ const path = require("path");
module.exports = function(config) {
var customLaunchers = {
sl_ios_safari: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'iOS',
deviceName: 'iPhone 7 Simulator',
version: '10.3',
deviceOrientation: 'portrait'
},
sl_safari_7: {
base: "SauceLabs",
browserName: "safari",
platform: "OS X 10.11",
version: "10.0"
platform: "OS X 10.12",
version: "11.0"
},
sl_edge_13: {
base: "SauceLabs",