iced/.github/workflows/build.yml

495 lines
16 KiB
YAML
Raw Normal View History

2019-09-24 23:22:36 +00:00
name: GitHub CI
2020-07-10 15:20:31 +00:00
on:
push:
paths:
- ".github/workflows/build.yml"
2020-11-28 00:32:59 +00:00
- "build/**"
- "src/**"
- "!**/*.md"
2020-08-27 21:58:46 +00:00
branches:
- master
pull_request:
paths:
2020-11-28 00:32:59 +00:00
- "build/**"
- "src/**"
- "!**/*.md"
2020-07-10 15:20:31 +00:00
branches:
- master
2020-07-19 11:03:51 +00:00
release:
types: [released]
env:
2020-11-10 23:04:50 +00:00
CI_REQ_DOTNET_SDK_VER: 5.0.100
2020-11-28 17:04:00 +00:00
COVERAGE_FILENAME: coverage.net5.0.info
CI_NODE_MIN_VER: 10.0.0
RUSTFLAGS: -D warnings
2020-11-28 22:16:35 +00:00
MACOSX_DEPLOYMENT_TARGET: 10.12
2019-09-24 23:22:36 +00:00
jobs:
#############################################################################
#############################################################################
#############################################################################
2020-11-28 00:32:59 +00:00
build-dotnet:
name: C# (${{matrix.os}})
runs-on: ${{matrix.os}}
2019-11-28 01:13:45 +00:00
strategy:
matrix:
2020-11-28 00:32:59 +00:00
os: [windows-latest, ubuntu-latest, macos-latest]
2019-10-03 16:04:21 +00:00
2019-09-24 23:22:36 +00:00
steps:
2020-10-26 18:49:09 +00:00
- uses: actions/checkout@v2
2019-09-24 23:22:36 +00:00
- uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{env.CI_REQ_DOTNET_SDK_VER}}
2020-01-26 19:21:08 +00:00
2020-11-28 00:32:59 +00:00
- name: Build and test
shell: bash
2019-09-24 23:22:36 +00:00
run: |
2020-11-28 00:32:59 +00:00
extra_args=
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
extra_args=--quick-check
fi
./build/build-dotnet $extra_args
2019-09-24 23:22:36 +00:00
2020-10-26 18:49:09 +00:00
- uses: actions/upload-artifact@v2
2020-11-28 22:16:35 +00:00
if: startsWith(matrix.os, 'ubuntu-')
2019-09-24 23:22:36 +00:00
with:
name: nupkg
2020-11-28 00:32:59 +00:00
path: src/csharp/Intel/Iced/bin/Release/*.*nupkg
2020-10-26 18:49:09 +00:00
if-no-files-found: error
2019-09-25 17:56:12 +00:00
2020-10-26 18:49:09 +00:00
- uses: actions/upload-artifact@v2
2020-11-28 22:16:35 +00:00
if: startsWith(matrix.os, 'ubuntu-')
2019-10-05 15:57:58 +00:00
with:
name: coverage.info
2020-11-28 17:04:00 +00:00
path: src/csharp/Intel/Iced.UnitTests/${{env.COVERAGE_FILENAME}}
2020-10-26 18:49:09 +00:00
if-no-files-found: error
2019-10-05 15:57:58 +00:00
2020-11-28 00:32:59 +00:00
#############################################################################
#############################################################################
#############################################################################
build-rust:
name: Rust (${{matrix.os}})
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Install Rust
2019-10-05 13:52:24 +00:00
shell: bash
2020-11-28 00:32:59 +00:00
run: bash build/ci-install-rust.sh
2019-10-05 13:52:24 +00:00
2020-11-28 00:32:59 +00:00
- uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{env.CI_REQ_DOTNET_SDK_VER}}
- name: Build and test
shell: bash
2019-09-25 17:56:12 +00:00
run: |
2020-11-28 00:32:59 +00:00
extra_args=
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
extra_args=--quick-check
fi
./build/build-rust --no-set-rustflags $extra_args
2019-10-06 18:38:57 +00:00
2020-11-28 00:32:59 +00:00
#############################################################################
#############################################################################
#############################################################################
build-rust-js-wasm:
name: JavaScript (${{matrix.os}})
runs-on: ${{matrix.os}}
2019-11-28 01:13:45 +00:00
strategy:
matrix:
2020-11-28 00:32:59 +00:00
os: [windows-latest, ubuntu-latest, macos-latest]
2019-10-06 18:38:57 +00:00
steps:
2020-10-26 18:49:09 +00:00
- uses: actions/checkout@v2
2019-10-06 18:38:57 +00:00
2020-11-28 00:32:59 +00:00
- name: Install Rust
shell: bash
run: bash build/ci-install-rust.sh
- uses: actions/setup-node@v1
2020-01-03 21:12:14 +00:00
with:
2020-11-28 00:32:59 +00:00
node-version: ${{env.CI_NODE_MIN_VER}}
2020-01-03 21:12:14 +00:00
2020-11-28 00:32:59 +00:00
- name: Install wasm-pack
shell: bash
2020-11-28 00:32:59 +00:00
run: npm install -g wasm-pack
2019-11-23 19:36:32 +00:00
2020-11-28 00:32:59 +00:00
- name: Build and test
shell: bash
run: |
extra_args=
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
extra_args=--quick-check
fi
./build/build-js --no-set-rustflags $extra_args
#############################################################################
#############################################################################
#############################################################################
build-rust-python:
name: Python (${{matrix.os}})
runs-on: ${{matrix.os}}
2019-11-23 19:36:32 +00:00
strategy:
matrix:
2020-11-28 22:16:35 +00:00
os: [windows-latest, ubuntu-latest, macos-latest]
2019-11-23 19:36:32 +00:00
steps:
2020-10-26 18:49:09 +00:00
- uses: actions/checkout@v2
2019-11-23 19:36:32 +00:00
- name: Verify that py/LICENSE.txt matches root/LICENSE.txt
shell: bash
run: |
pydir=src/rust/iced-x86-py
if [ ! -f "$pydir/LICENSE.txt" ]; then
echo "Missing license file"
exit 1
fi
cp LICENSE.txt "$pydir/"
git diff --exit-code
2020-11-28 00:32:59 +00:00
- name: Install Rust
shell: bash
run: bash build/ci-install-rust.sh
2020-12-05 03:51:59 +00:00
- name: Use repo source code
shell: bash
run: |
# Make sure crates.io isn't used
if [ "$OSTYPE" = "msys" ]; then
2020-12-09 20:31:06 +00:00
iced_x86_dir="$(pwd -W)/src/rust/iced-x86"
2020-12-05 03:51:59 +00:00
else
2020-12-09 20:31:06 +00:00
iced_x86_dir="$(pwd)/src/rust/iced-x86"
2020-12-05 03:51:59 +00:00
fi
2020-12-09 20:31:06 +00:00
if [ ! -d "$iced_x86_dir" ]; then
echo "Dir does not exist: $iced_x86_dir"
exit 1
fi
echo "paths = [\"$iced_x86_dir\"]" > "$HOME/.cargo/config.toml"
2020-12-05 03:51:59 +00:00
# If the supported Python versions get updated (added/removed), do:
# - Update .github/workflows/build.yml (this file)
# - Search for eg. 3.6, 36 and 3\.6
# - Update file count in `Verify downloads`
# - Update min ver in build/README.md and src/rust/iced-x86-py/README.md and any 36/3.6/etc refs
# - Update src/rust/iced-x86-py/build-wheels.sh (search for eg. 36)
# - Update src/rust/iced-x86-py/Cargo.toml (update "abi3-py36" to min supported version)
# - Update Python versions in src/rust/iced-x86-py/setup.py
# - `python_requires` line
# - `classifiers` array
2020-12-04 22:25:08 +00:00
# - src/rust/iced-x86-py/tox.ini
2020-11-28 22:16:35 +00:00
#
# NOTE: We use setup-miniconda and not setup-python because setup-python's
# binaries target a later macos version and will produce warnings
# when building wheels on macos.
# https://github.com/actions/setup-python/issues/26
# This also means that all bash shells (that use Python) must
2020-11-29 12:06:44 +00:00
# use the -le options:
# shell: bash -le {0}
2020-11-29 14:20:45 +00:00
# setup-python is faster to install than setup-miniconda so we only
# use setup-miniconda if this is a macos image.
- uses: actions/setup-python@v2
if: "!startsWith(matrix.os, 'macos-')"
with:
python-version: 3.6
2020-11-28 22:16:35 +00:00
- uses: conda-incubator/setup-miniconda@v2
2020-11-29 14:20:45 +00:00
if: startsWith(matrix.os, 'macos-')
2020-11-28 00:32:59 +00:00
with:
python-version: 3.6
2020-11-28 00:32:59 +00:00
- name: Install Python tools
2020-11-29 12:06:44 +00:00
shell: bash -le {0}
2020-11-28 00:32:59 +00:00
run: |
2020-11-29 13:07:45 +00:00
python --version 2>&1 | grep "Python 3\.6"
2020-12-04 22:25:08 +00:00
python -m pip install -r src/rust/iced-x86-py/requirements-dev.txt
2020-11-28 00:32:59 +00:00
- name: Build and test
2020-11-29 12:06:44 +00:00
shell: bash -le {0}
2020-11-28 00:32:59 +00:00
run: |
extra_args=
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
extra_args=--quick-check
fi
2020-12-03 23:21:19 +00:00
./build/build-python --no-set-rustflags --python python $extra_args
2020-11-28 00:32:59 +00:00
git clean -xdf
- name: Create the sdist
if: startsWith(matrix.os, 'ubuntu-')
2020-11-29 12:06:44 +00:00
shell: bash -le {0}
run: |
2020-11-28 00:32:59 +00:00
git clean -xdf
./build/build-python --sdist-only
mkdir -p /tmp/py-dist
cp src/rust/iced-x86-py/dist/* /tmp/py-dist
git clean -xdf
2020-11-28 00:32:59 +00:00
####################### BEGIN Python Wheel: Linux, manylinux docker image #######################
# https://github.com/pypa/manylinux
2020-12-26 11:01:07 +00:00
- name: Build manylinux i686
2020-11-28 00:32:59 +00:00
if: startsWith(matrix.os, 'ubuntu-')
shell: bash
2019-11-23 19:36:32 +00:00
run: |
2020-12-26 11:01:07 +00:00
git clean -xdf
./build/py-build-wheels-linux.sh "quay.io/pypa/manylinux2010_i686"
2019-11-23 19:36:32 +00:00
2020-12-26 11:01:07 +00:00
- name: Build manylinux x86_64
2020-11-28 00:32:59 +00:00
if: startsWith(matrix.os, 'ubuntu-')
2020-12-26 11:01:07 +00:00
shell: bash
2019-11-23 19:36:32 +00:00
run: |
2020-11-28 00:32:59 +00:00
git clean -xdf
2020-12-26 11:01:07 +00:00
./build/py-build-wheels-linux.sh "quay.io/pypa/manylinux2010_x86_64"
2020-11-28 00:32:59 +00:00
####################### END Python Wheel: Linux, manylinux docker image #######################
####################### BEGIN Python Wheel: !Linux #######################
#########################################################################
# NOTE: See the comment above before adding/removing new Python versions
2020-11-28 00:32:59 +00:00
#########################################################################
2019-11-23 19:36:32 +00:00
2020-11-29 14:20:45 +00:00
- uses: actions/setup-python@v2
if: startsWith(matrix.os, 'windows-')
2020-11-29 14:20:45 +00:00
with:
python-version: 3.6
2020-11-28 22:16:35 +00:00
- uses: conda-incubator/setup-miniconda@v2
2020-11-29 14:20:45 +00:00
if: startsWith(matrix.os, 'macos-')
2020-11-28 00:32:59 +00:00
with:
python-version: 3.6
- name: Build and test the wheel
2020-11-28 00:32:59 +00:00
if: "!startsWith(matrix.os, 'ubuntu-')"
2020-11-29 12:06:44 +00:00
shell: bash -le {0}
2020-11-28 22:31:14 +00:00
run: |
2020-11-29 13:07:45 +00:00
python --version 2>&1 | grep "Python 3\.6"
2020-11-28 22:31:14 +00:00
bash build/ci-py-build-wheels.sh
2020-11-28 00:32:59 +00:00
2020-11-29 14:20:45 +00:00
- uses: actions/setup-python@v2
if: startsWith(matrix.os, 'windows-')
2020-11-29 14:20:45 +00:00
with:
python-version: 3.7
2020-11-28 22:16:35 +00:00
- uses: conda-incubator/setup-miniconda@v2
2020-11-29 14:20:45 +00:00
if: startsWith(matrix.os, 'macos-')
2020-11-28 00:32:59 +00:00
with:
python-version: 3.7
- name: Build and test the wheel
2020-11-28 00:32:59 +00:00
if: "!startsWith(matrix.os, 'ubuntu-')"
2020-11-29 12:06:44 +00:00
shell: bash -le {0}
2020-11-28 22:31:14 +00:00
run: |
2020-11-29 13:07:45 +00:00
python --version 2>&1 | grep "Python 3\.7"
2020-11-28 22:31:14 +00:00
bash build/ci-py-build-wheels.sh
2020-11-28 00:32:59 +00:00
2020-11-29 14:20:45 +00:00
- uses: actions/setup-python@v2
if: startsWith(matrix.os, 'windows-')
2020-11-29 14:20:45 +00:00
with:
python-version: 3.8
2020-11-28 22:16:35 +00:00
- uses: conda-incubator/setup-miniconda@v2
2020-11-29 14:20:45 +00:00
if: startsWith(matrix.os, 'macos-')
2020-11-28 00:32:59 +00:00
with:
python-version: 3.8
- name: Build and test the wheel
2020-11-28 00:32:59 +00:00
if: "!startsWith(matrix.os, 'ubuntu-')"
2020-11-29 12:06:44 +00:00
shell: bash -le {0}
2020-11-28 22:31:14 +00:00
run: |
2020-11-29 13:07:45 +00:00
python --version 2>&1 | grep "Python 3\.8"
2020-11-28 22:31:14 +00:00
bash build/ci-py-build-wheels.sh
2020-11-28 00:32:59 +00:00
2020-11-29 14:20:45 +00:00
- uses: actions/setup-python@v2
if: startsWith(matrix.os, 'windows-')
2020-11-29 14:20:45 +00:00
with:
python-version: 3.9
2020-11-28 22:16:35 +00:00
- uses: conda-incubator/setup-miniconda@v2
2020-11-29 14:20:45 +00:00
if: startsWith(matrix.os, 'macos-')
2020-11-28 00:32:59 +00:00
with:
python-version: 3.9
- name: Build and test the wheel
2020-11-28 00:32:59 +00:00
if: "!startsWith(matrix.os, 'ubuntu-')"
2020-11-29 12:06:44 +00:00
shell: bash -le {0}
2020-11-28 22:31:14 +00:00
run: |
2020-11-29 13:07:45 +00:00
python --version 2>&1 | grep "Python 3\.9"
bash build/ci-py-build-wheels.sh
#########################################################################
# The rest of the code needs 32-bit Rust/Python
2020-11-29 13:07:45 +00:00
#########################################################################
- name: Install 32-bit Rust
if: startsWith(matrix.os, 'windows-')
shell: bash
2020-11-29 13:07:45 +00:00
run: |
rustup install stable-i686-pc-windows-msvc --no-self-update
rustup default stable-i686-pc-windows-msvc
rustup show
2020-11-29 14:20:45 +00:00
- uses: actions/setup-python@v2
2020-11-29 13:07:45 +00:00
if: startsWith(matrix.os, 'windows-')
with:
python-version: 3.6
architecture: x86
- name: Build and test the wheel
2020-11-29 13:07:45 +00:00
if: startsWith(matrix.os, 'windows-')
shell: bash
2020-11-29 13:07:45 +00:00
run: |
python --version 2>&1 | grep "Python 3\.6"
bash build/ci-py-build-wheels.sh
2020-11-29 14:20:45 +00:00
- uses: actions/setup-python@v2
2020-11-29 13:07:45 +00:00
if: startsWith(matrix.os, 'windows-')
with:
python-version: 3.7
architecture: x86
- name: Build and test the wheel
2020-11-29 13:07:45 +00:00
if: startsWith(matrix.os, 'windows-')
shell: bash
2020-11-29 13:07:45 +00:00
run: |
python --version 2>&1 | grep "Python 3\.7"
bash build/ci-py-build-wheels.sh
2020-11-29 14:20:45 +00:00
- uses: actions/setup-python@v2
2020-11-29 13:07:45 +00:00
if: startsWith(matrix.os, 'windows-')
with:
python-version: 3.8
architecture: x86
- name: Build and test the wheel
2020-11-29 13:07:45 +00:00
if: startsWith(matrix.os, 'windows-')
shell: bash
2020-11-29 13:07:45 +00:00
run: |
python --version 2>&1 | grep "Python 3\.8"
bash build/ci-py-build-wheels.sh
2020-11-29 14:20:45 +00:00
- uses: actions/setup-python@v2
2020-11-29 13:07:45 +00:00
if: startsWith(matrix.os, 'windows-')
with:
python-version: 3.9
architecture: x86
- name: Build and test the wheel
2020-11-29 13:07:45 +00:00
if: startsWith(matrix.os, 'windows-')
shell: bash
2020-11-29 13:07:45 +00:00
run: |
python --version 2>&1 | grep "Python 3\.9"
2020-11-28 22:31:14 +00:00
bash build/ci-py-build-wheels.sh
2020-11-28 00:32:59 +00:00
####################### END Python Wheel: !Linux #######################
2020-11-29 12:06:44 +00:00
- name: Fix upload path
shell: bash
2020-11-28 17:04:00 +00:00
run: |
git clean -xdf
cp -r /tmp/py-dist .
2020-11-28 00:32:59 +00:00
- uses: actions/upload-artifact@v2
with:
name: py-dist-${{matrix.os}}
2020-11-28 17:04:00 +00:00
path: py-dist
2020-11-28 00:32:59 +00:00
if-no-files-found: error
#############################################################################
#############################################################################
#############################################################################
2020-11-28 00:32:59 +00:00
upload-files:
runs-on: ubuntu-latest
name: Upload files
needs:
- build-dotnet
- build-rust
- build-rust-js-wasm
- build-rust-python
2020-04-13 21:44:26 +00:00
2020-11-28 00:32:59 +00:00
steps:
2020-12-01 20:26:09 +00:00
- uses: actions/checkout@v2
2020-08-02 19:25:39 +00:00
- uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{env.CI_REQ_DOTNET_SDK_VER}}
2020-11-28 00:32:59 +00:00
- uses: actions/setup-python@v2
with:
2020-11-28 17:04:00 +00:00
python-version: 3.x
2020-11-28 00:32:59 +00:00
- uses: actions/download-artifact@v2
with:
path: /tmp/artifacts
2020-08-02 19:25:39 +00:00
2020-11-28 00:32:59 +00:00
- name: Verify downloads
2020-01-15 19:25:18 +00:00
shell: bash
run: |
2020-11-28 17:04:00 +00:00
if [ ! -f "/tmp/artifacts/coverage.info/$COVERAGE_FILENAME" ]; then
2020-11-28 00:32:59 +00:00
echo "Missing coverage"
exit 1
fi
if [ -z "$(ls -A /tmp/artifacts/nupkg/Iced.*.nupkg)" ]; then
echo "Missing nupkg files"
exit 1
fi
mkdir /tmp/py-dist-tmp
mkdir /tmp/py-dist
for path in /tmp/artifacts/py-dist-*; do
cp "$path/"* /tmp/py-dist-tmp
done
2020-01-26 19:21:08 +00:00
mv /tmp/py-dist-tmp/iced_x86-*-cp36-abi3*.whl /tmp/py-dist
mv /tmp/py-dist-tmp/iced-x86-*.tar.gz /tmp/py-dist
2020-11-28 00:32:59 +00:00
2020-12-26 14:14:58 +00:00
if [ -n "$(ls -A /tmp/py-dist-tmp/* 2>/dev/null)" ]; then
ls -l /tmp/py-dist-tmp
echo "Unknown files found (see above)"
echo "If it's a new Python version, see Python version comment above (`build-rust-python`)"
exit 1
fi
2020-11-28 00:32:59 +00:00
rmdir /tmp/py-dist-tmp
2020-12-26 11:01:07 +00:00
# Windows x86 + x64, macOS x64, Linux (x86 + x64) * (manylinux1 + manylinux2010)
# 7 (wheels) + 1 (source code tar.gz file)
if [ $(ls -A /tmp/py-dist | wc -l) -ne 8 ]; then
2020-11-28 00:32:59 +00:00
ls -l /tmp/py-dist
echo "Found too many/few Python whl files (see above)"
exit 1
fi
2020-12-01 20:26:09 +00:00
- name: Upload checks
2020-04-13 21:13:47 +00:00
shell: bash
run: |
2020-12-04 22:25:08 +00:00
python -m pip install -U twine
2020-12-12 13:49:24 +00:00
python -m twine check /tmp/py-dist/*
2020-12-01 20:26:09 +00:00
dotnet nuget push --help
cargo publish --help
2020-11-28 00:32:59 +00:00
- name: Upload coverage report
2020-11-28 22:16:35 +00:00
if: github.ref == 'refs/heads/master'
2020-11-28 00:32:59 +00:00
shell: bash
continue-on-error: true
run: |
2020-11-28 17:04:00 +00:00
curl --proto '=https' --tlsv1.2 -sSf https://codecov.io/bash | bash -s -- -f "/tmp/artifacts/coverage.info/$COVERAGE_FILENAME"
2020-11-28 00:32:59 +00:00
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
2020-12-01 20:26:09 +00:00
- name: Upload to nuget.org
2020-11-28 00:32:59 +00:00
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
for file in /tmp/artifacts/nupkg/Iced.*.nupkg; do
dotnet nuget push "$file" --api-key "${{secrets.NUGET_APIKEY}}" --source https://api.nuget.org/v3/index.json
done
2020-12-01 20:26:09 +00:00
2020-12-12 14:27:59 +00:00
# - name: Upload to crates.io
# if: startsWith(github.ref, 'refs/tags/')
# shell: bash
# run: |
# git clean -xdf
# git checkout .
# cd src/rust/iced-x86
# cargo login --color always -- "${{secrets.CRATES_IO_TOKEN}}"
# # --no-verify: we've tested building everything already
# cargo publish --color always --no-verify
2020-12-06 23:43:17 +00:00
- name: Upload to pypi.org
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
2020-12-12 13:49:24 +00:00
python -m twine upload --non-interactive -u __token__ -p "${{secrets.PYPI_TOKEN}}" /tmp/py-dist/*