Skip to content

Commit 6cb3d92

Browse files
committed
ci,build: [WIP] release via nix+burrito
Signed-off-by: Roman Volosatovs <[email protected]>
1 parent e8f2717 commit 6cb3d92

File tree

22 files changed

+1718
-228
lines changed

22 files changed

+1718
-228
lines changed

.github/actions/build-nix/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: build via Nix
2+
3+
inputs:
4+
package:
5+
description: package specification to build
6+
required: true
7+
install-path:
8+
description: path within resulting output, from which to install (e.g. `/lib/libhostcore_wasmcloud_native.a`)
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- run: nix build -L '.#${{ inputs.package }}'
14+
shell: bash
15+
- run: nix run -L --inputs-from . 'nixpkgs#coreutils' -- --coreutils-prog=ginstall -p "./result${{ inputs.install-path }}" '${{ inputs.package }}'
16+
shell: bash
17+
- uses: actions/upload-artifact@v3
18+
with:
19+
name: ${{ inputs.package }}
20+
path: ${{ inputs.package }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: install Nix
2+
3+
inputs:
4+
cachixAuthToken:
5+
description: auth token for https://app.cachix.org/organization/wasmcloud/cache/wasmcloud
6+
7+
env:
8+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 # abort caching attempt if it's slow
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- run: sudo mkdir -p /nix
14+
if: ${{ runner.os == 'Linux' }}
15+
shell: bash
16+
- run: sudo chown $(whoami) /nix
17+
if: ${{ runner.os == 'Linux' }}
18+
shell: bash
19+
- uses: actions/cache@v3
20+
if: ${{ runner.os == 'Linux' }}
21+
with:
22+
path: /nix
23+
key: nix
24+
- uses: nixbuild/nix-quick-install-action@v22
25+
with:
26+
nix_conf: |
27+
accept-flake-config = true
28+
access-tokens = github.com=${{ github.token }}
29+
experimental-features = nix-command flakes
30+
- uses: cachix/cachix-action@v12
31+
continue-on-error: true
32+
with:
33+
name: wasmcloud
34+
authToken: '${{ inputs.cachixAuthToken }}'

.github/workflows/release.yml

Lines changed: 39 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -2,150 +2,55 @@ name: WasmCloud Release
22

33
on:
44
push:
5+
branches: [main]
56
tags: ["v*"] # Push events to matching v*, i.e. v1.0, v20.15.10
67
workflow_dispatch: # Allow manual creation of artifacts without a release
78
pull_request:
89
branches: [main]
9-
env:
10-
otp-version: 25
11-
elixir-version: 1.14.3
1210

1311
jobs:
14-
create-static-macos:
15-
if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
16-
name: Static macOS release
17-
strategy:
18-
matrix:
19-
os: [macos-11]
20-
include:
21-
- os: macos-11
22-
rust-target: x86_64-apple-darwin
23-
release-tarball: x86_64-macos-static.tar.gz
24-
working-directory: wasmcloud_host
25-
runs-on: ${{ matrix.os }}
26-
env:
27-
working-directory: ${{ matrix.working-directory }}
28-
MIX_ENV: release_prod
29-
SECRET_KEY_BASE: ${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }}
30-
steps:
31-
- uses: actions/checkout@v3
32-
- uses: dtolnay/rust-toolchain@stable
33-
- name: run macos script
34-
shell: bash
35-
run: |
36-
bash .github/workflows/static_macos
37-
tar -czvf ${{ matrix.release-tarball }} -C wasmcloud_host/_build/prod/rel/bakeware wasmcloud_host
38-
- name: Upload artifact
39-
uses: actions/upload-artifact@v2
40-
with:
41-
name: ${{ matrix.release-tarball }}
42-
path: ${{ matrix.release-tarball }}
43-
44-
create-mix-releases:
45-
# Run on tag push or on manual dispatch. Release will not be created for manual dispatch
46-
if: ${{ (startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch') && startswith(github.repository.name, 'wasmcloud') }}
47-
name: Mix release
12+
build-darwin-nif:
4813
strategy:
49-
fail-fast: false
5014
matrix:
51-
os: [ubuntu-20.04, windows-2019, macos-11]
52-
working-directory: [wasmcloud_host, host_core]
53-
include:
54-
- os: ubuntu-20.04
55-
rust-target: x86_64-unknown-linux-gnu
56-
release-tarball: x86_64-linux.tar.gz
57-
working-directory: wasmcloud_host
58-
- os: windows-2019
59-
rust-target: x86_64-pc-windows-gnu
60-
release-tarball: x86_64-windows.tar.gz
61-
working-directory: wasmcloud_host
62-
- os: macos-11
63-
rust-target: x86_64-apple-darwin
64-
release-tarball: x86_64-macos.tar.gz
65-
working-directory: wasmcloud_host
66-
- os: ubuntu-20.04
67-
rust-target: x86_64-unknown-linux-gnu
68-
release-tarball: x86_64-linux-core.tar.gz
69-
working-directory: host_core
70-
- os: windows-2019
71-
rust-target: x86_64-pc-windows-gnu
72-
release-tarball: x86_64-windows-core.tar.gz
73-
working-directory: host_core
74-
- os: macos-11
75-
rust-target: x86_64-apple-darwin
76-
release-tarball: x86_64-macos-core.tar.gz
77-
working-directory: host_core
78-
runs-on: ${{ matrix.os }}
79-
env:
80-
working-directory: ${{ matrix.working-directory }}
81-
MIX_ENV: release_prod
82-
SECRET_KEY_BASE: ${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }}
15+
config:
16+
- host: macos-latest
17+
target: aarch64-apple-darwin
8318

84-
steps:
85-
- uses: actions/checkout@v3
86-
87-
# Install Rust
88-
- run: rustup toolchain install stable --profile minimal
89-
90-
# Install erlang/OTP and elixir
91-
- name: Install erlang and elixir
92-
if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }}
93-
uses: erlef/setup-beam@v1
94-
with:
95-
otp-version: "=${{ env.otp-version }}"
96-
elixir-version: "${{ env.elixir-version }}"
97-
install-hex: true
98-
install-rebar: true
99-
- name: Install erlang and elixir
100-
if: ${{ startswith(matrix.os, 'macos') }}
101-
run: |
102-
brew install erlang
103-
brew install elixir
19+
- host: macos-latest
20+
target: x86_64-apple-darwin
10421

