Skip to content

CI templates #46

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

Merged
merged 31 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
deabf83
move cache.yml to templates folder
aminya Jul 13, 2020
9f406e2
windows-preparation.yml
aminya Jul 13, 2020
3127fa5
windows-test.yml
aminya Jul 13, 2020
4d6855f
windows-bootstrap.yml
aminya Jul 13, 2020
7a4c8c6
windows-build.yml and windows-publish.yml
aminya Jul 13, 2020
ee3022b
macos-preparation.yml
aminya Jul 13, 2020
f0074f5
macos-bootstrap.yml
aminya Jul 13, 2020
bf06d17
macos-build.yml and macos-publish.yml
aminya Jul 13, 2020
b5bf759
macos-test.yml
aminya Jul 13, 2020
1fe38af
linux-preparation.yml
aminya Jul 13, 2020
cf0c4a7
linux-bootstrap.yml
aminya Jul 13, 2020
df3e80a
linux-test.yml
aminya Jul 13, 2020
91f302f
linux-build.yml and linux-publish.yml
aminya Jul 13, 2020
264fdd4
combine publish for all OS
aminya Jul 13, 2020
443c98e
combine bootstrap for all OS
aminya Jul 14, 2020
da793c9
download-unzip.yml
aminya Jul 14, 2020
309e3c0
Update bootstrap.yml
aminya Jul 14, 2020
379f780
Merge pull request #45 from atom-ide-community/GitHub-token-no-rate-l…
aminya Jul 14, 2020
4e4a6e0
combine preparation for all OS
aminya Jul 14, 2020
f113939
Use pwsh
aminya Jul 14, 2020
e74543a
Remove linux container and use clang 9
aminya Jul 14, 2020
7101119
combine build for all OS
aminya Jul 16, 2020
9a3112c
combine test for all OS
aminya Jul 14, 2020
b0aa6c6
using AGENT_OS directly
aminya Jul 15, 2020
225fb5b
build: using pwsh for managing env variables
aminya Jul 15, 2020
e95af73
bootstrap: using pwsh for managing env variables
aminya Jul 15, 2020
3da79e3
test: using pwsh for managing env variables
aminya Jul 16, 2020
7c63d85
using pwsh for setting FileID
aminya Jul 16, 2020
5f5b93b
set BUILD_ARCH in preparation
aminya Jul 16, 2020
2d7a8df
using templates in nightly-release.yml
aminya Jul 16, 2020
ef45a89
using templates in release-branch-build.yml
aminya Jul 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions script/vsts/nightly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ jobs:
ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ]

steps:
- task: NodeTool@0
inputs:
versionSpec: 12.13.1
displayName: Install Node.js 12.13.1
- template: platforms/templates/preparation.yml

#This has to be done separately because VSTS inexplicably
#exits the script block after `npm install` completes.
Expand Down Expand Up @@ -74,23 +71,15 @@ jobs:
vmImage: macos-10.14

steps:
- task: NodeTool@0
inputs:
versionSpec: 12.13.1
displayName: Install Node.js 12.13.1
- template: platforms/templates/preparation.yml

- script: npm install --global [email protected]
displayName: Update npm
- template: platforms/templates/bootstrap.yml

- script: |
script/bootstrap
displayName: Bootstrap

- script: |
- script: |
cd script/lib
npm install
displayName: npm install
- script: |
- script: |
cd script/lib/update-dependency
node index.js
displayName: Bump depedencies
Expand Down
107 changes: 17 additions & 90 deletions script/vsts/platforms/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,105 +7,32 @@ jobs:
pool:
# This image is used to host the Docker container that runs the build
vmImage: ubuntu-16.04
container: ubuntu:trusty

steps:
- script: |
sudo apt-get update
sudo apt-get install -y wget software-properties-common
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main"
sudo apt-get update
sudo apt-get install -y build-essential ca-certificates clang-5.0 xvfb fakeroot git libsecret-1-dev rpm libx11-dev libxkbfile-dev xz-utils xorriso zsync libxss1 libgconf2-4 libgtk-3-0 libasound2 libicu-dev
displayName: Install apt dependencies
- template: templates/preparation.yml

- script: sudo /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16
displayName: Start Xvfb

- task: NodeTool@0
inputs:
versionSpec: 12.13.1
displayName: Install Node.js 12.13.1

- script: npm install --global [email protected]
displayName: Update npm

- template: cache.yml
- template: templates/cache.yml
parameters:
OS: linux

- script: script/bootstrap
displayName: Bootstrap build environment
env:
CI: true
CI_PROVIDER: VSTS
CC: clang-5.0
CXX: clang++-5.0
npm_config_clang: 1
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'))
- template: templates/bootstrap.yml

