Skip to content
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
13 changes: 12 additions & 1 deletion .github/workflows/ci-script-tests.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
name: CI script tests

# Runs the Pester tests of the scripts in ci/, which choose what a pull request
# builds and what a publish releases, and the test of how
# builds and what a publish releases, check that every key is read under its
# _51DEGREES_ name (ci/key-names.Tests.ps1), and test how
# free-threaded-python.yml fetches the free data files. common-ci's main is
# checked out beside
# this repository, where ci/dispatch.Tests.ps1 looks for it.
on:
pull_request:
paths:
- 'ci/**'
- '*/ci/**'
- '**/tox.ini'
- 'pipeline/fiftyone_pipeline_cloudrequestengine/**/tests/**'
- 'pipeline/fiftyone_pipeline_did/tests/**'
- '.github/workflows/cloud-51did.yml'
- '.github/workflows/ci-script-tests.yml'
- '.github/workflows/free-threaded-python.yml'
push:
Expand All @@ -17,6 +23,11 @@ on:
- rc
paths:
- 'ci/**'
- '*/ci/**'
- '**/tox.ini'
- 'pipeline/fiftyone_pipeline_cloudrequestengine/**/tests/**'
- 'pipeline/fiftyone_pipeline_did/tests/**'
- '.github/workflows/cloud-51did.yml'
- '.github/workflows/ci-script-tests.yml'
- '.github/workflows/free-threaded-python.yml'
workflow_dispatch:
Expand Down
64 changes: 31 additions & 33 deletions .github/workflows/cloud-51did.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Cloud 51Did Tests

# Runs the live cloud 51Did integration test
# (pipeline/fiftyone_pipeline_did/tests/test_did_client_live.py) once for
# every _51DEGREES_RESOURCE_KEY* key passed to its step below. Each run sets
# the single _51DEGREES_RESOURCE_KEY the test reads first. Those keys carry
# the FODid product and the CloudV5FODiD product the marketing usages need.
# (pipeline/fiftyone_pipeline_did/tests/test_did_client_live.py) with the
# keys it reads, _51DEGREES_RESOURCE_KEY_51DID and
# _51DEGREES_LICENSE_KEY_51DID. The resource key carries the FODid product
# and the CloudV5FODiD product the marketing usages need.
# The Basic key carries FODid without CloudV5FODiD, so it runs only the
# tests of what the Basic tier is entitled to (test_did_tier_live.py).
#
Expand All @@ -14,8 +14,9 @@ name: Cloud 51Did Tests
# A new resource key therefore needs a line here as well as the organisation
# secret.
#
# A run with no key fails, because a cloud test that passes without calling
# the cloud has proved nothing. A pull request from a fork gets no secrets,
# A run with no key fails, naming the variable, because a cloud test that
# passes without calling the cloud has proved nothing. The tests themselves
# skip without a key. A pull request from a fork gets no secrets,
# so run this workflow from a branch in this repository.