105-
- name: Retrieve Mix Dependencies Cache
106-
if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about not owning files if you restore from cache
107-
uses: actions/cache@v2
108-
id: mix-cache #id to use in retrieve action
109-
with:
110-
path: |
111-
${{ env.working-directory }}/deps
112-
key: ${{ runner.os }}-${{ env.ERLANG_VERSION }}-${{ env.ELIXIR_VERSION }}-mix-${{ hashFiles('${{ env.working-directory }}/mix.exs', '${{ env.working-directory }}/mix.lock') }}
113-
114-
- name: Install Mix Dependencies
115-
working-directory: ${{env.working-directory}}
116-
shell: bash
117-
run: |
118-
mix local.rebar --force
119-
mix local.hex --force
120-
mix deps.get
121-
122-
- name: Compile Elixir
123-
working-directory: ${{env.working-directory}}
124-
shell: bash
125-
run: |
126-
mix compile
127-
128-
- name: Compile Phoenix Assets
129-
if: ${{ env.working-directory == 'wasmcloud_host' }}
130-
working-directory: ${{env.working-directory}}
131-
shell: bash
132-
run: |
133-
make esbuild
134-
135-
- name: Create Mix Release
136-
working-directory: ${{env.working-directory}}
137-
shell: bash
138-
run: |
139-
mix release
140-
cd _build/${{ env.MIX_ENV }}/rel/${{env.working-directory}}
141-
tar -czvf ${{ matrix.release-tarball }} bin erts-* lib releases
142-
mv ${{ matrix.release-tarball }} ../../../../
22+
name: nif-${{ matrix.config.target }}
23+
runs-on: ${{ matrix.config.host }}
24+
steps:
25+
- uses: actions/checkout@v3
26+
- uses: ./.github/actions/install-nix
27+
with:
28+
cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
29+
- uses: ./.github/actions/build-nix
30+
with:
31+
package: hostcore_wasmcloud_native-${{ matrix.config.target }}
14332

144-
- name: Upload artifact
145-
uses: actions/upload-artifact@v2
146-
with:
147-
name: ${{ matrix.release-tarball }}
148-
path: ${{env.working-directory}}/${{ matrix.release-tarball }}
33+
hostcore:
34+
needs: build-darwin-nif
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v3
38+
- uses: ./.github/actions/install-nix
39+
with:
40+
cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
41+
- uses: actions/download-artifact@v3
42+
with:
43+
path: ./aarch64
44+
name: hostcore_wasmcloud_native-aarch64-apple-darwin
45+
- uses: actions/download-artifact@v3
46+
with:
47+
path: ./x86_64
48+
name: hostcore_wasmcloud_native-x86_64-apple-darwin
49+
- run: nix build --override-input hostcore_wasmcloud_native-aarch64-apple-darwin ./aarch64 --override-input hostcore_wasmcloud_native-x86_64-apple-darwin ./x86_64 -L .#hostcore
50+
#- uses: ./.github/actions/build-nix
51+
# with:
52+
# package: hostcore_wasmcloud_native-${{ matrix.config.target }}
53+
# install-path: ${{ matrix.config.install-path }}
14954

15055
# release-hostcore-docker:
15156
# if: startswith(github.ref, 'refs/tags/') # Only run on tag push
@@ -364,7 +269,7 @@ jobs:
364269
github-release:
365270
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
366271
needs:
367-
[create-mix-releases, release-wasmcloud-docker]
272+
- hostcore
368273
runs-on: ubuntu-latest
369274
steps:
370275
- name: Download Release Tarballs

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# The directory Mix will write compiled artifacts to.
22
/_build/
33
_build/
4+
burrito_out/
5+
result
46

57
# If you run "mix test --cover", coverage assets end up here.
68
/cover/

0 commit comments

Comments
 (0)