Add PRIDE validation package #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "pipeline" | |
on: | |
push: | |
branches: ['main'] | |
workflow_dispatch: | |
inputs: | |
dry-run: | |
description: 'dry run mode' | |
required: true | |
default: true | |
type: boolean | |
pull_request: | |
branches: ['main'] | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
# changed files output, might be relevant for other jobs | |
global_any_changed: ${{ steps.changed-files-yaml.outputs.global_any_changed }} | |
global_all_changed_files: ${{ steps.changed-files-yaml.outputs.global_all_changed_files }} | |
staging_area_all_changed_files: ${{ steps.changed-files-yaml.outputs.staging_area_all_changed_files }} | |
staging_area_any_changed: ${{ steps.changed-files-yaml.outputs.staging_area_any_changed }} | |
tests_all_changed_files: ${{ steps.changed-files-yaml.outputs.tests_all_changed_files }} | |
tests_any_changed: ${{ steps.changed-files-yaml.outputs.tests_any_changed }} | |
api_all_changed_files: ${{ steps.changed-files-yaml.outputs.api_all_changed_files }} | |
api_any_changed: ${{ steps.changed-files-yaml.outputs.api_any_changed }} | |
client_all_changed_files: ${{ steps.changed-files-yaml.outputs.client_all_changed_files }} | |
client_any_changed: ${{ steps.changed-files-yaml.outputs.client_any_changed }} | |
index_all_changed_files: ${{ steps.changed-files-yaml.outputs.index_all_changed_files }} | |
index_any_changed: ${{ steps.changed-files-yaml.outputs.index_any_changed }} | |
# dry run so we can do manual diagnostics | |
is_dry_run: ${{ steps.decide-on-dry-run.outputs.dry_run }} | |
# trigger other jobs | |
trigger-build-and-test-projects: ${{steps.set-triggers.outputs.trigger-build-and-test-projects}} | |
trigger-release-index: ${{steps.set-triggers.outputs.trigger-release-index}} | |
trigger-release-client: ${{steps.set-triggers.outputs.trigger-release-client}} | |
trigger-test-staging-area: ${{steps.set-triggers.outputs.trigger-test-staging-area}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. | |
- name: Get all relevant file changes | |
id: changed-files-yaml | |
uses: tj-actions/changed-files@v42 | |
with: | |
files_yaml: | | |
global: | |
- '**' | |
staging_area: | |
- src/PackageRegistryServive/StagingArea/** | |
tests: | |
- tests/** | |
api: | |
- src/PackageRegistryServive/** | |
- '!src/PackageRegistryServive/StagingArea/**' | |
- '!src/PackageRegistryServive/Data/**' | |
client: | |
- src/AVPRClient/** | |
index: | |
- src/AVPRIndex/** | |
- name: decide on dry run | |
id: decide-on-dry-run | |
run: | | |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then | |
dr=${{ inputs.dry-run }} | |
else | |
dr=false | |
fi | |
echo "dry_run=$dr" >> $GITHUB_OUTPUT | |
echo "$GITHUB_OUTPUT" | |
echo "dry_run=$dr" | |
- name: set triggers | |
id: set-triggers | |
run: | | |
echo "trigger-build-and-test-projects=${{ steps.changed-files-yaml.outputs.tests_any_changed == 'true' || steps.changed-files-yaml.outputs.api_any_changed == 'true' || steps.changed-files-yaml.outputs.client_any_changed == 'true' || steps.changed-files-yaml.outputs.index_any_changed == 'true'}}" >> $GITHUB_OUTPUT | |
echo "trigger-release-index=${{github.event_name == 'push' && steps.decide-on-dry-run.outputs.dry_run == 'false' && contains(steps.changed-files-yaml.outputs.index_all_changed_files, 'RELEASE_NOTES.md')}}" >> $GITHUB_OUTPUT | |
echo "trigger-release-client=${{github.event_name == 'push' && steps.decide-on-dry-run.outputs.dry_run == 'false' && contains(steps.changed-files-yaml.outputs.client_all_changed_files, 'RELEASE_NOTES.md')}}" >> $GITHUB_OUTPUT | |
echo "trigger-test-staging-area=${{steps.changed-files-yaml.outputs.staging_area_any_changed == 'true'}}" >> $GITHUB_OUTPUT | |
echo "$GITHUB_OUTPUT" | |
- name: list outputs | |
run: | | |
echo "global:" | |
echo "- any: ${{ steps.changed-files-yaml.outputs.global_any_changed }}" | |
echo "- all: ${{ steps.changed-files-yaml.outputs.global_all_changed_files }}" | |
echo "staging area:" | |
echo "- any: ${{ steps.changed-files-yaml.outputs.staging_area_any_changed }}" | |
echo "- all: ${{ steps.changed-files-yaml.outputs.staging_area_all_changed_files }}" | |
echo "tests:" | |
echo "- any: ${{ steps.changed-files-yaml.outputs.tests_any_changed }}" | |
echo "- all: ${{ steps.changed-files-yaml.outputs.tests_all_changed_files }}" | |
echo "api:" | |
echo "- any: ${{ steps.changed-files-yaml.outputs.api_any_changed }}" | |
echo "- all: ${{ steps.changed-files-yaml.outputs.api_all_changed_files }}" | |
echo "client:" | |
echo "- any: ${{ steps.changed-files-yaml.outputs.client_any_changed }}" | |
echo "- all: ${{ steps.changed-files-yaml.outputs.client_all_changed_files }}" | |
echo "index:" | |
echo "- any: ${{ steps.changed-files-yaml.outputs.index_any_changed }}" | |
echo "- all: ${{ steps.changed-files-yaml.outputs.index_all_changed_files }}" | |
echo "computed outputs:" | |
echo "dry run: ${{ steps.decide-on-dry-run.outputs.dry_run }}" | |
echo "trigger build-and-test-projects: ${{steps.set-triggers.outputs.trigger-build}}" | |
echo "trigger release-index: ${{steps.set-triggers.outputs.trigger-release-index}}" | |
echo "trigger release-client: ${{steps.set-triggers.outputs.trigger-release-client}}" | |
echo "trigger release-index: ${{steps.set-triggers.outputs.trigger-release-index}}" | |
echo "trigger test-staging-area: ${{steps.set-triggers.outputs.trigger-test-staging-area}}" | |
- name: list triggered jobs | |
run: | | |
echo "this should trigger the following jobs:" | |
echo "build-and-test-projects: ${{steps.set-triggers.outputs.trigger-build-and-test-projects}}" | |
echo "release-index: ${{steps.set-triggers.outputs.trigger-release-index}}" | |
echo "release-client: ${{steps.set-triggers.outputs.trigger-release-client}}" | |
echo "test-staging-area: ${{steps.set-triggers.outputs.trigger-test-staging-area}}" | |
build-and-test-projects: | |
name: "Build and test projects" | |
needs: setup | |
# https://github.com/actions/runner/issues/1173 | |
if: needs.setup.outputs.trigger-build-and-test-projects == 'true' | |
uses: nfdi4plants/arc-validate-package-registry/.github/workflows/build-and-test-solution.yml@main | |
with: | |
solution: ./arc-validate-package-registry.sln | |
configuration: Release | |
release-index-package: | |
name: "Release index package" | |
needs: [setup, build-and-test-projects] | |
if: needs.setup.outputs.trigger-release-index == 'true' | |
uses: nfdi4plants/arc-validate-package-registry/.github/workflows/release-package.yml@main | |
with: | |
project: src/AVPRIndex/AVPRIndex.fsproj | |
secrets: | |
NUGET_KEY: ${{ secrets.NUGET_KEY }} | |
release-client-package: | |
name: "Release client package" | |
needs: [setup, build-and-test-projects] | |
if: needs.setup.outputs.trigger-release-client == 'true' | |
uses: nfdi4plants/arc-validate-package-registry/.github/workflows/release-package.yml@main | |
with: | |
project: src/AVPRClient/AVPRClient.csproj | |
secrets: | |
NUGET_KEY: ${{ secrets.NUGET_KEY }} | |
test-staging-area: | |
name: "Test staging area" | |
needs: setup | |
# https://github.com/actions/runner/issues/1173 | |
if: needs.setup.outputs.trigger-test-staging-area == 'true' | |
uses: nfdi4plants/arc-validate-package-registry/.github/workflows/build-and-test-solution.yml@main | |
with: | |
solution: ./PackageStagingArea.sln | |
configuration: Release | |