This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
ci: Use GITHUB_OUTPUT envvar instead of set-output command #1036
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: Checks | |
on: | |
push: | |
branches: | |
- '[0-9]+.[0-9]+.x' | |
pull_request: | |
branches: | |
- '[0-9]+.[0-9]+.x' | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
is_default_branch: ${{ steps['info']['outputs']['is-default-branch'] }} | |
is_release_branch: ${{ steps['info']['outputs']['is-release-branch'] }} | |
steps: | |
- name: Fetch repository information | |
id: info | |
run: | | |
DEFAULT_BRANCH=$(curl -s https://api.github.com/repos/syndesisio/syndesis |jq -r .default_branch) | |
IS_DEFAULT_BRANCH=$(test "refs/heads/${DEFAULT_BRANCH}" == "${GITHUB_REF}" && echo true || echo false) | |
IS_RELEASE_BRANCH=$(echo "${GITHUB_REF}" | grep -q -e '^refs/heads/[0-9]\+\.[0-9]\+\.x' && echo true || echo false) | |
echo "is-default-branch=${IS_DEFAULT_BRANCH}" >> $GITHUB_OUTPUT | |
echo "is-release-branch=${IS_RELEASE_BRANCH}" >> $GITHUB_OUTPUT | |
changes: | |
needs: setup | |
runs-on: ubuntu-latest | |
outputs: | |
backend: ${{ steps.filter.outputs.backend }} | |
operator: ${{ steps.filter.outputs.operator }} | |
ui: ${{ steps.filter.outputs.ui }} | |
steps: | |
- uses: actions/checkout@v2 | |
if: needs.setup.outputs.is_release_branch == 'true' | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
base: ${{ github.ref }} | |
filters: | | |
backend: | |
- 'app/(!(ui-react))**' | |
operator: | |
- 'install/operator/**' | |
ui: | |
- 'app/ui-react/**' | |
backend: | |
needs: | |
- changes | |
- setup | |
if: needs.changes.outputs.backend == 'true' | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 8 | |
- name: Cache local Maven repository | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.m2/repository | |
!~/.m2/repository/io/syndesis | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-maven- | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v1 | |
with: | |
config-file: ./.github/codeql/codeql-config.yml | |
languages: java | |
- name: Build and test | |
run: tools/bin/syndesis build --batch-mode --backend | |
- name: Archive logs and test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: checks-backend | |
path: | | |
app/**/target/*.log | |
app/**/target/surefire-reports/* | |
app/**/target/failsafe-reports/* | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v1 | |
- name: Set up JDK 11 | |
if: needs.setup.outputs.is_default_branch == 'true' | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Publish Sonar analysis | |
if: needs.setup.outputs.is_default_branch == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
cd app | |
./mvnw -q -B -pl '!:extension-bom,!:integration-bom' jacoco:report \ | |
&& ./mvnw -B -N -Dsonar.login=${{secrets.SONAR_TOKEN}} sonar:sonar -Dsonar.sources=$(find . -wholename "*/src/main/java" | sed -z 's/\n/,/g;s/,$/\n/') -Dsonar.java.binaries=$(find . -wholename "*/target/classes" | sed -z 's/\n/,/g;s/,$/\n/') | |
operator: | |
needs: changes | |
if: needs.changes.outputs.operator == 'true' | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v1 | |
with: | |
config-file: ./.github/codeql/codeql-config.yml | |
languages: go | |
- name: Setup Go 1.16 | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.16' | |
- name: Build and test | |
run: tools/bin/syndesis build --batch-mode -m operator --local | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v1 | |
ui: | |
needs: changes | |
if: needs.changes.outputs.ui == 'true' | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 8 | |
- name: Cache local Maven repository | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.m2/repository | |
!~/.m2/repository/io/syndesis | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-maven- | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v1 | |
with: | |
config-file: ./.github/codeql/codeql-config.yml | |
languages: javascript | |
- name: Build and test | |
run: tools/bin/syndesis build --batch-mode -m ui-react | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v1 | |
integration-tests: | |
needs: changes | |
if: needs.changes.outputs.backend == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 8 | |
- name: Cache local Maven repository | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.m2/repository | |
!~/.m2/repository/io/syndesis | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-maven- | |
- name: Build | |
run: tools/bin/syndesis build --backend --flash --batch-mode | |
- name: Build S2I image | |
run: tools/bin/syndesis build -m s2i --flash --docker | |
- name: Run integration tests | |
run: tools/bin/syndesis integration-test --s2i --logging | |
- name: Archive logs and test results | |
if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: checks-integration-tests | |
path: | | |
app/test/integration-test/target/*.log | |
app/test/integration-test/target/citrus-reports/**/* | |
app/test/integration-test/target/failsafe-reports/* | |
app/s2i/target/invoker-reports/* | |
app/s2i/target/it/project/build.log |