Skip to content

Commit

Permalink
Move more stuff into a reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev committed Jun 7, 2022
1 parent 7bbd9bc commit 6477178
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 89 deletions.
22 changes: 3 additions & 19 deletions .github/templates/build.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,18 @@
#@ def deployBaas(targets = []):
#@ differentiators = []
#@ for target in targets:
#@ differentiators.append(getJobName("", target))
#@ differentiators.append('"' + getJobName("", target) + '"')
#@ end
deploy-cluster:
uses: ./.github/workflows/deploy-baas.yml
with:
differentiators: #@ '[' + ", ".join(differentiators) + ']'
secrets:
AtlasProjectId: #@ secret_AtlasProjectId
BaseUrl: #@ secret_BaseUrl
AtlasBaseUrl: #@ secret_AtlasBaseUrl
AtlasPublicKey: #@ secret_AtlasPublicKey
AtlasPrivateKey: #@ secret_AtlasPrivateKey
deploy-apps:
name: Deploy Apps
needs: deploy-cluster
runs-on: ubuntu-latest
strategy:
matrix:
differentiator: #@ differentiators
if: #@ ignoreSkippedJobsCondition
steps:
- #@ template.replace(checkoutCode())
- uses: #@ actionSetupDotnet
with:
dotnet-version: '6.0.x'
- #@ setupNugetCache([ "Tools/DeployApps" ])
- name: Deploy Apps
run: #@ "dotnet run . --baasurl=" + secret_BaseUrl + " --baascluster=${{ needs.deploy-cluster.outputs.clusterName }} --baasapikey=" + secret_AtlasPublicKey + " --baasprivateapikey=" + secret_AtlasPrivateKey + " --baasprojectid=" + secret_AtlasProjectId + " --baasdifferentiator=${{ matrix.differentiator }}"
working-directory: Tools/DeployApps
#@ end

