Bump Agent #938
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: Runner CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- gha_test | |
- releases/* | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: | |
- '*' | |
paths-ignore: | |
- '**.md' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
runtime: [ linux-x64, linux-arm64, linux-arm, win-x64, osx-x64, osx-arm64 ] | |
include: | |
- runtime: linux-x64 | |
os: ubuntu-latest | |
devScript: ./dev.sh | |
scriptSuffix: .sh | |
elevate: "sudo " | |
- runtime: linux-arm64 | |
os: ubuntu-latest | |
devScript: ./dev.sh | |
scriptSuffix: .sh | |
elevate: "sudo " | |
- runtime: linux-arm | |
os: ubuntu-latest | |
devScript: ./dev.sh | |
scriptSuffix: .sh | |
elevate: "sudo " | |
- runtime: osx-x64 | |
os: macOS-latest | |
devScript: ./dev.sh | |
scriptSuffix: .sh | |
elevate: "sudo " | |
- runtime: osx-arm64 | |
os: macOS-latest | |
devScript: ./dev.sh | |
- runtime: win-x64 | |
os: windows-2019 | |
devScript: ./dev | |
exeSuffix: .exe | |
scriptSuffix: .cmd | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
# Build runner layout | |
- name: Build & Layout Release | |
run: | | |
${{ matrix.devScript }} layout Release ${{ matrix.runtime }} | |
working-directory: src | |
# Create runner package tar.gz/zip | |
- name: Package Release | |
if: github.event_name != 'pull_request' | |
run: | | |
${{ matrix.devScript }} package Release | |
working-directory: src | |
# Upload runner package tar.gz/zip as artifact | |
- name: Publish Artifact | |
if: github.event_name != 'pull_request' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: runner-package-${{ matrix.runtime }} | |
path: | | |
_package | |
- name: Unit Tests (actions/runner) | |
if: matrix.runtime != 'linux-arm64' && matrix.runtime != 'linux-arm' && matrix.runtime != 'osx-arm64' | |
run: | | |
${{ matrix.devScript }} test | |
working-directory: src | |
- name: Unit Tests (Sdk.Tests) | |
if: matrix.runtime != 'linux-arm64' && matrix.runtime != 'linux-arm' && matrix.runtime != 'osx-arm64' | |
run: | | |
dotnet test src/Sdk.Tests/Sdk.Tests.csproj | |
- name: Unit Tests (Runner.Server.Tests) | |
if: matrix.runtime != 'linux-arm64' && matrix.runtime != 'linux-arm' && matrix.runtime != 'osx-arm64' | |
run: | | |
dotnet test src/Runner.Server.Tests/Runner.Server.Tests.csproj | |
- name: Setup | |
if: 'false' # Disabled due to 403 of statuses api with this token and rate limit | |
shell: pwsh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
$obj = Get-Content "_layout/bin/appsettings.json" | ConvertFrom-Json | |
$obj.'Runner.Server'.GITHUB_TOKEN = $Env:GITHUB_TOKEN | |
$obj | ConvertTo-Json -Depth 20 | Set-Content "_layout/bin/appsettings.json" | |
- name: Test | |
shell: bash | |
if: matrix.runtime != 'linux-arm64' && matrix.runtime != 'linux-arm' && matrix.runtime != 'osx-arm64' | |
run: | | |
pushd _layout/bin | |
./Runner.Server${{ matrix.exeSuffix }} --urls http://localhost:5000 & | |
serverpid=$! | |
sleep 20 | |
# Test run job without a runner | |
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../src/Runner.Client/workflow.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000 && exit 1 || [[ "$?" = "1" ]] | |
pushd .. | |
./config${{ matrix.scriptSuffix }} --unattended --url http://localhost:5000/runner/server --token "ThisIsIgnored" | |
./run${{ matrix.scriptSuffix }} & | |
workerpid=$! | |
sleep 20 | |
popd | |
# Test run job with runner | |
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../src/Runner.Client/workflow.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000 | |
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/globalenv.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000 | |
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/localenv.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000 | |
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/stepenv.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000 | |
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/matrixtest.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000 | |
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/skipped.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000 | |
./Runner.Client${{ matrix.exeSuffix }} --workflow ../../testworkflows/eventwithnulltoken.yml --payload ../../src/Runner.Client/payload.json --server http://localhost:5000 | |
#Test using parallel 1 | |
./Runner.Client${{ matrix.exeSuffix }} -P ubuntu-latest=-self-hosted -W ../../testworkflows/matrixtest.yml --parallel 1 | |
#Test using parallel 0, this have to fail | |
./Runner.Client${{ matrix.exeSuffix }} -P ubuntu-latest=-self-hosted -W ../../testworkflows/matrixtest.yml --parallel 0 && exit 1 || [[ "$?" = "1" ]] | |
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/artifact.yml | |
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/issue70/main.yml | |
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/issue70/main2.yml && exit 1 || [[ "$?" = "1" ]] | |
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/issue70/main3.yml && exit 1 || [[ "$?" = "1" ]] | |
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/issue70/main4.yml && exit 1 || [[ "$?" = "1" ]] | |
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/skippedjob.yml | |
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/testlocalcheckout.yml | |
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/testhashfiles.yml | |
./Runner.Client${{ matrix.exeSuffix }} -W ../../testworkflows/dumpcontexts.yml | |
kill $workerpid | |
kill $serverpid | |
popd | |
- name: Test cache | |
if: matrix.runtime != 'linux-arm64' && matrix.runtime != 'linux-arm' && matrix.runtime != 'osx-arm64' | |
shell: bash | |
run: | | |
pushd _layout/bin | |
./Runner.Client${{ matrix.exeSuffix }} -P ubuntu-latest=-self-hosted -W ../../testworkflows/cache.yml | |
popd |