- script: script/lint
displayName: Run linter

- script: script/build --no-bootstrap --create-debian-package --create-rpm-package --compress-artifacts
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
ATOM_RELEASE_VERSION: $(ReleaseVersion)
CC: clang-5.0
CXX: clang++-5.0
npm_config_clang: 1
displayName: Build Atom

- script: |
sudo chown root ./out/atom*-amd64/chrome-sandbox
sudo chmod 4755 ./out/atom*-amd64/chrome-sandbox
displayName: Tweaking chrome-sandbox binary

- script: script/test
env:
CI: true
CI_PROVIDER: VSTS
ATOM_JASMINE_REPORTER: list
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit
DISPLAY: :99.0
displayName: Run tests
condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true'))
- template: templates/build.yml

- script: script/postprocess-junit-results --search-folder "${TEST_JUNIT_XML_ROOT}" --test-results-files "**/*.xml"
env:
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit
displayName: Post-process test results
condition: ne(variables['Atom.SkipTests'], 'true')
- template: templates/test.yml

- task: PublishTestResults@2
inputs:
testResultsFormat: JUnit
searchFolder: $(Common.TestResultsDirectory)/junit
testResultsFiles: '**/*.xml'
mergeTestResults: true
testRunTitle: Linux
condition: ne(variables['Atom.SkipTests'], 'true')

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.SourcesDirectory)/out/atom.x86_64.rpm
ArtifactName: atom.x86_64.rpm
ArtifactType: Container
displayName: Upload atom.x84_64.rpm
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.SourcesDirectory)/out/atom-amd64.deb
ArtifactName: atom-amd64.deb
ArtifactType: Container
displayName: Upload atom-amd64.deb
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.SourcesDirectory)/out/atom-amd64.tar.gz
ArtifactName: atom-amd64.tar.gz
ArtifactType: Container
displayName: Upload atom-amd64.tar.gz
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- template: templates/publish.yml
parameters:
artifacts:
- filename: atom.x86_64.rpm
dir: $(Build.SourcesDirectory)/out
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- filename: atom-amd64.deb
dir: $(Build.SourcesDirectory)/out
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- filename: atom-amd64.tar.gz
dir: $(Build.SourcesDirectory)/out
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
155 changes: 25 additions & 130 deletions script/vsts/platforms/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,76 +12,35 @@ jobs:
vmImage: macos-10.14

steps:
- task: NodeTool@0
inputs:
versionSpec: 12.13.1
displayName: Install Node.js 12.13.1
- template: templates/preparation.yml

- script: npm install --global [email protected]
displayName: Update npm

- template: cache.yml
- template: templates/cache.yml
parameters:
OS: macos

- script: script/bootstrap
displayName: Bootstrap build environment
env:
CI: true
CI_PROVIDER: VSTS
NPM_BIN_PATH: /usr/local/bin/npm
npm_config_build_from_source: true
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'))
- template: templates/bootstrap.yml

- script: script/lint
displayName: Run linter

- script: |
if [ $SHOULD_SIGN == "true" ] && ([ $IS_RELEASE_BRANCH == "true" ] || [ $IS_SIGNED_ZIP_BRANCH == "true" ]); then
script/build --no-bootstrap --code-sign --compress-artifacts
else
script/build --no-bootstrap --compress-artifacts
fi
displayName: Build Atom
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
IS_RELEASE_BRANCH: $(IsReleaseBranch)
IS_SIGNED_ZIP_BRANCH: $(IsSignedZipBranch)
ATOM_RELEASE_VERSION: $(ReleaseVersion)
ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL: $(ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL)
ATOM_MAC_CODE_SIGNING_CERT_PASSWORD: $(ATOM_MAC_CODE_SIGNING_CERT_PASSWORD)
ATOM_MAC_CODE_SIGNING_KEYCHAIN: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN)
ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD)
AC_USER: $(AC_USER)
AC_PASSWORD: $(AC_PASSWORD)
- template: templates/build.yml

