Fix restore disk_only with index #314
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## This workflow handles testing of pull requests and pushes. | |
## It also publishes some packages to any new Erlang/OTP release | |
## | |
## To speed this up it would be nice if one could share docker | |
## images inbetween different jobs, but at the moment this is | |
## not possible so we need to rebuild all of Erlang/OTP multiple | |
## times. | |
## | |
## When ghcr.io support using the GITHUB_TOKEN we should migrate | |
## over to use it instead as that should allow us to use the | |
## built-in caching mechanisms of docker/build-push-action@v2. | |
## However as things are now we use docker directly to make things | |
## work. | |
## | |
name: Build and check Erlang/OTP | |
on: | |
push: | |
pull_request: | |
jobs: | |
pack: | |
name: Pack the Erlang/OTP tar.gz | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Create initial pre-release tar | |
run: .github/scripts/init-pre-release.sh | |
- name: Upload source tar archive | |
uses: actions/upload-artifact@v2 | |
with: | |
name: otp_git_archive | |
path: otp_src.tar.gz | |
build-windows: | |
defaults: | |
run: | |
shell: wsl-bash {0} | |
env: | |
WXWIDGETS_VERSION: 3.1.4 | |
name: Build Erlang/OTP on Windows | |
runs-on: windows-2022 | |
needs: pack | |
steps: | |
- uses: Vampire/setup-wsl@v1 | |
with: | |
distribution: Ubuntu-18.04 | |
- name: Install WSL dependencies | |
run: apt update && apt install -y g++-mingw-w64 gcc-mingw-w64 make autoconf unzip | |
- name: Install openssl | |
shell: cmd | |
run: | | |
choco install openssl | |
move "c:\\Program Files\\OpenSSL-Win64" "c:\\OpenSSL-Win64" | |
- name: Cache wxWidgets | |
uses: actions/cache@v2 | |
with: | |
path: wxWidgets | |
key: wxWidgets-${{ env.WXWIDGETS_VERSION }}-${{ runner.os }} | |
# actions/cache on Windows sometimes does not set cache-hit even though there was one. Setting it manually. | |
- name: Set wxWidgets cache | |
id: wxwidgets-cache | |
run: | | |
if [ -d wxWidgets ]; then | |
echo "::set-output name=cache-hit::true" | |
else | |
echo "::set-output name=cache-hit::false" | |
fi | |
- name: Download wxWidgets | |
if: steps.wxwidgets-cache.outputs.cache-hit != 'true' | |
run: | | |
wget https://github.com/wxWidgets/wxWidgets/releases/download/v${{ env.WXWIDGETS_VERSION }}/wxWidgets-${{ env.WXWIDGETS_VERSION }}.zip | |
unzip wxWidgets-${{ env.WXWIDGETS_VERSION }}.zip -d wxWidgets | |
sed -i -r -e 's/wxUSE_POSTSCRIPT +0/wxUSE_POSTSCRIPT 1/' wxWidgets/include/wx/msw/setup.h | |
sed -i -r -e 's/wxUSE_WEBVIEW_EDGE +0/wxUSE_WEBVIEW_EDGE 1/' wxWidgets/include/wx/msw/setup.h | |
- name: Install WebView2 | |
if: steps.wxwidgets-cache.outputs.cache-hit != 'true' | |
shell: cmd | |
run: | | |
cd wxWidgets\\3rdparty | |
nuget install Microsoft.Web.WebView2 -Version 1.0.705.50 -Source https://api.nuget.org/v3/index.json | |
rename Microsoft.Web.WebView2.1.0.705.50 webview2 | |
- name: Build wxWidgets | |
if: steps.wxwidgets-cache.outputs.cache-hit != 'true' | |
shell: cmd | |
run: | | |
cd wxWidgets\\build\\msw | |
call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\Auxiliary\\Build\\vcvars64.bat" | |
nmake TARGET_CPU=amd64 BUILD=release SHARED=0 DIR_SUFFIX_CPU= -f makefile.vc | |
- name: Download source archive | |
uses: actions/download-artifact@v2 | |
with: | |
name: otp_git_archive | |
- name: Compile Erlang | |
run: | | |
mkdir -p /mnt/c/opt/local64/pgm/ | |
cp -R wxWidgets /mnt/c/opt/local64/pgm/wxWidgets-${{ env.WXWIDGETS_VERSION }} | |
tar -xzf ./otp_src.tar.gz | |
cd otp | |
export ERL_TOP=`pwd` | |
export MAKEFLAGS=-j4 | |
export ERLC_USE_SERVER=true | |
export ERTS_SKIP_DEPEND=true | |
eval `./otp_build env_win32 x64` | |
./otp_build configure | |
if cat erts/CONF_INFO || cat lib/*/CONF_INFO || cat lib/*/SKIP || cat lib/SKIP-APPLICATIONS; then exit 1; fi | |
./otp_build boot -a | |
./otp_build release -a | |
cp /mnt/c/opt/local64/pgm/wxWidgets-${{ env.WXWIDGETS_VERSION }}/3rdparty/webview2/runtimes/win-x64/native/WebView2Loader.dll $ERL_TOP/release/win32/erts-*/bin/ | |
./otp_build installer_win32 | |
- name: Upload installer | |
uses: actions/upload-artifact@v2 | |
with: | |
name: otp_prebuilt_win32 | |
path: otp/release/win32/otp*.exe | |
build: | |
name: Build Erlang/OTP | |
runs-on: ubuntu-latest | |
needs: pack | |
strategy: | |
matrix: | |
type: [64-bit,32-bit,cross-compile,documentation] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download source archive | |
uses: actions/download-artifact@v2 | |
with: | |
name: otp_git_archive | |
- name: Docker login | |
uses: docker/login-action@v1 | |
with: | |
registry: docker.pkg.github.com | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Calculate BASE image | |
id: base | |
run: | | |
BASE_TAG=$(grep "^FROM" .github/dockerfiles/Dockerfile.${{ matrix.type }} | head -1 | awk '{print $2}') | |
echo "::set-output name=BASE_TAG::${BASE_TAG}" | |
.github/scripts/base-tag "${BASE_TAG}" | |
- name: Pull BASE image | |
run: docker pull ${{ steps.base.outputs.BASE_TAG }} | |
- name: Build BASE image | |
run: | | |
docker build --pull --tag ${{ steps.base.outputs.BASE_TAG }} \ | |
--cache-from ${{ steps.base.outputs.BASE_TAG }} \ | |
--file .github/dockerfiles/Dockerfile.${{ steps.base.outputs.BASE_TYPE }} \ | |
--build-arg BASE=${{ steps.base.outputs.BASE }} . | |
- name: Build ${{ matrix.type }} image | |
run: | | |
docker build --tag otp --file .github/dockerfiles/Dockerfile.${{ matrix.type }} \ | |
--build-arg ARCHIVE=otp_src.tar.gz . | |
## Smoke build tests | |
- if: matrix.type == '32-bit' || matrix.type == '64-bit' || matrix.type == 'cross-compile' | |
name: Run smoke test | |
run: docker run -v $PWD/scripts:/scripts otp "cd /tests && /scripts/run-smoke-tests" | |
## Documentation checks | |
- if: matrix.type == 'documentation' | |
name: Run xmllimt | |
run: docker run otp "make xmllint" | |
- if: matrix.type == 'documentation' | |
name: Run html link check | |
run: docker run -v $PWD/scripts:/scripts otp "/scripts/otp_html_check /otp doc/index.html" | |
- if: matrix.type == 'documentation' | |
name: Release docs to publish | |
run: .github/scripts/release-docs.sh | |
- if: matrix.type == 'documentation' | |
name: Upload html documentation archive | |
uses: actions/upload-artifact@v2 | |
with: | |
name: otp_doc_html | |
path: otp_doc_html.tar.gz | |
- if: matrix.type == 'documentation' | |
name: Upload man documentation archive | |
uses: actions/upload-artifact@v2 | |
with: | |
name: otp_doc_man | |
path: otp_doc_man.tar.gz | |
## Check formatting of cpp code | |
- if: matrix.type == '64-bit' | |
name: Check format | |
run: docker run -v $PWD/scripts:/scripts otp "make format-check" | |
## Run dialyzer | |
- if: matrix.type == '64-bit' | |
name: Run dialyzer | |
run: docker run -v $PWD/scripts:/scripts otp "/scripts/run-dialyzer" | |
## Build pre-built tar archives | |
- if: matrix.type == '32-bit' | |
name: Build pre-built tar archives | |
run: | | |
docker run -v $PWD:/github otp \ | |
"scripts/build-otp-tar -o /github/otp_clean_src.tar.gz /github/otp_src.tar.gz -b /buildroot/otp/ /buildroot/otp.tar.gz" | |
- if: matrix.type == '32-bit' | |
name: Upload pre-built tar archive | |
uses: actions/upload-artifact@v2 | |
with: | |
name: otp_prebuilt | |
path: otp_src.tar.gz | |
## If this is a tag that has been pushed we do some release work | |
release: | |
name: Release Erlang/OTP | |
runs-on: ubuntu-latest | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'erlang/otp' | |
steps: | |
## This step outputs the tag name and whether the tag is a release or patch | |
## (all releases have only two version identifiers, while patches have three | |
## or more) | |
- name: Get Tag Name | |
id: tag | |
run: | | |
TAG=${GITHUB_REF#refs/tags/} | |
IS_RELEASE=`$(echo $TAG | grep -E '^OTP-[0-9]+\.[0-9]+$' > /dev/null) \ | |
&& echo "true" || echo "false"` | |
VSN=${TAG#OTP-} | |
echo "::set-output name=tag::${TAG}" | |
echo "::set-output name=release::${IS_RELEASE}" | |
echo "::set-output name=vsn::${VSN}" | |
- uses: actions/checkout@v2 | |
## Publish the pre-built archive and docs | |
- name: Download source archive | |
uses: actions/download-artifact@v2 | |
with: | |
name: otp_prebuilt | |
- name: Download html docs | |
uses: actions/download-artifact@v2 | |
with: | |
name: otp_doc_html | |
- name: Download man docs | |
uses: actions/download-artifact@v2 | |
with: | |
name: otp_doc_man | |
## We add the correct version name into the file names | |
## and create the hash files for all assets | |
- name: Create pre-build and doc archives | |
run: .github/scripts/create-artifacts.sh artifacts ${{ steps.tag.outputs.tag }} | |
- name: Build OTP Bundle | |
if: steps.tag.outputs.release == 'true' | |
run: | | |
scripts/bundle-otp ${{ steps.tag.outputs.tag }} | |
## Create hash files | |
- name: Create pre-build and doc archives | |
run: | | |
shopt -s nullglob | |
cd artifacts | |
md5sum {*.tar.gz,*.txt} > MD5.txt | |
sha256sum {*.tar.gz,*.txt} > SHA256.txt | |
- name: Upload pre-built and doc tar archives | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: OTP ${{ steps.tag.outputs.vsn }} | |
files: | | |
artifacts/*.tar.gz | |
artifacts/*.txt | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy on erlang.org | |
env: | |
GITHUB_TOKEN: ${{ secrets.TRIGGER_ERLANG_ORG_BUILD }} | |
run: | | |
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/erlang/erlang-org/actions/workflows/update-gh-cache.yaml/dispatches" -d '{"ref":"master"}' |