82 lines
2.4 KiB
YAML
82 lines
2.4 KiB
YAML
# builds core artifacts, intended to be attached to releases
|
|
# or used by other workflows
|
|
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
# automatically cancel in-progress builds if another commit is pushed
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
# default to 0 permissions
|
|
# (job-level overrides add the minimal permissions needed)
|
|
permissions:
|
|
contents: none
|
|
|
|
env:
|
|
# tell scripts where to put artifacts
|
|
BUILD_ARTIFACTSTAGINGDIRECTORY: '${{ github.workspace }}/artifacts'
|
|
|
|
jobs:
|
|
archive:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
fetch-depth: 5
|
|
persist-credentials: false
|
|
submodules: true
|
|
- name: Create source archive
|
|
run: |
|
|
mkdir -p "${BUILD_ARTIFACTSTAGINGDIRECTORY}"
|
|
tar \
|
|
-czvf \
|
|
/tmp/LightGBM-complete_source_code_tar_gz.tar.gz \
|
|
.
|
|
mv \
|
|
/tmp/LightGBM-complete_source_code_tar_gz.tar.gz \
|
|
${BUILD_ARTIFACTSTAGINGDIRECTORY}/
|
|
- name: Create commit.txt
|
|
shell: bash
|
|
run: |
|
|
# for pull requests, github.sha refers to the merge commit from merging the PR and
|
|
# target branch... we want the actual commit that was pushed
|
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
|
COMMIT_SHA="${{ github.event.pull_request.head.sha }}"
|
|
else
|
|
COMMIT_SHA="${{ github.sha }}"
|
|
fi
|
|
echo "${COMMIT_SHA}" > "${BUILD_ARTIFACTSTAGINGDIRECTORY}/commit.txt"
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: source-archive
|
|
path: |
|
|
${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}/commit.txt
|
|
${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}/LightGBM-complete_source_code_tar_gz.tar.gz
|
|
if-no-files-found: error
|
|
all-build-jobs-successful:
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- archive
|
|
permissions:
|
|
statuses: read
|
|
steps:
|
|
- name: Note that all tests succeeded
|
|
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
|
|
with:
|
|
jobs: ${{ toJSON(needs) }}
|