Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💚 Run CI inside of a devenv #2

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 54 additions & 64 deletions .github/workflows/artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Create Artifact
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ["main"]
branches: ["*"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -20,12 +20,7 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -40,81 +35,75 @@ jobs:
git config --global user.email "trickypr@users.noreply.github.com"
git config --global user.name "TrickyPR"

- name: Install system dependencies
run: |
sudo apt-get update --fix-missing
sudo apt-get update
sudo apt-get install meson dos2unix yasm nasm build-essential libgtk2.0-dev libpython3-dev m4 uuid libasound2-dev libcurl4-openssl-dev libdbus-1-dev libdrm-dev libdbus-glib-1-dev libdbus-glib-1-dev libgtk-3-dev libpulse-dev libx11-xcb-dev libxt-dev xvfb lld llvm
pip install pycairo testresources

- name: Free up space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"

- name: Install sccache
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: 0.2.13
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Save sccache
uses: actions/cache@v3
continue-on-error: false
with:
path: /home/runner/.cache/sccache
key: ${{ runner.os }}-sccache

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
# - name: Install sccache
# env:
# LINK: https://github.com/mozilla/sccache/releases/download
# SCCACHE_VERSION: 0.2.13
# run: |
# SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
# mkdir -p $HOME/.local/bin
# curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
# mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
# echo "$HOME/.local/bin" >> $GITHUB_PATH

# - name: Save sccache
# uses: actions/cache@v3
# continue-on-error: false
# with:
# path: /home/runner/.cache/sccache
# key: ${{ runner.os }}-sccache

# - uses: pnpm/action-setup@v2
# name: Install pnpm
# id: pnpm-install
# with:
# version: 8
# run_install: false

# - name: Get pnpm store directory
# id: pnpm-cache
# shell: bash
# run: |
# echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

# - uses: actions/cache@v3
# name: Setup pnpm cache
# with:
# path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
# key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
# restore-keys: |
# ${{ runner.os }}-pnpm-store-

# - name: Install dependencies
# run: pnpm install

- uses: cachix/install-nix-action@v26
- uses: cachix/cachix-action@v14
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install
name: devenv
- name: Install devenv.sh
run: nix profile install nixpkgs#devenv

- name: Download firefox source and dependencies
run: pnpm gluon download
run: devenv shell download

- name: Import
run: pnpm gluon import

- name: Bootstrap
run: |
cd engine
./mach --no-interactive bootstrap --application-choice browser
cd ..
run: devenv shell import

- name: Build
run: pnpm gluon build
run: devenv shell build

- name: Package
# .mar files are not properly generated, but it should be fine
continue-on-error: true
run: pnpm gluon package
run: devenv shell package

- name: Rename artifacts
run: |
Expand All @@ -128,6 +117,7 @@ jobs:

- name: Make artifact available
uses: "marvinpinto/action-automatic-releases@latest"
if: github.ref == 'refs/heads/main'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ devenv.local.nix

# System mozillabuild
mozillabuild

/mozconfig
111 changes: 66 additions & 45 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
{ pkgs, lib, config, inputs, stdenv, ... }:
{
pkgs,
...
}:

{
env.LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";

languages.c.enable = true;

languages.cplusplus.enable = true;
languages.rust.enable = true;
# https://devenv.sh/reference/options/#languagesrustchannel
languages.rust.channel = "stable";

languages.javascript = {
enable = true;
pnpm = {
enable = true;
install.enable = true;
};
};

scripts = {
gluon.exec = "pnpm gluon $@";
download.exec = "gluon download";
import.exec = "gluon import";
build.exec = "unset AS && gluon build";
# MAR generation generally fails, but we ignore that
package.exec = "gluon package || echo 0";
};

packages = with pkgs; [
sccache
unzip

glibc
libllvm
libclang
llvm
Expand All @@ -22,50 +42,51 @@
libclang
gcc

libxkbcommon libdrm
libxkbcommon
libdrm

# build time
autoconf
cargo
dump_syms
makeWrapper
mimalloc
nodejs
perl
pkg-config
python3
rustc
rust-cbindgen
unzip
which
# build time
autoconf
cargo
dump_syms
makeWrapper
mimalloc
nodejs
perl
pkg-config
python3
rustc
rust-cbindgen
unzip
which

# runtime
bzip2
dbus
dbus-glib
file
fontconfig
freetype
glib
gnum4
gtk3
icu
icu72
libGL
libGLU
libevent
libffi
libjpeg
libpng
libstartup_notification
libvpx
libwebp
nasm
nspr
nss_latest
pango
zip
zlib
# runtime
bzip2
dbus
dbus-glib
file
fontconfig
freetype
glib
gnum4
gtk3
icu
icu72
libGL
libGLU
libevent
libffi
libjpeg
libpng
libstartup_notification
libvpx
libwebp
nasm
nspr
nss_latest
pango
zip
zlib

bzip2
dbus
Expand Down
2 changes: 1 addition & 1 deletion gluon.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
],
"licenseType": "MPL-2.0"
}
}
}
Loading
Loading