Use apt-get autoremove
to clean up dependencies in Docker
#589
Workflow file for this run
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
name: CI | |
on: | |
create: | |
tags: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Native Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
steps: | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/ccache | |
# Bump the prefix number to evict all previous caches and | |
# enforce a clean build, in the unlikely case that some | |
# weird build error occur and ccache becomes a potential | |
# suspect. | |
key: 0-cache-ubuntu-latest-${{ github.run_id }} | |
restore-keys: | | |
0-cache-ubuntu-latest | |
if: matrix.os == 'ubuntu-latest' | |
- uses: actions/cache@v3 | |
with: | |
path: ~/Library/Caches/ccache | |
key: 0-cache-macos-latest-${{ github.run_id }} | |
restore-keys: | | |
0-cache-macos-latest | |
if: matrix.os == 'macos-latest' | |
- name: Install wasmtime for tests | |
# TODO: switch to Wasmtime 17 once it's released, which will include https://github.com/bytecodealliance/wasmtime/pull/7750 | |
run: | | |
curl -f -L --retry 5 https://wasmtime.dev/install.sh | bash -s -- --version dev | |
~/.wasmtime/bin/wasmtime --version | |
curl -f -L --retry 5 -o ~/.wasmtime/bin/wasi_snapshot_preview1.command.wasm https://github.com/bytecodealliance/wasmtime/releases/download/dev/wasi_snapshot_preview1.command.wasm | |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then | |
curl -f -OL --retry 5 https://github.com/bytecodealliance/wasm-tools/releases/download/wasm-tools-1.0.54/wasm-tools-1.0.54-x86_64-linux.tar.gz | |
tar xf wasm-tools-1.0.54-x86_64-linux.tar.gz | |
cp wasm-tools-1.0.54-x86_64-linux/wasm-tools ~/.wasmtime/bin/ | |
else | |
curl -f -OL --retry 5 https://github.com/bytecodealliance/wasm-tools/releases/download/wasm-tools-1.0.54/wasm-tools-1.0.54-x86_64-macos.tar.gz | |
tar xf wasm-tools-1.0.54-x86_64-macos.tar.gz | |
cp wasm-tools-1.0.54-x86_64-macos/wasm-tools ~/.wasmtime/bin/ | |
fi | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# We can't use `--depth 1` here sadly because the GNU config | |
# submodule is not pinned to a particular tag/branch. Please | |
# bump depth (or even better, the submodule), in case of "error: | |
# Server does not allow request for unadvertised object" in the | |
# future. | |
- run: git submodule update --init --depth 32 --jobs 3 | |
- name: Install ccache, ninja (macOS) | |
run: brew install ccache ninja | |
if: matrix.os == 'macos-latest' | |
- name: Install ccache, ninja (Linux) | |
run: sudo apt install ccache ninja-build | |
if: matrix.os == 'ubuntu-latest' | |
- name: Build | |
run: NINJA_FLAGS=-v make package LLVM_CMAKE_FLAGS=-DLLVM_CCACHE_BUILD=ON | |
shell: bash | |
- name: Run the testsuite | |
run: NINJA_FLAGS=-v make check RUNTIME=~/.wasmtime/bin/wasmtime ADAPTER=~/.wasmtime/bin/wasi_snapshot_preview1.command.wasm WASM_TOOLS=~/.wasmtime/bin/wasm-tools | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
# Upload the dist folder. Give it a name according to the OS it was built for. | |
name: ${{ format( 'dist-{0}', matrix.os) }} | |
path: dist | |
winbuild: | |
name: Windows Build | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- arch: x64 | |
sys: clang64 | |
env: clang-x86_64 | |
- arch: x86 | |
sys: clang32 | |
env: clang-i686 | |
steps: | |
- uses: actions/cache@v3 | |
with: | |
path: ~/AppData/Local/ccache | |
key: 0-${{ format( 'cache-windows-latest-{0}', matrix.arch) }}-${{ github.run_id }} | |
restore-keys: | | |
0-${{ format( 'cache-windows-latest-{0}', matrix.arch) }} | |
- uses: msys2/setup-msys2@v2 | |
with: | |
install: >- | |
base-devel | |
git | |
mingw-w64-${{ matrix.env }}-ccache | |
mingw-w64-${{ matrix.env }}-cmake | |
mingw-w64-${{ matrix.env }}-ninja | |
mingw-w64-${{ matrix.env }}-toolchain | |
msystem: ${{ matrix.sys }} | |
update: true | |
release: false | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: git submodule update --init --depth 32 --jobs 3 | |
- name: Build | |
shell: msys2 {0} | |
run: | | |
make package LLVM_CMAKE_FLAGS=-DLLVM_CCACHE_BUILD=ON | |
make check | |
- name: Does it work sans msys2? | |
run: | | |
C:\wasi-sdk\bin\clang.exe --version | |
C:\wasi-sdk\bin\llvm-ar.exe --version | |
C:\wasi-sdk\bin\wasm-ld.exe --version | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
# Upload the dist folder. Give it a name according to the OS it was built for. | |
name: ${{ format( 'dist-windows-latest-{0}', matrix.arch) }} | |
path: dist | |
dockerbuild: | |
name: Docker Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.ccache | |
key: 0-cache-ubuntu-bionic-${{ github.run_id }} | |
restore-keys: | | |
0-cache-ubuntu-bionic | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: git submodule update --init --depth 32 --jobs 3 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/metadata-action@v4 | |
id: meta | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=sha | |
- name: Run docker_build script | |
run: ./docker_build.sh | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
# Upload the dist folder. Give it a name according to the OS it was built for. | |
name: dist-ubuntu-bionic | |
path: dist | |
- name: Build and push wasi-sdk docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: docker/Dockerfile | |
push: ${{ github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch' }} | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |