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

{Automation} Add CI tests #136

Merged
merged 1 commit into from
Feb 22, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@master
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "20.x"

- run: sudo npm i -g @vercel/ncc

Expand Down
25 changes: 8 additions & 17 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
name: ci-workflow
on:
push:
schedule:
- cron: '0 */3 * * *'
workflow_dispatch:

jobs:
test_action_job:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v1
uses: actions/checkout@v4

- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "20.x"

- run: npm install --production

- run: sudo npm i -g ts-node
- run: npm i -g ts-node
- run: npm install typescript

- name: Azure CLI Version test
Expand All @@ -46,14 +47,4 @@ jobs:
INPUT_AZCLIVERSION: 2.0.72
INPUT_INLINESCRIPT: " "
EXPECTED_TO: fail
run: ts-node test/main.test.ts

- name: Post to slack on failure
if: failure()
uses: 8398a7/action-slack@v3.9.1
with:
status: ${{ job.status }}
fields: repo,message,author,action,ref,workflow
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

run: ts-node test/main.test.ts
91 changes: 91 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: integration-test
on:
workflow_dispatch:
schedule:
- cron: '0 */3 * * *'

jobs:
basic_test:
runs-on: ubuntu-latest
steps:
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Specific test - Postive
uses: azure/cli@master
with:
azcliversion: 2.30.0
inlineScript: |
az --version
az account show --output none

- name: Latest version test - Postive
uses: azure/cli@master
with:
azcliversion: latest
inlineScript: |
az --version
az account show --output none

- name: Default version test - Postive
uses: azure/cli@master
with:
inlineScript: |
az --version
az account show --output none

- name: Invalid Version test - Negative
id: test1
continue-on-error: true
uses: azure/cli@master
with:
azcliversion: 0
inlineScript: |
az --version

- name: Check Last step failed
if: steps.test1.outcome == 'success'
uses: actions/github-script@v3
with:
script: |
core.setFailed('Last action should fail but not. Please check it.')

- name: Invalid Script test - Negative
id: test2
continue-on-error: true
uses: azure/cli@master
with:
azcliversion: latest
inlineScript: " "

- name: Check Last step failed
if: steps.test2.outcome == 'success'
uses: actions/github-script@v3
with:
script: |
core.setFailed('Last action should fail but not. Please check it.')

os_test:
environment: Automation Test
runs-on: windows-latest
steps:
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Invalid OS - Negative
id: test3
continue-on-error: true
uses: azure/cli@master
with:
azcliversion: latest
inlineScript: |
az --version

- name: Check Last step failed
if: steps.test3.outcome == 'success'
uses: actions/github-script@v3
with:
script: |
core.setFailed('Last action should fail but not. Please check it.')
121 changes: 121 additions & 0 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: pr-test
on:
pull_request_target:
branches:
- master
- releases/*
push:
workflow_dispatch:

jobs:
basic_test:
environment: Automation Test
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"

- name: Install dependencies
run: |
npm i -g @vercel/ncc
npm install

- name: Compile files
run: |
ncc build -C -m src/entrypoint.ts

- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Test - Postive
uses: ./
with:
azcliversion: 2.30.0
inlineScript: |
az --version
az account show --output none

- name: Default version test - Postive
uses: ./
with:
inlineScript: |
az --version
az account show --output none

- name: Invalid Version test - Negative
id: test1
continue-on-error: true
uses: ./
with:
azcliversion: 0
inlineScript: |
az --version

- name: Check Last step failed
if: steps.test1.outcome == 'success'
uses: actions/github-script@v3
with:
script: |
core.setFailed('Last action should fail but not. Please check it.')

- name: Invalid Script test - Negative
id: test2
continue-on-error: true
uses: ./
with:
azcliversion: latest
inlineScript: " "

- name: Check Last step failed
if: steps.test2.outcome == 'success'
uses: actions/github-script@v3
with:
script: |
core.setFailed('Last action should fail but not. Please check it.')

os_test:
environment: Automation Test
runs-on: windows-latest
steps:
- name: Check out source code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"

- name: Install dependencies
run: |
npm i -g @vercel/ncc
npm install

- name: Compile files
run: |
ncc build -C -m src/entrypoint.ts

- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Invalid OS - Negative
id: test3
continue-on-error: true
uses: ./
with:
azcliversion: latest
inlineScript: |
az --version

- name: Check Last step failed
if: steps.test3.outcome == 'success'
uses: actions/github-script@v3
with:
script: |
core.setFailed('Last action should fail but not. Please check it.')
Loading