ci: Move checkout into each CI job (#151)

* ci: move checkout into each job

* Create and publish a source archive

* update submodule

* update archive task
This commit is contained in:
Arpad Borsos
2020-02-25 14:45:08 +01:00
committed by GitHub
parent 5ec0589561
commit 2dc67c6a55
3 changed files with 31 additions and 127 deletions
+30 -28
View File
@@ -1,25 +1,5 @@
stages:
- stage: package
displayName: Prepare & Bundle Sources
jobs:
- job: package
displayName: Prepare & Bundle Sources
steps:
- checkout: self
fetchDepth: 5
submodules: recursive
- script: |
# the submodule contains an invalid symlink for whatever reason,
# which trips up Azure…
rm external/libunwindstack-ndk/.clang-format
# TODO: rethink how external dependencies are fetched
#bash scripts/fetch-dependencies.sh
displayName: Fetching External Dependencies
- publish: .
artifact: s
- stage: test
dependsOn: package
displayName: Build & Test
jobs:
@@ -27,8 +7,9 @@ stages:
pool:
vmImage: "ubuntu-latest"
steps:
- checkout: none
- download: current
- checkout: self
fetchDepth: 5
submodules: recursive
- script: |
mkdir -p build && cd build
cmake ..
@@ -43,13 +24,32 @@ stages:
cmake --build . --parallel --target example
! (ldd example | grep -q libsentry)
displayName: Test static library build
- task: DeleteFiles@1
displayName: Remove all files not belonging in source archive
inputs:
contents: |
build
.git*
**/.git*
.sentry-native
- task: ArchiveFiles@2
displayName: Create source archive
inputs:
rootFolderOrFile: $(Build.SourcesDirectory)
includeRootFolder: false
archiveFile: "$(Build.ArtifactStagingDirectory)/sentry-native-source.zip"
- task: PublishBuildArtifacts@1
displayName: Publish source archive to Azure
inputs:
pathtoPublish: "$(Build.ArtifactStagingDirectory)/sentry-native-source.zip"
- job: macOS
pool:
vmImage: "macOs-latest"
steps:
- checkout: none
- download: current
- checkout: self
fetchDepth: 5
submodules: recursive
- script: |
mkdir -p build && cd build
cmake ..
@@ -62,8 +62,9 @@ stages:
pool:
vmImage: "windows-latest"
steps:
- checkout: none
- download: current
- checkout: self
fetchDepth: 5
submodules: recursive
- script: |
mkdir build && cd build
cmake ..
@@ -89,8 +90,9 @@ stages:
ANDROID_ARCH: x86
ANDROID_IMAGE: system-images;android-$(ANDROID_API);google_apis;$(ANDROID_ARCH)
steps:
- checkout: none
- download: current
- checkout: self
fetchDepth: 5
submodules: recursive
- script: |
echo "Downloading ndk;$(ANDROID_NDK) and $(ANDROID_IMAGE)"
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install \
-98
View File
@@ -1,98 +0,0 @@
#!/usr/bin/env bash
set -eu
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BASE_DIR="$SCRIPT_DIR/.."
OUT_DIR="$BASE_DIR/out"
TARGET_REVISION="${1:-HEAD}"
rm -rf "$OUT_DIR"
mkdir $OUT_DIR
fetch_crashpad() {
echo '
#########################
### Fetching Crashpad ###
#########################
'
### Crashpad
# CRASHPAD_REMOTE="git@github.com:getsentry/crashpad.git"
# CRASHPAD_REVISION="origin/getsentry"
CRASHPAD_OUT_DIR="$OUT_DIR/crashpad"
mkdir -p "$CRASHPAD_OUT_DIR"
# FIXME this should be a clean sentry-native checkout
CRASHPAD_IN_DIR="$BASE_DIR/crashpad"
CRASHPAD_COPY_SRC=("examples" "fetch_crashpad.sh" "vars.sh")
# Copy files
for f in "${CRASHPAD_COPY_SRC[@]}"; do
cp -r "$CRASHPAD_IN_DIR/$f" "$CRASHPAD_OUT_DIR/"
done
# Fetch crashpad and its dependencies
bash "$CRASHPAD_OUT_DIR/fetch_crashpad.sh"
# Clean up unneeded files
rm -rf $CRASHPAD_OUT_DIR/build/{depot_tools,buildtools} \
$CRASHPAD_OUT_DIR/build/crashpad/third_party/{gtest,gyp} \
$CRASHPAD_OUT_DIR/build/crashpad/{.git,doc,test}
}
fetch_breakpad() {
echo '
#########################
### Fetching Breakpad ###
#########################
'
BREAKPAD_OUT_DIR="$OUT_DIR/breakpad"
mkdir -p "$BREAKPAD_OUT_DIR"
BREAKPAD_IN_DIR="$BASE_DIR/breakpad"
BREAKPAD_COPY_SRC=("examples" "fetch_breakpad.sh")
# Copy files
for f in "${BREAKPAD_COPY_SRC[@]}"; do
cp -r "$BREAKPAD_IN_DIR/$f" "$BREAKPAD_OUT_DIR/"
done
# Fetch breakpad and its dependencies
bash "$BREAKPAD_OUT_DIR/fetch_breakpad.sh"
rm -rf $BREAKPAD_OUT_DIR/build/breakpad/{.git,docs} \
$BREAKPAD_OUT_DIR/build/breakpad/src/{tools,processor}
}
fetch_sentry_native() {
echo '
##############################
### Fetching Sentry Native ###
##############################
'
SENTRY_NATIVE_REMOTE="https://github.com/getsentry/sentry-native/"
SENTRY_NATIVE_REVISION=$(git rev-parse "$TARGET_REVISION")
SENTRY_NATIVE_IN_DIR="$BASE_DIR/.sentry-native-tmp"
if [ -d "$SENTRY_NATIVE_IN_DIR" ]; then
cd "$SENTRY_NATIVE_IN_DIR"
git fetch origin
git checkout -f "$SENTRY_NATIVE_REVISION"
else
git clone "$SENTRY_NATIVE_REMOTE" "$SENTRY_NATIVE_IN_DIR"
cd "$SENTRY_NATIVE_IN_DIR"
git checkout -f "$SENTRY_NATIVE_REVISION"
fi
SENTRY_NATIVE_SRC=(
"examples" "include" "src" "README.md" "CMakeLists.txt"
"tests" "vendor"
)
# Copy files
for f in "${SENTRY_NATIVE_SRC[@]}"; do
cp -r "$SENTRY_NATIVE_IN_DIR/$f" "$OUT_DIR/"
done
}
fetch_sentry_native
fetch_crashpad
fetch_breakpad