mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-10 06:34:16 +00:00
ci: update upload-artifact to v4.3.0 and download-artifact to v4.1.1 (#1399)
* ci: update upload-artifact to v4.3.0 and download-artifact to v4.1.1 * fix rpm/deb * add exception for quay; idk what I'll do once node support is gone * fix broken script * fix download * migrate 2-17 to cirrus to avoid node deprecation warnings * prevent cirrus cancellation * update cache to work with linux * simplify cache * update some comments * add timeouts
This commit is contained in:
parent
a377e93ecc
commit
db9e97a0df
5 changed files with 51 additions and 38 deletions
16
.cirrus.yml
16
.cirrus.yml
|
@ -15,15 +15,16 @@ cache_template: &CACHE_TEMPLATE
|
|||
folder: $HOME/.cargo/registry
|
||||
reupload_on_changes: "true"
|
||||
fingerprint_script:
|
||||
- md5 Cargo.lock
|
||||
- $HOME/.cargo/bin/rustc --version
|
||||
- cat Cargo.lock
|
||||
- echo $CIRRUS_OS
|
||||
- echo $CIRRUS_TASK_NAME
|
||||
target_cache:
|
||||
folder: target
|
||||
reupload_on_changes: "true"
|
||||
fingerprint_script:
|
||||
- . $HOME/.cargo/env && rustc --version
|
||||
- md5 Cargo.lock
|
||||
- $HOME/.cargo/bin/rustc --version
|
||||
- cat Cargo.lock
|
||||
- echo $CIRRUS_OS
|
||||
- echo $CIRRUS_TASK_NAME
|
||||
|
||||
|
@ -39,7 +40,7 @@ env:
|
|||
CARGO_HUSKY_DONT_INSTALL_HOOKS: "true"
|
||||
|
||||
test_task:
|
||||
auto_cancellation: $CIRRUS_BRANCH != "main"
|
||||
auto_cancellation: "false" # We set this to false to prevent nightly builds from affecting this
|
||||
only_if: $CIRRUS_BUILD_SOURCE != "api" && ($CIRRUS_BRANCH == "main" || $CIRRUS_PR != "")
|
||||
timeout_in: "20m"
|
||||
skip: "!changesInclude('.cargo/**', '.cirrus.yml', 'sample_configs/**', 'src/**', 'tests/**', 'build.rs', 'Cargo.lock', 'Cargo.toml', 'clippy.toml', 'rustfmt.toml')"
|
||||
|
@ -100,6 +101,13 @@ build_task:
|
|||
env:
|
||||
TARGET: "aarch64-apple-darwin"
|
||||
NAME: "aarch64-apple-darwin"
|
||||
- name: "Legacy Linux (2.17)"
|
||||
alias: "linux_2_17_build"
|
||||
container:
|
||||
image: quay.io/pypa/manylinux2014_x86_64
|
||||
env:
|
||||
TARGET: "x86_64-unknown-linux-gnu"
|
||||
NAME: "x86_64-unknown-linux-gnu-2-17"
|
||||
<<: *SETUP_TEMPLATE
|
||||
<<: *CACHE_TEMPLATE
|
||||
build_script:
|
||||
|
|
31
.github/workflows/build_releases.yml
vendored
31
.github/workflows/build_releases.yml
vendored
|
@ -46,13 +46,6 @@ jobs:
|
|||
cross: false,
|
||||
generate-other-artifacts: true,
|
||||
}
|
||||
- {
|
||||
os: "ubuntu-20.04",
|
||||
target: "x86_64-unknown-linux-gnu",
|
||||
cross: false,
|
||||
container: quay.io/pypa/manylinux2014_x86_64,
|
||||
suffix: "2-17",
|
||||
}
|
||||
- {
|
||||
os: "ubuntu-20.04",
|
||||
target: "i686-unknown-linux-gnu",
|
||||
|
@ -211,15 +204,16 @@ jobs:
|
|||
cp ./desktop/bottom.desktop release/
|
||||
|
||||
- name: Save release as artifact
|
||||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
||||
with:
|
||||
retention-days: 3
|
||||
name: release
|
||||
name: "release-${{ matrix.info.target }}${{ matrix.info.suffix }}"
|
||||
path: release
|
||||
|
||||
build-msi:
|
||||
name: "Build MSI installer"
|
||||
runs-on: "windows-2019"
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
@ -257,15 +251,16 @@ jobs:
|
|||
mv bottom_x86_64_installer.msi release/
|
||||
|
||||
- name: Save release as artifact
|
||||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
||||
with:
|
||||
retention-days: 3
|
||||
name: release
|
||||
name: "release-build-msi"
|
||||
path: release
|
||||
|
||||
build-cirrus:
|
||||
name: "Build using Cirrus CI"
|
||||
runs-on: "ubuntu-latest"
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
@ -289,15 +284,16 @@ jobs:
|
|||
python ./scripts/cirrus/build.py "$BRANCH" "release/" "${{ inputs.caller }}"
|
||||
|
||||
- name: Save release as artifact
|
||||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
||||
with:
|
||||
retention-days: 3
|
||||
name: release
|
||||
name: release-build-cirrus
|
||||
path: release
|
||||
|
||||
build-deb:
|
||||
name: "Build .deb software packages"
|
||||
runs-on: "ubuntu-20.04"
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
@ -410,16 +406,17 @@ jobs:
|
|||
mv ${{ steps.verify.outputs.DEB_FILE }} release/
|
||||
|
||||
- name: Save release as artifact
|
||||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
||||
with:
|
||||
retention-days: 3
|
||||
name: release
|
||||
name: release-build-deb-${{ matrix.info.target }}
|
||||
path: release
|
||||
|
||||
build-rpm:
|
||||
name: "Build .rpm software packages"
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/clementtsang/almalinux-8
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
@ -494,8 +491,8 @@ jobs:
|
|||
mv ${{ steps.verify.outputs.RPM_FILE }} release/
|
||||
|
||||
- name: Save release as artifact
|
||||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
||||
with:
|
||||
retention-days: 3
|
||||
name: release
|
||||
name: release-build-rpm-${{ matrix.info.target }}
|
||||
path: release
|
||||
|
|
19
.github/workflows/deployment.yml
vendored
19
.github/workflows/deployment.yml
vendored
|
@ -1,6 +1,7 @@
|
|||
# How we deploy a release. Covers binary builds. Also manages packaging for choco.
|
||||
#
|
||||
# Based on https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/release.yml
|
||||
# Binaries are primarily built by GHA, though some Linux, M1 macOS, and FreeBSD builds are
|
||||
# handled by CirrusCI.
|
||||
|
||||
name: deployment
|
||||
|
||||
|
@ -67,10 +68,11 @@ jobs:
|
|||
echo "Release version: ${{ env.RELEASE_VERSION }}"
|
||||
|
||||
- name: Get release artifacts
|
||||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
||||
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
|
||||
with:
|
||||
name: release
|
||||
pattern: release-*
|
||||
path: release
|
||||
merge-multiple: true
|
||||
|
||||
- name: Execute choco packaging script
|
||||
run: |
|
||||
|
@ -83,10 +85,10 @@ jobs:
|
|||
mv choco.zip release/
|
||||
|
||||
- name: Save release as artifact
|
||||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
||||
with:
|
||||
retention-days: 3
|
||||
name: release
|
||||
name: release-choco
|
||||
path: release
|
||||
|
||||
upload-release:
|
||||
|
@ -104,17 +106,18 @@ jobs:
|
|||
echo "Release version: ${{ env.RELEASE_VERSION }}"
|
||||
|
||||
- name: Get release artifacts
|
||||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
||||
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
|
||||
with:
|
||||
name: release
|
||||
pattern: release-*
|
||||
path: release
|
||||
merge-multiple: true
|
||||
|
||||
- name: Print out all release files
|
||||
run: |
|
||||
echo "Generated $(ls ./release | wc -l) files:"
|
||||
du -h -d 0 ./release/*
|
||||
|
||||
- name: Upload all saved release files
|
||||
- name: Create release and add release files
|
||||
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # 0.1.15
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
7
.github/workflows/nightly.yml
vendored
7
.github/workflows/nightly.yml
vendored
|
@ -49,10 +49,11 @@ jobs:
|
|||
needs: [build-release]
|
||||
steps:
|
||||
- name: Get release artifacts
|
||||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
||||
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
|
||||
with:
|
||||
name: release
|
||||
pattern: release-*
|
||||
path: release
|
||||
merge-multiple: true
|
||||
|
||||
- name: Print out all release files
|
||||
run: |
|
||||
|
@ -72,7 +73,7 @@ jobs:
|
|||
run: sleep 10
|
||||
if: github.event.inputs.isMock != 'mock'
|
||||
|
||||
- name: Upload all saved release files if not mock
|
||||
- name: Add all release files to nightly release if not mock
|
||||
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # 0.1.15
|
||||
if: github.event.inputs.isMock != 'mock'
|
||||
with:
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
# through Cirrus CI's GraphQL interface.
|
||||
#
|
||||
# Expects the Cirrus CI API key to be set in the CIRRUS_KEY environment variable.
|
||||
#
|
||||
# TODO: Explain this in docs how the heck this works.
|
||||
|
||||
import os
|
||||
import json
|
||||
|
@ -12,16 +14,18 @@ import traceback
|
|||
from textwrap import dedent
|
||||
from time import sleep, time
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
from urllib.request import Request, urlopen, urlretrieve
|
||||
|
||||
URL = "https://api.cirrus-ci.com/graphql"
|
||||
TASKS = [
|
||||
("freebsd_12_3_build", "bottom_x86_64-unknown-freebsd-13-2.tar.gz"),
|
||||
("freebsd_13_1_build", "bottom_x86_64-unknown-freebsd-14-0.tar.gz"),
|
||||
# Form of each task is (TASK_ALIAS, FILE_NAME).
|
||||
TASKS: List[Tuple[str, str]] = [
|
||||
("freebsd_13_2_build", "bottom_x86_64-unknown-freebsd-13-2.tar.gz"),
|
||||
("freebsd_14_0_build", "bottom_x86_64-unknown-freebsd-14-0.tar.gz"),
|
||||
("macos_build", "bottom_aarch64-apple-darwin.tar.gz"),
|
||||
("linux_2_17_build", "bottom_x86_64-unknown-linux-gnu-2-17.tar.gz"),
|
||||
]
|
||||
URL = "https://api.cirrus-ci.com/graphql"
|
||||
DL_URL_TEMPLATE = "https://api.cirrus-ci.com/v1/artifact/build/%s/%s/binaries/%s"
|
||||
|
||||
|
||||
|
@ -104,7 +108,7 @@ def check_build_status(key: str, id: str) -> Optional[str]:
|
|||
def try_download(build_id: str, dl_path: Path):
|
||||
for task, file in TASKS:
|
||||
url = DL_URL_TEMPLATE % (build_id, task, file)
|
||||
out = dl_path / file
|
||||
out = os.path.join(dl_path, file)
|
||||
print("Downloading {} to {}".format(file, out))
|
||||
urlretrieve(url, out)
|
||||
|
||||
|
|
Loading…
Reference in a new issue