on:
Expand Down Expand Up @@ -61,40 +62,37 @@ jobs:
run: ./pipeline/ci/copy-owid-source.ps1
- name: Install tox
run: python -m pip install --upgrade pip tox
- name: Cloud 51Did test for each resource key secret
shell: pwsh
- name: Cloud 51Did test
env:
_51DEGREES_RESOURCE_KEY_BESPOKE: ${{ secrets._51DEGREES_RESOURCE_KEY_BESPOKE }}
_51DEGREES_RESOURCE_KEY_51DID: ${{ vars._51DEGREES_RESOURCE_KEY_51DID }}
# The 51Did live tests read their resource key from
# _51DEGREES_RESOURCE_KEY_51DID, the secret of the same name. It has
# to be a key of the same account as _51DEGREES_LICENSE_KEY_51DID.
# With the Bespoke key in its place, the licensed redeem came back
# unreadable.
_51DEGREES_RESOURCE_KEY_51DID: ${{ secrets._51DEGREES_RESOURCE_KEY_51DID }}
# The redemption tests check a sealed result reads back only with a
# license key, and the service only opens a sealed result for a
# license key of the account whose resource key sealed it. So each
# license key is passed only with the resource key of the same
# suffix, and a resource key without one checks that the result
# redeems as unreadable.
# license key of the account whose resource key sealed it. The tests
# read it from _51DEGREES_LICENSE_KEY_51DID.
_51DEGREES_LICENSE_KEY_51DID: ${{ secrets._51DEGREES_LICENSE_KEY_51DID }}
# The tests skip without a key, so the run fails here instead,
# naming the variable. -rs lists any test that skipped, and none
# should.
shell: pwsh
run: |
$keys = Get-ChildItem env: |
Where-Object { $_.Name -like '_51DEGREES_RESOURCE_KEY*' -and $_.Value }
if (-not $keys) {
Write-Host '::error::No _51DEGREES_RESOURCE_KEY* secret reached this job. The tests need a key that carries the FODid product, and the CloudV5FODiD product for the marketing usages.'
if (-not $env:_51DEGREES_RESOURCE_KEY_51DID) {
Write-Host '::error::_51DEGREES_RESOURCE_KEY_51DID is not set. It comes from the _51DEGREES_RESOURCE_KEY_51DID secret.'
exit 1
}
$failed = $false
foreach ($k in $keys) {
Write-Host "::group::test_did_client_live with $($k.Name)"
$env:_51DEGREES_RESOURCE_KEY = $k.Value
$licenseName = $k.Name -replace '^_51DEGREES_RESOURCE_KEY', '_51DEGREES_LICENSE_KEY'
$env:_51DEGREES_LICENSE_KEY = [Environment]::GetEnvironmentVariable($licenseName)
Write-Host "License key: $(if ($env:_51DEGREES_LICENSE_KEY) { $licenseName } else { 'none' })"
# -rs lists any test that skipped, and none should.
tox -- tests/test_did_client_live.py -v -rs
if ($LASTEXITCODE -ne 0) { $failed = $true }
Write-Host '::endgroup::'
}
if ($failed) { exit 1 }
tox -- tests/test_did_client_live.py -v -rs
- name: Cloud 51Did tier test with the Basic key
if: ${{ !cancelled() }}
env:
_51DEGREES_RESOURCE_KEY_BASIC: ${{ vars._51DEGREES_RESOURCE_KEY_BASIC }}
run: tox -- tests/test_did_tier_live.py -v -rs
_51DEGREES_RESOURCE_KEY_BASIC: ${{ secrets._51DEGREES_RESOURCE_KEY_BASIC }}
shell: pwsh
run: |
if (-not $env:_51DEGREES_RESOURCE_KEY_BASIC) {
Write-Host '::error::_51DEGREES_RESOURCE_KEY_BASIC is not set. It comes from the _51DEGREES_RESOURCE_KEY_BASIC secret.'
exit 1
}
tox -- tests/test_did_tier_live.py -v -rs
3 changes: 1 addition & 2 deletions .github/workflows/example-assets-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ jobs:
uses: 51Degrees/common-ci/.github/workflows/nightly-example-assets-update.yml@main
with:
repo-name: ${{ github.event.repository.name }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/monthly-copyright-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ jobs:
uses: 51Degrees/common-ci/.github/workflows/monthly-copyright-update.yml@main
with:
repo-name: ${{ github.event.repository.name }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
secrets: inherit
18 changes: 3 additions & 15 deletions .github/workflows/nightly-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ jobs:
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
cache-assets: true
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
DeviceDetection: ${{ secrets.DEVICE_DETECTION_KEY }}
IpIntelligence: ${{ secrets.IP_INTELLIGENCE_KEY }}
IpIntelligenceUrl: ${{ secrets.IPI_DATA_FILE_URL }}
TestResourceKey: ${{ secrets._51DEGREES_RESOURCE_KEY_BESPOKE }}
PypiToken: ${{ secrets.PYPI_TOKEN }}
secrets: inherit

SubmoduleUpdate:
name: Nightly Submodule Update
Expand All @@ -48,8 +42,7 @@ jobs:
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
secrets: inherit

PullRequests:
if: ${{ !cancelled() }}
Expand All @@ -65,9 +58,4 @@ jobs:
cache-assets: true
# One configuration that fails does not cancel the others.
fail-fast: false
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
DeviceDetection: ${{ secrets.DEVICE_DETECTION_KEY }}
IpIntelligence: ${{ secrets.IP_INTELLIGENCE_KEY }}
IpIntelligenceUrl: ${{ secrets.IPI_DATA_FILE_URL }}
TestResourceKey: ${{ secrets._51DEGREES_RESOURCE_KEY_BESPOKE }}
secrets: inherit
8 changes: 1 addition & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,4 @@ jobs:
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
allow-early-release: ${{ inputs.allow-early-release || false }}
cache-assets: true
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
DeviceDetection: ${{ secrets.DEVICE_DETECTION_KEY }}
IpIntelligence: ${{ secrets.IP_INTELLIGENCE_KEY }}
IpIntelligenceUrl: ${{ secrets.IPI_DATA_FILE_URL }}
TestResourceKey: ${{ secrets._51DEGREES_RESOURCE_KEY_BESPOKE }}
PypiToken: ${{ secrets.PYPI_TOKEN }}
secrets: inherit
7 changes: 1 addition & 6 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,4 @@ jobs:
full-matrix: ${{ inputs.full-matrix || false }}
fail-fast: false
build-without-pull-requests: false
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
DeviceDetection: ${{ secrets.DEVICE_DETECTION_KEY }}
IpIntelligence: ${{ secrets.IP_INTELLIGENCE_KEY }}
IpIntelligenceUrl: ${{ secrets.IPI_DATA_FILE_URL }}
TestResourceKey: ${{ secrets._51DEGREES_RESOURCE_KEY_BESPOKE }}
secrets: inherit
7 changes: 1 addition & 6 deletions .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,4 @@ jobs:
repo-name: ${{ github.event.repository.name }}
org-name: ${{ github.event.repository.owner.login }}
cache-assets: true
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
DeviceDetection: ${{ secrets.DEVICE_DETECTION_KEY }}
IpIntelligence: ${{ secrets.IP_INTELLIGENCE_KEY }}
IpIntelligenceUrl: ${{ secrets.IPI_DATA_FILE_URL }}
TestResourceKey: ${{ secrets._51DEGREES_RESOURCE_KEY_BESPOKE }}
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/submodule-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ jobs:
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
secrets: inherit
5 changes: 2 additions & 3 deletions ci/fetch-assets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ param (
# this repository's folder is the default. It is relative to the
# common-ci checkout, which is where both callers run it from.
[string]$RepoName = (Split-Path -Leaf (Split-Path -Parent $PSScriptRoot)),
[string]$DeviceDetection,
[string]$IpIntelligence,
[string]$IpIntelligenceUrl,
# No key is taken: common-ci downloads the data files with the
# _51DEGREES_LICENSE_KEY it exports.
# The branch a pull request merges into, which its changes are measured
# against.
[string]$Branch = 'main'
Expand Down
Loading
Loading