- script: |
cp $(Build.SourcesDirectory)/out/*.zip $(Build.ArtifactStagingDirectory)
displayName: Stage Artifacts

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac.zip
ArtifactName: atom-mac.zip
ArtifactType: Container
displayName: Upload atom-mac.zip
condition: succeeded()

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac-symbols.zip
ArtifactName: atom-mac-symbols.zip
ArtifactType: Container
displayName: Upload atom-mac-symbols.zip
condition: succeeded()

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.SourcesDirectory)/docs/output/atom-api.json
ArtifactName: atom-api.json
ArtifactType: Container
displayName: Upload atom-api.json
condition: succeeded()
- template: templates/publish.yml
parameters:
artifacts:
- filename: atom-mac.zip
dir: $(Build.ArtifactStagingDirectory)
condition: succeeded()
- filename: atom-mac-symbols.zip
dir: $(Build.ArtifactStagingDirectory)
condition: succeeded()
- filename: atom-api.json
dir: $(Build.SourcesDirectory)/docs/output
condition: succeeded()

- job: macOS_tests
displayName: macOS test
Expand All @@ -103,84 +62,20 @@ jobs:
RunPackageTests: 2

steps:
- task: NodeTool@0
inputs:
versionSpec: 12.13.1
displayName: Install Node.js 12.13.1

- script: npm install --global [email protected]
displayName: Update npm
- template: templates/preparation.yml

- template: cache.yml
- template: templates/cache.yml
parameters:
OS: macos

# The artifact caching task does not work on forks, so we need to
# bootstrap again for pull requests coming from forked repositories.
- script: script/bootstrap
displayName: Bootstrap build environment
env:
CI: true
CI_PROVIDER: VSTS
NPM_BIN_PATH: /usr/local/bin/npm
npm_config_build_from_source: true
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'))

- task: DownloadBuildArtifacts@0
displayName: Download atom-mac.zip
inputs:
artifactName: 'atom-mac.zip'
downloadPath: $(Build.SourcesDirectory)

- script: unzip atom-mac.zip/atom-mac.zip -d out
displayName: Unzip atom-mac.zip
- template: templates/bootstrap.yml

- task: DownloadBuildArtifacts@0
displayName: Download atom-mac-symbols.zip
inputs:
artifactName: 'atom-mac-symbols.zip'
downloadPath: $(Build.SourcesDirectory)

- script: unzip atom-mac-symbols.zip/atom-mac-symbols.zip -d out
displayName: Unzip atom-mac-symbols.zip

- script: |
osascript -e 'tell application "System Events" to keystroke "x"' # clear screen saver
caffeinate -s script/test # Run with caffeinate to prevent screen saver
env:
CI: true
CI_PROVIDER: VSTS
ATOM_JASMINE_REPORTER: list
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit
ATOM_RUN_CORE_TESTS: $(RunCoreTests)
ATOM_RUN_PACKAGE_TESTS: $(RunPackageTests)
displayName: Run tests
condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true'))

- script: script/postprocess-junit-results --search-folder "${TEST_JUNIT_XML_ROOT}" --test-results-files "**/*.xml"
env:
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit
displayName: Post-process test results
condition: ne(variables['Atom.SkipTests'], 'true')

- task: PublishTestResults@2
inputs:
testResultsFormat: JUnit
searchFolder: $(Common.TestResultsDirectory)/junit
testResultsFiles: '**/*.xml'
mergeTestResults: true
testRunTitle: MacOS
condition: ne(variables['Atom.SkipTests'], 'true')

- script: |
mkdir -p $(Build.ArtifactStagingDirectory)/crash-reports
cp ${HOME}/Library/Logs/DiagnosticReports/*.crash $(Build.ArtifactStagingDirectory)/crash-reports
displayName: Stage Crash Reports
condition: failed()
- template: templates/download-unzip.yml
parameters:
artifacts:
- atom-mac.zip
- atom-mac-symbols.zip

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports
ArtifactName: crash-reports.zip
displayName: Upload Crash Reports
condition: failed()
- template: templates/test.yml
31 changes: 31 additions & 0 deletions script/vsts/platforms/templates/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
steps:
- pwsh: |
# OS specific env variables
if ($env:AGENT_OS -eq "Windows_NT") {
$env:NPM_BIN_PATH="C:/hostedtoolcache/windows/node/12.13.1/x64/npm.cmd"
$env:npm_config_build_from_source=true
}
if ($env:AGENT_OS -eq "Darwin") {
$env:NPM_BIN_PATH="/usr/local/bin/npm"
$env:npm_config_build_from_source=true
}
if ($env:AGENT_OS -eq "Linux") {
$env:NPM_BIN_PATH="/usr/local/bin/npm"
$env:CC=clang
$env:CXX=clang++
$env:npm_config_clang=1
}

# Bootstrap
if (($env:AGENT_OS -eq "Windows_NT") -and ($env:BUILD_ARCH -eq "x86")) {
node 'script\vsts\windows-run.js' 'script\bootstrap.cmd'
}
else {
script/bootstrap
}
displayName: Bootstrap build environment
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
CI: true
CI_PROVIDER: VSTS
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'))
Copy link
Member

@DeeDeeG DeeDeeG Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indentation makes condition and env variable. Bootstrapping always runs.

We should indent it two spaces less, toward the left.

(We should change this on master now, I guess.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. I will fix it!

Loading