#@ def cleanupBaas(dependencies = []):
Expand Down Expand Up @@ -78,7 +63,6 @@ cleanup-cluster:
- build-packages
#@ if runSyncTests:
- deploy-cluster
- deploy-apps
#@ end
with:
version: ${{ needs.build-packages.outputs.package_version }}
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/deploy-baas.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: deploy-baas
"on":
workflow_call:
inputs:
differentiators:
required: true
type: string
outputs:
clusterName:
value: ${{ jobs.deploy-baas.outputs.clusterName }}
Expand Down Expand Up @@ -40,3 +44,23 @@ jobs:
apiKey: ${{ secrets.AtlasPublicKey}}
privateApiKey: ${{ secrets.AtlasPrivateKey }}
differentiator: realm-dotnet
deploy-apps:
name: Deploy Apps
needs: deploy-baas
runs-on: ubuntu-latest
strategy:
matrix:
differentiator: ${{ fromJson(inputs.differentiators) }}
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Deploy Apps
run: dotnet run . --baasurl=${{ secrets.BaseUrl }} --baascluster=${{ needs.deploy-baas.outputs.clusterName }} --baasapikey=${{ secrets.AtlasPublicKey }} --baasprivateapikey=${{ secrets.AtlasPrivateKey }} --baasprojectid=${{ secrets.AtlasProjectId }} --baasdifferentiator=${{ matrix.differentiator }}
working-directory: Tools/DeployApps
42 changes: 2 additions & 40 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,14 @@ jobs:
name: Wrappers
deploy-cluster:
uses: ./.github/workflows/deploy-baas.yml
with:
differentiators: '["net-framework", "code-coverage", "uwp-managed", "xamarinmacos", "xamarinios", "xamarinandroid"]'
secrets:
AtlasProjectId: ${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PROJECT_ID) || secrets.ATLAS_PROJECT_ID }}
BaseUrl: ${{ (contains(github.head_ref, 'release') && secrets.REALM_QA_BASE_URL) || secrets.REALM_BASE_URL }}
AtlasBaseUrl: ${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_BASE_URL) || secrets.ATLAS_BASE_URL }}
AtlasPublicKey: ${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PUBLIC_API_KEY) || secrets.ATLAS_PUBLIC_API_KEY }}
AtlasPrivateKey: ${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PRIVATE_API_KEY) || secrets.ATLAS_PRIVATE_API_KEY }}
deploy-apps:
name: Deploy Apps
needs: deploy-cluster
runs-on: ubuntu-latest
strategy:
matrix:
differentiator:
- net-framework
- code-coverage
- uwp-managed
- xamarinmacos
- xamarinios
- xamarinandroid
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register csc problem matcher
run: echo "::add-matcher::.github/problem-matchers/csc.json"
- name: Register msvc problem matcher
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- uses: actions/cache@v2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('Tools/DeployApps/*.csproj') }}
- name: Deploy Apps
run: dotnet run . --baasurl=${{ (contains(github.head_ref, 'release') && secrets.REALM_QA_BASE_URL) || secrets.REALM_BASE_URL }} --baascluster=${{ needs.deploy-cluster.outputs.clusterName }} --baasapikey=${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PUBLIC_API_KEY) || secrets.ATLAS_PUBLIC_API_KEY }} --baasprivateapikey=${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PRIVATE_API_KEY) || secrets.ATLAS_PRIVATE_API_KEY }} --baasprojectid=${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PROJECT_ID) || secrets.ATLAS_PROJECT_ID }} --baasdifferentiator=${{ matrix.differentiator }}
working-directory: Tools/DeployApps
build-packages:
uses: ./.github/workflows/build-packages.yml
name: Package
Expand Down Expand Up @@ -121,7 +89,6 @@ jobs:
needs:
- build-packages
- deploy-cluster
- deploy-apps
with:
version: ${{ needs.build-packages.outputs.package_version }}
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }}
Expand All @@ -137,7 +104,6 @@ jobs:
needs:
- build-packages
- deploy-cluster
- deploy-apps
with:
version: ${{ needs.build-packages.outputs.package_version }}
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }}
Expand All @@ -164,7 +130,6 @@ jobs:
needs:
- build-packages
- deploy-cluster
- deploy-apps
with:
version: ${{ needs.build-packages.outputs.package_version }}
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }}
Expand All @@ -180,7 +145,6 @@ jobs:
needs:
- build-packages
- deploy-cluster
- deploy-apps
with:
version: ${{ needs.build-packages.outputs.package_version }}
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }}
Expand All @@ -196,7 +160,6 @@ jobs:
needs:
- build-packages
- deploy-cluster
- deploy-apps
with:
version: ${{ needs.build-packages.outputs.package_version }}
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }}
Expand Down Expand Up @@ -260,7 +223,6 @@ jobs:
needs:
- build-packages
- deploy-cluster
- deploy-apps
with:
version: ${{ needs.build-packages.outputs.package_version }}
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }}
Expand Down
32 changes: 2 additions & 30 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,14 @@ jobs:
name: Wrappers
deploy-cluster:
uses: ./.github/workflows/deploy-baas.yml
with:
differentiators: '["code-coverage"]'
secrets:
AtlasProjectId: ${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PROJECT_ID) || secrets.ATLAS_PROJECT_ID }}
BaseUrl: ${{ (contains(github.head_ref, 'release') && secrets.REALM_QA_BASE_URL) || secrets.REALM_BASE_URL }}
AtlasBaseUrl: ${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_BASE_URL) || secrets.ATLAS_BASE_URL }}
AtlasPublicKey: ${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PUBLIC_API_KEY) || secrets.ATLAS_PUBLIC_API_KEY }}
AtlasPrivateKey: ${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PRIVATE_API_KEY) || secrets.ATLAS_PRIVATE_API_KEY }}
deploy-apps:
name: Deploy Apps
needs: deploy-cluster
runs-on: ubuntu-latest
strategy:
matrix:
differentiator:
- code-coverage
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Register csc problem matcher
run: echo "::add-matcher::.github/problem-matchers/csc.json"
- name: Register msvc problem matcher
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- uses: actions/cache@v2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('Tools/DeployApps/*.csproj') }}
- name: Deploy Apps
run: dotnet run . --baasurl=${{ (contains(github.head_ref, 'release') && secrets.REALM_QA_BASE_URL) || secrets.REALM_BASE_URL }} --baascluster=${{ needs.deploy-cluster.outputs.clusterName }} --baasapikey=${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PUBLIC_API_KEY) || secrets.ATLAS_PUBLIC_API_KEY }} --baasprivateapikey=${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PRIVATE_API_KEY) || secrets.ATLAS_PRIVATE_API_KEY }} --baasprojectid=${{ (contains(github.head_ref, 'release') && secrets.ATLAS_QA_PROJECT_ID) || secrets.ATLAS_PROJECT_ID }} --baasdifferentiator=${{ matrix.differentiator }}
working-directory: Tools/DeployApps
build-packages:
uses: ./.github/workflows/build-packages.yml
name: Package
Expand Down Expand Up @@ -148,7 +121,6 @@ jobs:
needs:
- build-packages
- deploy-cluster
- deploy-apps
with:
version: ${{ needs.build-packages.outputs.package_version }}
clusterName: ${{ needs.deploy-cluster.outputs.clusterName }}
Expand Down

0 comments on commit 6477178

Please sign in to comment.