Skip to content

Commit 1987395

Browse files
committed
chore: add setup-tinygo action
1 parent ed2870c commit 1987395

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'Setup TinyGo environment'
2+
description: 'Setup a TinyGo environment and add it to the PATH'
3+
inputs:
4+
version:
5+
description: 'The Go version to download and use. Must be a valid commitish, e.g. "dev" or "v1.0.0"'
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Install LLVM 13
11+
run: |
12+
source /etc/os-release
13+
echo "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-13 main" | sudo tee /etc/apt/sources.list.d/llvm.list
14+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
15+
sudo apt-get -qq update
16+
sudo apt-get -yqq install clang-13 llvm-13-dev lld-13 libclang-13-dev
17+
shell: bash
18+
19+
- uses: actions/setup-go@v3
20+
with:
21+
go-version: 1.17
22+
23+
- name: Install Binaryen
24+
run: |
25+
pushd /dev/shm
26+
VERSION="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/WebAssembly/binaryen/releases/latest)"
27+
VERSION="${VERSION#https://github.com/WebAssembly/binaryen/releases/tag/}"
28+
curl -sfOL "https://github.com/WebAssembly/binaryen/releases/download/${VERSION}/binaryen-${VERSION}-$(uname -m)-linux.tar.gz"
29+
tar -xvf "binaryen-${VERSION}-$(uname -m)-linux.tar.gz"
30+
mkdir -p "${RUNNER_TOOL_CACHE}/binaryen"
31+
mv "binaryen-${VERSION}" "${RUNNER_TOOL_CACHE}/binaryen/${VERSION}"
32+
echo "${RUNNER_TOOL_CACHE}/binaryen/${VERSION}/bin" >> $GITHUB_PATH
33+
popd
34+
shell: bash
35+
36+
- name: Install TinyGo
37+
run: |
38+
pushd /dev/shm
39+
mkdir tinygo
40+
cd tinygo
41+
git init
42+
git remote add origin https://github.com/tinygo-org/tinygo.git
43+
git fetch --prune --progress --no-tags --depth=1 origin "${{ inputs.version }}"
44+
git checkout --progress --force -B "${{ inputs.version }}" FETCH_HEAD
45+
git submodule update --init --recursive --depth 1
46+
make wasi-libc
47+
mkdir -p "${RUNNER_TOOL_CACHE}/tinygo/${{ inputs.version }}"
48+
GOBIN="${RUNNER_TOOL_CACHE}/tinygo/${{ inputs.version }}" go install
49+
echo "${RUNNER_TOOL_CACHE}/tinygo/${{ inputs.version }}" >> $GITHUB_PATH
50+
popd
51+
shell: bash

.github/workflows/push.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ jobs:
88
steps:
99
- uses: actions/checkout@v3
1010

11-
- name: Setup Go
12-
uses: actions/setup-go@v3
11+
- name: Setup TinyGo
12+
uses: ./.github/actions/setup-tinygo
13+
with:
14+
version: 3d6880470204fdf6449c9fd0a7fedba8f8361724 # latest commit on dev at the time of writing
1315

1416
- name: Setup Node
1517
uses: actions/setup-node@v3

0 commit comments

Comments
 (0)