Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More CI/Build Fixes #7884

Merged
merged 3 commits into from Mar 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 1 addition & 21 deletions .travis/deploy-windows.sh
@@ -1,32 +1,12 @@
#!/bin/sh -ex

# From pure sh bible, strips rogue quotes
# Does single and double quotes
trim_quotes()
{
set -f

old_ifs=$IFS
IFS=\"\'

set -- $1
IFS=
printf '%s\n' "$*"
IFS=$old_ifs

set +f
}

# BUILD_blablabla is Azure specific, so we wrap it for portability
# The BUILD var is passed from a previous stage, so it is cleaned
# due to a bug in Azure
ARTIFACT_DIR="$BUILD_ARTIFACTSTAGINGDIRECTORY"
BUILD=$(trim_quotes "$BUILD")

# Remove unecessary files
rm -f ./bin/rpcs3.exp ./bin/rpcs3.lib ./bin/rpcs3.pdb

# Prepare compatibility database for packaging, as well as
# Prepare compatibility database for packaging, as well as
# certificate for ssl (auto-updater)
curl -sL 'https://rpcs3.net/compatibility?api=v1&export' | iconv -t UTF-8 > ./bin/GuiConfigs/compat_database.dat
curl -sL 'https://curl.haxx.se/ca/cacert.pem' > ./bin/cacert.pem
Expand Down
13 changes: 13 additions & 0 deletions .travis/export-azure-vars.sh
@@ -0,0 +1,13 @@
#!/bin/sh -e

# Export variables for later stages of the Azure pipeline
# Values done in this manner will appear as environment variables
# in later stages.

# From pure-sh-bible
# Setting 'IFS' tells 'read' where to split the string.
while IFS='=' read -r key val; do
# Skip over lines containing comments.
[ "${key##\#*}" ] || continue
echo "##vso[task.setvariable variable=$key]$val"
done < ".travis/azure-vars.env"
15 changes: 6 additions & 9 deletions .travis/setup-windows.sh
Expand Up @@ -107,13 +107,10 @@ else
BUILD="rpcs3-v${AVVER}-${COMM_HASH}_win64.7z"
fi

# Export variables for later stages of the Azure pipeline
# Values done in this manner will appear as environment variables
# in later stages, but are not added to environment variables
# in *this* stage. Thank azure for that one.
# BRANCH is used for experimental build warnings for pr builds
# used in main_window.cpp. AVVER is used for GitHub releases.
# BRANCH is used for experimental build warnings for pr builds, used in main_window.cpp.
# BUILD is the name of the release artifact
# AVVER is used for GitHub releases, it is the version number.
BRANCH="${REPO_NAME}/${REPO_BRANCH}"
echo "##vso[task.setvariable variable=branch]$BRANCH"
echo "##vso[task.setvariable variable=build]$BUILD"
echo "##vso[task.setvariable variable=avver]$AVVER"
echo "BRANCH=$BRANCH" > .travis/azure-vars.env
echo "BUILD=$BUILD" >> .travis/azure-vars.env
echo "AVVER=$AVVER" >> .travis/azure-vars.env
19 changes: 9 additions & 10 deletions Utilities/git-version-gen.cmd
Expand Up @@ -59,17 +59,13 @@ if errorlevel 1 (
rem // Get commit count from (unshallowed) HEAD
for /F %%I IN ('call %GIT% rev-list HEAD --count') do set COMMIT_COUNT=%%I

rem // These environment variables are defined by Azure pipelines
rem // BUILD_REPOSITORY_NAME will look like "RPCS3/rpcs3"
rem // SYSTEM_PULLREQUEST_SOURCEBRANCH will look like "master"
rem // BUILD_SOURCEBRANCHNAME will look like "master"
rem // See https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables
set GIT_FULL_BRANCH=%BUILD_REPOSITORY_NAME%/%BUILD_SOURCEBRANCHNAME%

rem // Echo for debug purposes
echo %GIT_FULL_BRANCH%

if defined SYSTEM_PULLREQUEST_SOURCEBRANCH (
rem // These environment variables are defined by Azure pipelines
rem // BUILD_REPOSITORY_NAME will look like "RPCS3/rpcs3"
rem // SYSTEM_PULLREQUEST_SOURCEBRANCH will look like "master"
rem // BUILD_SOURCEBRANCHNAME will look like "master"
rem // See https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables
set GIT_FULL_BRANCH=%BUILD_REPOSITORY_NAME%/%BUILD_SOURCEBRANCHNAME%

if "%SYSTEM_PULLREQUEST_SOURCEBRANCH%"=="master" (
rem // If pull request comes from a master branch, GIT_BRANCH = username/branch in order to distinguish from upstream/master
Expand All @@ -87,10 +83,13 @@ if defined SYSTEM_PULLREQUEST_SOURCEBRANCH (
for /F %%I IN ('call %GIT% rev-parse --short^=8 HEAD') do set GIT_VERSION=%COMMIT_COUNT%-%%I

for /F %%I IN ('call %GIT% rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%I

set GIT_FULL_BRANCH=local_build
)

rem // Echo obtained GIT_VERSION for debug purposes if needed
echo %GIT_VERSION%
echo %GIT_FULL_BRANCH%

rem // Don't modify the file if it already has the current version.
if exist "%GIT_VERSION_FILE%" (
Expand Down
7 changes: 5 additions & 2 deletions azure-pipelines.yml
Expand Up @@ -23,7 +23,7 @@ jobs:
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Cache@0
- task: Cache@2
inputs:
key: ccache | $(Agent.OS) | $(COMPILER)
path: $(CCACHE_DIR)
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
vmImage: "windows-latest"

steps:
- task: Cache@0
- task: Cache@2
inputs:
key: $(Agent.OS) | $(COMPILER)
path: $(CACHE_DIR)
Expand All @@ -66,6 +66,9 @@ jobs:
- bash: .travis/setup-windows.sh
displayName: Download and unpack dependencies

- bash: .travis/export-azure-vars.sh
displayName: Export Variables

- task: VSBuild@1
inputs:
solution: 'rpcs3.sln'
Expand Down