Skip to content

Commit

Permalink
Merge pull request #23 from Omegapoint/feature/TestUploadTesting
Browse files Browse the repository at this point in the history
Feature/test upload testing
  • Loading branch information
johannaahlskog authored Oct 3, 2023
2 parents ae58e1f + 7f3db35 commit 21b2ef2
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 73 deletions.
62 changes: 4 additions & 58 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,9 @@
name: Creating Release

name: Creating release
run-name: ${{ github.actor }} creating a release
on:
pull_request:
types: [closed]

jobs:
release:
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies and build
run: npm ci && npm run build

- name: 'Get latest release tag'
id: latest_release
run: |
current_version=`gh release list --limit 30 | grep Latest | awk '{ print $1;}'`
if [ -z "$current_version" ]
then
echo "No release found"
echo "Creating tag for firt release"
echo "version=v1.0.0" >> $GITHUB_ENV
else
echo "version=${current_version}" >> $GITHUB_ENV
fi
env:
GH_TOKEN: ${{ github.token }}

- name: Display version
run: |
# Display the version from the environment
echo "Latest Version: ${{ env.version }}"
- id: label
uses: zwaldowski/match-label-action@v4
with:
allowed: major,minor,patch
default_match: none

- uses: actions-ecosystem/action-bump-semver@v1
if: ${{ steps.label.outputs.match != 'none' }}
id: bump-semver
with:
current_version: ${{ env.version }}
level: ${{steps.label.outputs.match}}

- name: 'Creating Release'
if: ${{ steps.label.outputs.match != 'none' }}
run: |
gh release create ${{ steps.bump-semver.outputs.new_version }} --title " ${{ steps.bump-semver.outputs.new_version }}" --generate-notes
env:
GH_TOKEN: ${{ github.token }}

- uses: JasonEtco/build-and-tag-action@v2
if: ${{ steps.label.outputs.match != 'none' }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ steps.bump-semver.outputs.new_version }}
call-release-workflow:
uses: omegapoint/cydig-reusable-workflows/.github/workflows/release.yml@main
96 changes: 84 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,94 @@
name: Test
name: Test all actions
run-name: ${{ github.actor }} is running tests
permissions:
contents: write
pages: write
contents: read
pages: read
id-token: write

on: [push]
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout action
uses: actions/checkout@v3
- name: Checkout Upload action
uses: actions/checkout@v4
with:
path: upload-action
- name: Checkout Azure compliance action
uses: actions/checkout@v4
with:
repository: Omegapoint/cydig-azure-compliance-action
path: azure-compliance-action
- name: Checkout compliance action
uses: actions/checkout@v4
with:
repository: Omegapoint/cydig-compliance-action
path: compliance-action
- name: Setup node
uses: actions/setup-node@v3
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test
- name: Compile to Javascript
run: npm run build

- name: Install upload action dependencies
run: |
cd upload-action
npm ci
- name: Install compliance action dependencies
run: |
cd compliance-action
npm ci
- name: Install azure compliance action dependencies
run: |
cd azure-compliance-action
npm ci
- name: Run upload tests
run: |
cd upload-action
npm run test
- name: Run azure compliance tests
run : |
cd azure-compliance-action
npm run test
- name: Run compliance tests
run : |
cd compliance-action
npm run test
- name: Build Upload action
run: |
cd upload-action
npm run build
- name: Build azure compliance action
run: |
cd azure-compliance-action
npm run build
- name: Build compliance action
run: |
cd compliance-action
npm run build
- name: 'Az CLI login'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID_DEV }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_DEV }}
- name: 'Run Azure Compliance Controls'
uses: ./azure-compliance-action
with:
subscription: ${{ secrets.AZURE_SUBSCRIPTION_ID_DEV }}
- name: 'Run Compliance Controls'
uses: ./compliance-action
with:
cydigConfigPath: ${{ github.workspace }}/compliance-action/src/cydigconfig.json
PAT-token: ${{ secrets.MY_GITHUB_PAT }}

- name: Set dev func URL
run: |
echo "urlUpdate=${{ secrets.ULR_UPLOAD_DEV }}" >> $GITHUB_ENV
- name: 'Run Upload Action'
uses: ./upload-action
with:
cydigConfigPath: ${{ github.workspace }}/upload-action/src/cydigConfig.json
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID_DEV }}

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
"main": "dist/index.js",
"scripts": {
"build": "ncc build src/index.ts",
"buildTest": "tsc",
"test": "npm run buildTest && mocha dist/tests/",
"testScript": "npm run build && mocha dist/tests/ --reporter xunit --reporter-option output=ResultsFile.xml",
"test": "tsc && mocha dist/tests/",
"testScript": "tsc && mocha dist/tests/ --reporter xunit --reporter-option output=ResultsFile.xml",
"prepare": "husky install",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --fix --ext .ts",
Expand Down

0 comments on commit 21b2ef2

Please sign in to comment.