Skip to content

Commit

Permalink
Properly setup Azure Pipelines using current system
Browse files Browse the repository at this point in the history
Also sets up Azure artifacts (including for PRs) for AppImages
  • Loading branch information
hcorion committed Mar 3, 2020
1 parent 87c8d18 commit 128bcb9
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 51 deletions.
8 changes: 6 additions & 2 deletions .travis/build-linux.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_LLVM_SUBMODULE=OFF -DUSE_COTIRE=OFF
ninja; build_status=$?;

cd ..
# If it compiled succesfully let's deploy
if [ $build_status -eq 0 ] && [ -n "$GITHUB_TOKEN" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then /bin/bash -ex .travis/deploy-linux.bash ; fi

# If it compiled succesfully let's deploy depending on the build pipeline (Travis, Azure Pipelines)
# BUILD_REASON is an Azure Pipeline variable, and we want to deploy when using Azure Pipelines
if [[ $build_status -eq 0 && ( -n "$BUILD_REASON" || ( "$TRAVIS_BRANCH" = "master" && "$TRAVIS_PULL_REQUEST" = false ) ) ]]; then
/bin/bash -ex .travis/deploy-linux.bash
fi
30 changes: 21 additions & 9 deletions .travis/deploy-linux.bash
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,30 @@ if [ "$DEPLOY_APPIMAGE" = "true" ]; then
COMM_COUNT="$(git rev-list --count HEAD)"
curl -sLO https://github.com/hcorion/uploadtool/raw/master/upload.sh

mv ./RPCS3*.AppImage rpcs3-v${COMM_TAG}-${COMM_COUNT}-${TRAVIS_COMMIT:0:8}_linux64.AppImage
if [[ -n "$BUILD_SOURCEVERSION" ]]; then
COMMIT_HASH=$BUILD_SOURCEVERSION
elif [[ -n "$TRAVIS_COMMIT" ]]; then
COMMIT_HASH=$TRAVIS_COMMIT
fi

mv ./RPCS3*.AppImage rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMMIT_HASH:0:8}_linux64.AppImage

# If we're building using Azure Pipelines, let's copy over the AppImage artifact
if [[ -n "$BUILD_ARTIFACTSTAGINGDIRECTORY" ]]; then
cp ./rpcs3*.AppImage ~/artifacts
fi

FILESIZE=($(stat -c %s ./rpcs3*.AppImage))
SHA256SUM=($(sha256sum ./rpcs3*.AppImage))

unset TRAVIS_REPO_SLUG
REPO_SLUG=RPCS3/rpcs3-binaries-linux \
UPLOADTOOL_BODY="$SHA256SUM;${FILESIZE}B"\
RELEASE_NAME=build-${TRAVIS_COMMIT}\
RELEASE_TITLE=${COMM_TAG}-${COMM_COUNT}\
REPO_COMMIT=d812f1254a1157c80fd402f94446310560f54e5f\
bash upload.sh rpcs3*.AppImage
if [ -n "$GITHUB_TOKEN" ]; then
unset TRAVIS_REPO_SLUG
REPO_SLUG=RPCS3/rpcs3-binaries-linux \
UPLOADTOOL_BODY="$SHA256SUM;${FILESIZE}B"\
RELEASE_NAME=build-${TRAVIS_COMMIT}\
RELEASE_TITLE=${COMM_TAG}-${COMM_COUNT}\
REPO_COMMIT=d812f1254a1157c80fd402f94446310560f54e5f\
bash upload.sh rpcs3*.AppImage
fi
fi
if [ "$DEPLOY_PPA" = "true" ]; then
export DEBFULLNAME="RPCS3 Build Bot"
Expand Down
4 changes: 4 additions & 0 deletions .travis/travis.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
TRAVIS_PULL_REQUEST
TRAVIS_BRANCH
TRAVIS_COMMIT
# Variables set by Azure Pipelines
BUILD_REASON
BUILD_SOURCEVERSION
BUILD_ARTIFACTSTAGINGDIRECTORY
# Variables for Travis build matrix
COMPILER
DEPLOY_APPIMAGE
Expand Down
77 changes: 37 additions & 40 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,38 @@
variables:
COMPILER: clang
CCACHE_DIR: $(Pipeline.Workspace)/ccache

trigger:
- master

pool:
vmImage: 'ubuntu-latest'

steps:
- bash: |
sudo apt-get install ccache -y
echo "##vso[task.prependpath]/usr/lib/ccache"
displayName: Install ccache and update PATH to use linked versions of gcc, cc, etc

- task: CacheBeta@0
inputs:
key: ccache | $(Agent.OS)
path: $(CCACHE_DIR)
displayName: ccache

- bash: |
docker pull rpcs3/rpcs3-travis-trusty:1.1
docker run \
-v $(pwd):/rpcs3 \
-v $CCACHE_DIR:/root/.ccache \
rpcs3/rpcs3-travis-trusty:1.1 \
/bin/bash -ex /rpcs3/.travis/build-linux.bash
displayName: Fetch and build with Docker

- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: 'build/bin/rpcs3'
TargetFolder: '$(Pipeline.Workspace)/artifacts'

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Pipeline.Workspace)/artifacts'
artifactName: drop
- master
tags:
exclude:
- '*'
jobs:
- job: Linux_Build
strategy:
matrix:
Clang:
COMPILER: clang
GCC:
COMPILER: gcc
DEPLOY_APPIMAGE: true
variables:
COMPILER: clang
CCACHE_DIR: $(Pipeline.Workspace)/ccache
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Cache@0
inputs:
key: ccache | $(Agent.OS) | $(COMPILER)
path: $(CCACHE_DIR)
displayName: Ccache

- bash: |
docker pull --quiet rpcs3/rpcs3-travis-xenial:1.2
docker run \
-v $(pwd):/rpcs3 \
--env-file .travis/travis.env \
-v $CCACHE_DIR:/root/.ccache \
-v $BUILD_ARTIFACTSTAGINGDIRECTORY:/root/artifacts \
rpcs3/rpcs3-travis-xenial:1.2 \
/bin/bash -ex /rpcs3/.travis/build-linux.bash
displayName: Docker setup and build
- publish: $(Build.ArtifactStagingDirectory)

0 comments on commit 128bcb9

Please sign in to comment.