Add integration tests, update to .NET 8 #26
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'] | ||
pull_request: | ||
branches: ['main'] | ||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
# changed files output, might be relevant for other jobs | ||
global_any_modified: ${{ steps.changed-files-yaml.outputs.global_any_modified }} | ||
global_all_modified_files: ${{ steps.changed-files-yaml.outputs.global_all_modified_files }} | ||
tests_all_modified_files: ${{ steps.changed-files-yaml.outputs.tests_all_modified_files }} | ||
tests_any_modified: ${{ steps.changed-files-yaml.outputs.tests_any_modified }} | ||
src_all_modified_files: ${{ steps.changed-files-yaml.outputs.src_all_modified_files }} | ||
src_any_modified: ${{ steps.changed-files-yaml.outputs.src_any_modified }} | ||
dockerfile_modified: ${{ steps.changed-files-yaml.outputs.dockerfile_any_modified }} | ||
# trigger other jobs | ||
trigger-build-and-test: ${{steps.set-triggers.outputs.trigger-build-and-test}} | ||
trigger-release-docker: ${{steps.set-triggers.outputs.trigger-release-docker}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. | ||
submodules: true | ||
- name: Get all relevant file changes | ||
id: changed-files-yaml | ||
uses: tj-actions/changed-files@v42 | ||
with: | ||
files_yaml: | | ||
global: | ||
- '**' | ||
tests: | ||
- tests/** | ||
src: | ||
- src/** | ||
dockerfile: | ||
- Dockerfile | ||
- name: set triggers | ||
id: set-triggers | ||
run: | | ||
echo "trigger-build-and-test=${{ steps.changed-files-yaml.outputs.tests_any_modified == 'true' || steps.changed-files-yaml.outputs.src_any_modified == 'true' }}" >> $GITHUB_OUTPUT | ||
echo "trigger-release-docker=${{ github.event_name == 'push' && (steps.changed-files-yaml.outputs.tests_any_modified == 'true' || steps.changed-files-yaml.outputs.src_any_modified == 'true' || steps.changed-files-yaml.outputs.dockerfile_modified == 'true') }}" >> $GITHUB_OUTPUT | ||
echo "$GITHUB_OUTPUT" | ||
- name: list outputs | ||
run: | | ||
echo "global:" | ||
echo "- any: ${{ steps.changed-files-yaml.outputs.global_any_modified }}" | ||
echo "- all: ${{ steps.changed-files-yaml.outputs.global_all_modified_files }}" | ||
echo "tests:" | ||
echo "- any: ${{ steps.changed-files-yaml.outputs.tests_any_modified }}" | ||
echo "- all: ${{ steps.changed-files-yaml.outputs.tests_all_modified_files }}" | ||
echo "src:" | ||
echo "- any: ${{ steps.changed-files-yaml.outputs.src_any_modified }}" | ||
echo "- all: ${{ steps.changed-files-yaml.outputs.src_all_modified_files }}" | ||
echo "dockerfile: ${{ steps.changed-files-yaml.outputs.dockerfile_modified }}" | ||
echo "computed outputs:" | ||
echo "trigger build-and-test: ${{steps.set-triggers.outputs.trigger-build-and-test}}" | ||
echo "trigger docker release: ${{steps.set-triggers.outputs.trigger-release-docker}}" | ||
- 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}}" | ||
echo "release-docker-image: ${{steps.set-triggers.outputs.trigger-release-docker}}" | ||
build-and-test: | ||
name: "Build and test" | ||
needs: setup | ||
# https://github.com/actions/runner/issues/1173 | ||
if: needs.setup.outputs.trigger-build-and-test == 'true' | ||
uses: nfdi4plants/actions-workflows/build-and-test-solution.yml@main | ||
with: | ||
solution: ./arc-export.sln | ||
checkout-submodules: true | ||
configuration: Release | ||
release-docker-image: | ||
name: "Release Docker image" | ||
needs: [setup, build-and-test] | ||
if: needs.setup.outputs.trigger-release-docker == 'true' | ||
runs-on: ubuntu-latest | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: nfdi4plants/arc-export | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |