diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-11-06 23:52:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-06 23:52:56 +0000 |
commit | 43d1afbeeb9cba0ce1281a9cf2223b5bd71664d2 (patch) | |
tree | 874e6352f8733ee61a28170bb171eb6acb6e5e19 | |
parent | 3957a2555dbd81271d3e29a2f0b8f07258037e7b (diff) | |
download | alacritty-43d1afbeeb9cba0ce1281a9cf2223b5bd71664d2.tar.gz alacritty-43d1afbeeb9cba0ce1281a9cf2223b5bd71664d2.zip |
Migrate from Travis CI to GitHub Actions
This removes all CI builds from travis-ci, due to their recent changes
in policy and harsh limitations on builds. With build times over 2
hours, it was a significant hindrance to development.
Instead of Travis CI, the CI is now split on Sourcehut and GitHub. Since
Sourcehut only supports Linux/BSD, all builds on those operating systems
are executed there. The GitHub Actions CI is used to build for
Windows/macOS, which are not available on Sourcehut.
Since asset deployment for releases requires builds on all platforms,
this is also done on GitHub actions. Though the new `upload_asset.sh`
script makes sure that migration in the future is fairly simple and we
do not tie ourselves to the overly complicated GitHub Actions ecosystem.
-rw-r--r-- | .builds/freebsd.yml | 30 | ||||
-rw-r--r-- | .builds/linux.yml | 40 | ||||
-rw-r--r-- | .builds/rustfmt.yml | 10 | ||||
-rw-r--r-- | .github/workflows/ci.yml | 38 | ||||
-rw-r--r-- | .github/workflows/release.yml | 81 | ||||
-rwxr-xr-x | .github/workflows/upload_asset.sh | 93 | ||||
-rw-r--r-- | .travis.yml | 75 | ||||
-rwxr-xr-x | ci/before_deploy.sh | 54 | ||||
-rwxr-xr-x | ci/install.sh | 6 | ||||
-rwxr-xr-x | ci/script.sh | 16 | ||||
-rw-r--r-- | extra/windows/wix/alacritty.wxs | 17 |
11 files changed, 276 insertions, 184 deletions
diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index 10f0333a..ec2e1616 100644 --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -1,4 +1,5 @@ image: freebsd/latest + packages: - devel/cmake - devel/pkgconf @@ -7,21 +8,30 @@ packages: - x11-fonts/fontconfig - x11-fonts/dejavu - x11/libxcb + sources: - https://github.com/alacritty/alacritty + +environment: + PATH: /home/build/.cargo/bin:/bin:/usr/bin:/usr/local/bin + tasks: - rustup: | curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal - $HOME/.cargo/bin/rustup toolchain install --profile minimal 1.43.1 - - 1-43-1: | + - test: | cd alacritty - $HOME/.cargo/bin/cargo +1.43.1 test - - 1-43-1-wayland: | + cargo test + - clippy: | + cd alacritty + rustup component add clippy + cargo clippy --all-targets + - oldstable: | + cd alacritty + rustup toolchain install --profile minimal 1.43.1 + cargo +1.43.1 test + - feature-wayland: | cd alacritty/alacritty - $HOME/.cargo/bin/cargo +1.43.1 test --no-default-features --features=wayland - - 1-43-1-x11: | + cargo test --no-default-features --features=wayland + - feature-x11: | cd alacritty/alacritty - $HOME/.cargo/bin/cargo +1.43.1 test --no-default-features --features=x11 - - stable: | - cd alacritty - $HOME/.cargo/bin/cargo +stable test + cargo test --no-default-features --features=x11 diff --git a/.builds/linux.yml b/.builds/linux.yml new file mode 100644 index 00000000..90c31836 --- /dev/null +++ b/.builds/linux.yml @@ -0,0 +1,40 @@ +image: archlinux + +packages: + - pkg-config + - cmake + - make + - freetype2 + - fontconfig + - libxcb + +sources: + - https://github.com/alacritty/alacritty + +environment: + PATH: /home/build/.cargo/bin:/usr/bin/ + +tasks: + - rustup: | + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal + - test: | + cd alacritty + cargo test + - rustfmt: | + cd alacritty + rustup toolchain install nightly -c rustfmt + cargo +nightly fmt -- --check + - clippy: | + cd alacritty + rustup component add clippy + cargo clippy --all-targets + - oldstable: | + cd alacritty + rustup toolchain install --profile minimal 1.43.1 + cargo +1.43.1 test + - feature-wayland: | + cd alacritty/alacritty + cargo +1.43.1 test --no-default-features --features=wayland + - feature-x11: | + cd alacritty/alacritty + cargo +1.43.1 test --no-default-features --features=x11 diff --git a/.builds/rustfmt.yml b/.builds/rustfmt.yml deleted file mode 100644 index 52836217..00000000 --- a/.builds/rustfmt.yml +++ /dev/null @@ -1,10 +0,0 @@ -image: archlinux -sources: - - https://github.com/alacritty/alacritty -tasks: - - rustup: | - curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain none - $HOME/.cargo/bin/rustup toolchain install nightly -c rustfmt - - rustfmt: | - cd alacritty - $HOME/.cargo/bin/cargo fmt -- --check diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..7086f1cd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + strategy: + matrix: + rust_version: [stable, 1.43.1] + os: [windows-latest, macos-latest] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + - name: Rustup + run: rustup default ${{ matrix.rust_version }} + - name: Test + run: cargo test + + clippy: + strategy: + matrix: + os: [windows-latest, macos-latest] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + - name: Rustup + run: rustup default ${{ matrix.rust_version }} + - name: Install Clippy + run: rustup component add clippy + - name: Lint + run: cargo clippy --all-targets --manifest-path ./alacritty/Cargo.toml --no-default-features --features "x11 wayland" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..d1a9848c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,81 @@ +name: Release + +on: + push: + tags: ["v[0-9]+.[0-9]+.[0-9]+"] + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CARGO_TERM_COLOR: always + +jobs: + macos: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + - name: Test + run: cargo test --release + - name: Make App + run: make dmg + - name: Upload Application + run: | + mv ./target/release/osx/Alacritty.dmg ./Alacritty-${GITHUB_REF##*/}.dmg + ./.github/workflows/upload_asset.sh ./Alacritty-${GITHUB_REF##*/}.dmg $GITHUB_TOKEN + + windows: + runs-on: windows-latest + + defaults: + run: + shell: bash + + steps: + - uses: actions/checkout@v2 + - name: Test + run: cargo test --release + - name: Build + run: cargo build --release + - name: Upload portable executable + run: | + cp ./target/release/alacritty.exe ./Alacritty-${GITHUB_REF##*/}-portable.exe + ./.github/workflows/upload_asset.sh \ + ./Alacritty-${GITHUB_REF##*/}-portable.exe $GITHUB_TOKEN + - name: Install WiX + run: nuget install WiX + - name: Crate msi installer + run: | + ./WiX.*/tools/candle.exe -nologo -arch "x64" -ext WixUIExtension -ext WixUtilExtension \ + -out "./alacritty.wixobj" "extra/windows/wix/alacritty.wxs" + ./WiX.*/tools/light.exe -nologo -ext WixUIExtension -ext WixUtilExtension \ + -out "./Alacritty-${GITHUB_REF##*/}-installer.msi" -sice:ICE61 -sice:ICE91 \ + "./alacritty.wixobj" + - name: Upload msi installer + run: | + ./.github/workflows/upload_asset.sh \ + ./Alacritty-${GITHUB_REF##*/}-installer.msi $GITHUB_TOKEN + + linux: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get install cmake pkg-config libfreetype6-dev libfontconfig1-dev \ + libxcb-xfixes0-dev python3 + - name: Test + run: cargo test --release + - name: Gzip manpage + run: gzip -c "./extra/alacritty.man" > "./alacritty.1.gz" + - name: Upload Assets + run: | + mv ./extra/logo/alacritty-term.svg ./Alacritty.svg + ./.github/workflows/upload_asset.sh ./Alacritty.svg $GITHUB_TOKEN + ./.github/workflows/upload_asset.sh ./alacritty.1.gz $GITHUB_TOKEN + ./.github/workflows/upload_asset.sh ./extra/completions/alacritty.bash $GITHUB_TOKEN + ./.github/workflows/upload_asset.sh ./extra/completions/alacritty.fish $GITHUB_TOKEN + ./.github/workflows/upload_asset.sh ./extra/completions/_alacritty $GITHUB_TOKEN + ./.github/workflows/upload_asset.sh ./extra/linux/Alacritty.desktop $GITHUB_TOKEN + ./.github/workflows/upload_asset.sh ./extra/alacritty.info $GITHUB_TOKEN + ./.github/workflows/upload_asset.sh ./alacritty.yml $GITHUB_TOKEN diff --git a/.github/workflows/upload_asset.sh b/.github/workflows/upload_asset.sh new file mode 100755 index 00000000..3005e707 --- /dev/null +++ b/.github/workflows/upload_asset.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +# Assure parameters are correct. +if [ $# -lt 2 ]; then + echo "Usage: upload_asset.sh <FILE> <TOKEN>" + exit 1 +fi + +repo="alacritty/alacritty" +file_path=$1 +bearer=$2 + +echo "Starting asset upload from $file_path to $repo." + +# Get the release for this tag. +tag="$(git describe --tags --abbrev=0)" + +# Make sure the git tag could be determined. +if [ -z "$tag" ]; then + printf "\e[31mError: Unable to find git tag\e[0m\n" + exit 1 +fi + +echo "Git tag: $tag" + +# Get the upload URL for the current tag. +# +# Since this might be a draft release, we can't just use the /releases/tags/:tag +# endpoint which only shows published releases. +echo "Checking for existing release..." +upload_url=$(\ + curl \ + -H "Authorization: Bearer $bearer" \ + "https://api.github.com/repos/$repo/releases" \ + 2> /dev/null \ + | grep -E "(upload_url|tag_name)" \ + | paste - - \ + | grep -e "tag_name\": \"$tag" \ + | head -n 1 \ + | sed 's/.*\(https.*assets\).*/\1/' \ +) + +# Create a new release if we didn't find one for this tag. +if [ -z "$upload_url" ]; then + echo "No release found." + echo "Creating new release..." + + # Create new release. + response=$( + curl -f \ + -X POST \ + -H "Authorization: Bearer $bearer" \ + -d "{\"tag_name\":\"$tag\",\"draft\":true}" \ + "https://api.github.com/repos/$repo/releases" \ + 2> /dev/null\ + ) + + # Abort if the release could not be created. + if [ $? -ne 0 ]; then + printf "\e[31mError: Unable to create new release.\e[0m\n" + exit 1; + fi + + # Extract upload URL from new release. + upload_url=$(\ + echo "$response" \ + | grep "upload_url" \ + | sed 's/.*: "\(.*\){.*/\1/' \ + ) +fi + +# Propagate error if no URL for asset upload could be found. +if [ -z "$upload_url" ]; then + printf "\e[31mError: Unable to find release upload url.\e[0m\n" + exit 2 +fi + +# Upload the file to the tag's release. +file_name=${file_path##*/} +echo "Uploading asset $file_name to $upload_url..." +curl -f \ + -X POST \ + -H "Authorization: Bearer $bearer" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @"$file_path" \ + "$upload_url?name=$file_name" \ + &> /dev/null \ +|| { \ + printf "\e[31mError: Unable to upload asset.\e[0m\n" \ + && exit 3; \ +} + +printf "\e[32mSuccess\e[0m\n" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d4903940..00000000 --- a/.travis.yml +++ /dev/null @@ -1,75 +0,0 @@ -language: rust - -addons: - apt: - packages: - - libxcb-xfixes0-dev - -git: - depth: 1 - -os: - - linux - - osx - -rust: - - 1.43.1 - - stable - -matrix: - fast_finish: true - include: - - if: tag IS present - os: linux - rust: stable - env: ARCH=i386 - - name: "Clippy Linux" - os: linux - env: CLIPPY=true - rust: 1.43.1 - - name: "Clippy OSX" - os: osx - env: CLIPPY=true - rust: 1.43.1 - - name: "Clippy Windows" - os: windows - env: CLIPPY=true - rust: 1.43.1-x86_64-pc-windows-msvc - - name: "Windows 1.43.1" - os: windows - rust: 1.43.1-x86_64-pc-windows-msvc - - name: "Windows Stable" - os: windows - rust: stable-x86_64-pc-windows-msvc - -install: ci/install.sh -script: ci/script.sh -before_deploy: ci/before_deploy.sh - -deploy: - - provider: releases - api_key: - secure: G6JZgC5qKZyxEmuu2eMscDO45iOhBjiCSKuO8gxywqm+4DbMZm7y2OSbQCEmnIFqEgi+DLkrH/A7e8LDngQj3lBvRnWkIcszG5ubDm8jsqckXXxjI0cy5q8jJ7s5zZXH2IdXifY59KN9V4iHPwCJlyEE7Aj9JrJLFaVhvaowlSYib9DuDibDX/2u8qZ+gP2D/TntiBlFi8SgiDPd7GrZWmNsxJR9edyYbKx9izROp+4q7KAa0Xqak/Zvg72JZnARiKPmBxESEoYYXFcRgRZD9VvjmQ/il6WcHlGSqqn1TRBtIVl8L/1I5/xBJ6KMegP9Jlh7ybm1JPfX108V5d9a9CyqvRYHrhbkHkf5oktizsgw2WyANwiBhEngliMFuUyT0826BEPtkA4TiD7lQXyvO749INdJsqUlMLLuQNpU9/7ShBcRapbGp6AjWH8yxV9ciNMpNexAaxkupYc2NaU6EAC/C34HAtTdfN+gyvrtnF1ISrPmmGj8YQRiBUsa4TxghsNPbPHWAgMfR5lFp3dONz0oIydhW/AFgpn+7BVvoIW2z8hXiRttseZHv6akeSjFC5vYObR3UdL/NiuvCjZRiYryL0Be/rI83ug8xELVFBBcv4PxcHEsXWT7EMd3QTiPoCwNKoSoBLk8hPFPAGRXULiSDFENKoJAc4A7zJyMiYY= - skip_cleanup: true - file_glob: true - file: "./target/deploy/*" - on: - tags: true - rust: stable - condition: - - $CLIPPY != true - - $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ - repo: alacritty/alacritty - - provider: releases - api_key: - secure: G6JZgC5qKZyxEmuu2eMscDO45iOhBjiCSKuO8gxywqm+4DbMZm7y2OSbQCEmnIFqEgi+DLkrH/A7e8LDngQj3lBvRnWkIcszG5ubDm8jsqckXXxjI0cy5q8jJ7s5zZXH2IdXifY59KN9V4iHPwCJlyEE7Aj9JrJLFaVhvaowlSYib9DuDibDX/2u8qZ+gP2D/TntiBlFi8SgiDPd7GrZWmNsxJR9edyYbKx9izROp+4q7KAa0Xqak/Zvg72JZnARiKPmBxESEoYYXFcRgRZD9VvjmQ/il6WcHlGSqqn1TRBtIVl8L/1I5/xBJ6KMegP9Jlh7ybm1JPfX108V5d9a9CyqvRYHrhbkHkf5oktizsgw2WyANwiBhEngliMFuUyT0826BEPtkA4TiD7lQXyvO749INdJsqUlMLLuQNpU9/7ShBcRapbGp6AjWH8yxV9ciNMpNexAaxkupYc2NaU6EAC/C34HAtTdfN+gyvrtnF1ISrPmmGj8YQRiBUsa4TxghsNPbPHWAgMfR5lFp3dONz0oIydhW/AFgpn+7BVvoIW2z8hXiRttseZHv6akeSjFC5vYObR3UdL/NiuvCjZRiYryL0Be/rI83ug8xELVFBBcv4PxcHEsXWT7EMd3QTiPoCwNKoSoBLk8hPFPAGRXULiSDFENKoJAc4A7zJyMiYY= - skip_cleanup: true - file_glob: true - file: "./target/deploy/*" - on: - tags: true - rust: stable-x86_64-pc-windows-msvc - condition: - - $CLIPPY != true - - $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ - repo: alacritty/alacritty diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh deleted file mode 100755 index c2a335e1..00000000 --- a/ci/before_deploy.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -# All files which should be added only if they changed -aux_files=("extra/completions/alacritty.bash" - "extra/completions/alacritty.fish" - "extra/completions/_alacritty" - "extra/linux/Alacritty.desktop" - "extra/alacritty.info" - "alacritty.yml") - -# Output binary name -name="Alacritty-${TRAVIS_TAG}" - -# Everything in this directory will be offered as download for the release -mkdir "./target/deploy" - -function windows { - choco install 7zip nuget.commandline - nuget install WiX - - # Create zip archive - 7z a -tzip "./target/deploy/${name}-windows-portable.zip" "./target/release/alacritty.exe" \ - "./target/release/winpty-agent.exe" - - # Create msi installer - ./WiX.*/tools/candle.exe -nologo -arch "x64" -ext WixUIExtension -ext WixUtilExtension -out \ - "target/alacritty.wixobj" "extra/windows/wix/alacritty.wxs" - ./WiX.*/tools/light.exe -nologo -ext WixUIExtension -ext WixUtilExtension -out \ - "target/installer.msi" -sice:ICE61 -sice:ICE91 "target/alacritty.wixobj" - mv "target/installer.msi" "target/deploy/${name}-windows-installer.msi" -} - -function osx { - rm -rf "./target/release" \ - && make dmg \ - && mv "./target/release/osx/Alacritty.dmg" "./target/deploy/${name}.dmg" -} - -if [ "$TRAVIS_OS_NAME" == "osx" ]; then - osx || exit -elif [ "$TRAVIS_OS_NAME" == "windows" ]; then - windows -fi - -# Convert and add manpage if it changed -gzip -c "./extra/alacritty.man" > "./target/deploy/alacritty.1.gz" || exit - -# Rename Alacritty logo to match .desktop file -cp "./extra/logo/alacritty-term.svg" "./target/deploy/Alacritty.svg" || exit - -# Offer various other files -for file in "${aux_files[@]}"; do - cp $file "./target/deploy/" || exit -done diff --git a/ci/install.sh b/ci/install.sh deleted file mode 100755 index ad62a190..00000000 --- a/ci/install.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -# Add clippy for lint validation -if [ "$CLIPPY" == "true" ]; then - rustup component add clippy -fi diff --git a/ci/script.sh b/ci/script.sh deleted file mode 100755 index cc4656ae..00000000 --- a/ci/script.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# Run clippy checks -if [ "$CLIPPY" == "true" ]; then - cargo clippy --all-targets - exit -fi - -# Run test in release mode if a tag is present, to produce an optimized binary -if [ -n "$TRAVIS_TAG" ]; then - # Build separately so we generate an 'alacritty' binary without -HASH appended - cargo build --release - cargo test --release -else - cargo test -fi diff --git a/extra/windows/wix/alacritty.wxs b/extra/windows/wix/alacritty.wxs index c91a9a9e..ad90179a 100644 --- a/extra/windows/wix/alacritty.wxs +++ b/extra/windows/wix/alacritty.wxs @@ -1,19 +1,16 @@ <?xml version="1.0" encoding="windows-1252"?> -<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" - xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> - +<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> <Product Name="Alacritty" Id="*" UpgradeCode="87c21c74-dbd5-4584-89d5-46d9cd0c40a7" Language="1033" Codepage="1252" Version="0.6.0-dev" Manufacturer="Alacritty"> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"/> <MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed."/> - <Icon Id="AlacrittyIco" SourceFile="..\extra\windows\alacritty.ico"/> - <WixVariable Id="WixUILicenseRtf" Value="..\extra\windows\wix\license.rtf"/> + <Icon Id="AlacrittyIco" SourceFile=".\extra\windows\alacritty.ico"/> + <WixVariable Id="WixUILicenseRtf" Value=".\extra\windows\wix\license.rtf"/> <Property Id="ARPPRODUCTICON" Value="AlacrittyIco"/> <MediaTemplate EmbedCab="yes"/> <UIRef Id="WixUI_Minimal"/> <Feature Id="ProductFeature" Title="ConsoleApp" Level="1"> <ComponentRef Id="AlacrittyExe"/> - <ComponentRef Id="WinPtyAgentExe"/> <ComponentRef Id="AlacrittyShortcut"/> <ComponentRef Id="ModifyPathEnv"/> <ComponentRef Id="ContextMenu"/> @@ -32,10 +29,7 @@ <!-- Application binaries --> <DirectoryRef Id="AlacrittyProgramFiles"> <Component Id="AlacrittyExe" Guid="*"> - <File Id="AlacrittyExeFile" Source="..\target\release\alacritty.exe" Name="alacritty.exe" KeyPath="yes"/> - </Component> - <Component Id="WinPtyAgentExe" Guid="*"> - <File Id="WinPtyAgentExeFile" Source="..\target\release\winpty-agent.exe" Name="winpty-agent.exe" KeyPath="yes"/> + <File Id="AlacrittyExeFile" Source=".\target\release\alacritty.exe" Name="alacritty.exe" KeyPath="yes"/> </Component> </DirectoryRef> @@ -67,7 +61,4 @@ </Component> </DirectoryRef> </Product> - </Wix> - - |