Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

Commit

Permalink
Fix tests (#24)
Browse files Browse the repository at this point in the history
* Fix tests

* test naming
  • Loading branch information
pperzyna committed Mar 12, 2021
1 parent 9d73a3d commit d7d3135
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 48 deletions.
54 changes: 34 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,50 @@
name: CI

on:
on:
workflow_dispatch:
push:

env:
IMAGE_NAME: alpine:3.10.1

jobs:
test:
name: Test unit
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2.3.4

- name: Install dependencies
run: yarn install

- name: Jest
run: yarn run test

test1:
name: Test for with parameter
name: Test not to create issue
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2.3.4

- name: Install dependencies
run: yarn install
- name: Install dependencies
run: yarn install

- name: Build
run: yarn run build
- name: Build
run: yarn run build

- name: Pull docker image
run: docker pull ${{ env.IMAGE_NAME }}
- name: Pull docker image
run: docker pull ${{ env.IMAGE_NAME }}

- uses: ./
with:
token: ${{ secrets.GITHUB_TOKEN }}
image: ${{ env.IMAGE_NAME }}
issue_label: trivy,vulnerability,test
issue_title: Security Alert Test
- uses: ./
with:
issue: 'false'

test2:
name: Test for getting image name from enviroment variable
name: Test for with parameter
runs-on: ubuntu-18.04
if: github.repository == 'dataswift/gha-trivy'
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2.3.4

- name: Install dependencies
run: yarn install
Expand All @@ -48,14 +58,16 @@ jobs:
- uses: ./
with:
token: ${{ secrets.GITHUB_TOKEN }}
image: ${{ env.IMAGE_NAME }}
issue_label: trivy,vulnerability,test
issue_title: Security Alert Test

test3:
name: Test not to create issue
name: Test for getting image name from enviroment variable
runs-on: ubuntu-18.04
if: github.repository == 'dataswift/gha-trivy'
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2.3.4

- name: Install dependencies
run: yarn install
Expand All @@ -68,4 +80,6 @@ jobs:

- uses: ./
with:
issue: 'false'
token: ${{ secrets.GITHUB_TOKEN }}
issue_label: trivy,vulnerability,test
issue_title: Security Alert Test
27 changes: 0 additions & 27 deletions .github/workflows/unittest.yml

This file was deleted.

2 changes: 1 addition & 1 deletion __tests__/trivy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('getDownloadUrl', () => {
const os = 'Linux';
const result = await downloader['getDownloadUrl'](version, os);
expect(result).toMatch(
/releases\/download\/v[0-9]\.[0-9]\.[0-9]\/trivy_[0-9]\.[0-9]\.[0-9]_Linux-64bit\.tar\.gz$/
/releases\/download\/v[0-9]*\.[0-9]*\.[0-9]*\/trivy_[0-9]*\.[0-9]*\.[0-9]*_Linux-64bit\.tar\.gz$/
);
});

Expand Down

0 comments on commit d7d3135

Please sign in to comment.