Merge pull request #833 from clienthax/azureispain

Move to github actions
This commit is contained in:
clienthax 2021-12-30 18:18:36 +00:00 committed by GitHub
commit 3bfb51e723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 94 deletions

66
.github/workflows/dotnet.yml vendored Normal file
View File

@ -0,0 +1,66 @@
name: .NET
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
BuildAndTest:
runs-on: ubuntu-latest
name: "Run Tests"
steps:
- uses: actions/checkout@v2
- name: update dotnet core sdk
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: dotnet restore (first try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (second try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (last try)
run: dotnet restore
- name: dotnet build Debug
run: dotnet build --no-restore --configuration Debug
- name: dotnet test
run: dotnet test --no-build --verbosity normal Tests/Tests.csproj
DockerImage:
needs: BuildAndTest
runs-on: ubuntu-latest
name: "Build Docker image"
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: "clean build artifacts"
run: git clean -dfx
- name: update dotnet core sdk
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: dotnet restore (first try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (second try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (last try)
run: dotnet restore
- name: dotnet build Release
run: dotnet build --no-restore --configuration Release
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Generating build ID with offset for old builds
env:
NUM: ${{ github.run_number }}
run: echo "GITHUB_RUN_NUMBER_WITH_OFFSET=$(($NUM+1050))" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
push: 'true'
tags: rpcs3/discord-bot:${{ env.GITHUB_RUN_NUMBER_WITH_OFFSET }},rpcs3/discord-bot:release-latest,rpcs3/discord-bot:latest

View File

@ -1,94 +0,0 @@
#trigger:
#- master
#pr:
#- master
jobs:
- job: BuildAndTest
displayName: 'Run tests'
pool:
vmImage: 'ubuntu-latest'
timeoutInMinutes: 3
steps:
- task: UseDotNet@2
displayName: 'update dotnet core sdk'
inputs:
version: "5.0.x"
- script: dotnet restore --ignore-failed-sources
displayName: 'dotnet restore (first try)'
- script: dotnet restore --ignore-failed-sources
displayName: 'dotnet restore (second try)'
- script: dotnet restore
displayName: 'dotnet restore (last try)'
- script: dotnet build --configuration Debug
displayName: 'dotnet build Debug'
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: 'test'
projects: Tests/Tests.csproj
- job: DockerImage
displayName: 'Build Docker image'
condition: "and(succeeded(), eq(variables['ReleaseBranch'], variables['Build.SourceBranch']))"
dependsOn: BuildAndTest
pool:
vmImage: 'ubuntu-latest'
steps:
- script: git checkout -f $(Build.SourceBranchName)
displayName: 'create local tracking branch'
- script: git clean -dfx
displayName: 'clean build artifacts'
- task: UseDotNet@2
displayName: 'update dotnet core sdk'
inputs:
version: 5.0.x
- script: dotnet restore --ignore-failed-sources
displayName: 'dotnet restore (first try)'
- script: dotnet restore --ignore-failed-sources
displayName: 'dotnet restore (second try)'
- script: dotnet restore
displayName: 'dotnet restore (last try)'
- script: dotnet build --configuration Release
displayName: 'dotnet build Release'
# - script: "mkdir packages && cp -a /home/vsts/.nuget/packages ./packages/"
# displayName: 'copy nuget package cache for docker'
- task: Docker@2
displayName: 'logging into docker registry'
condition: succeeded()
inputs:
containerRegistry: $(DockerConnection)
command: 'login'
- task: Docker@2
displayName: 'building release docker image'
condition: "and(succeeded(), eq(variables['ReleaseKind'], 'release'))"
inputs:
repository: $(DockerRegistry)
command: 'buildAndPush'
Dockerfile: 'Dockerfile'
tags: |
$(Build.BuildId)
release-latest
latest
- task: Docker@2
displayName: 'building test docker image'
condition: "and(succeeded(), not(eq(variables['ReleaseKind'], 'release')))"
inputs:
repository: $(DockerRegistry)
command: 'buildAndPush'
Dockerfile: 'Dockerfile'
tags: test-latest