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

Trusted Build changes #4001

Merged
merged 16 commits into from
Oct 2, 2023
Merged
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
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,8 @@ commands:
name: Setup Dependencies
command: |
pnpm install --frozen-lockfile
pnpm --dir libs/ballot-interpreter install:rust-addon
pnpm --dir libs/ballot-interpreter build:rust-addon
- save_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum
Expand Down
2 changes: 0 additions & 2 deletions apps/admin/backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ NODE_ENV ?= development
FORCE:

install:
sudo apt -y update
sudo apt -y install libpcsclite1 libpcsclite-dev

build: FORCE
pnpm install && pnpm build
Expand Down
2 changes: 0 additions & 2 deletions apps/admin/frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# a phony dependency that can be used as a dependency to force builds
FORCE:

# install any required dependencies here, i.e. `sudo apt install -y DEPS`
install:
sudo apt install -y fdisk dosfstools exfat-utils

build: FORCE
pnpm install && pnpm build
Expand Down
1 change: 0 additions & 1 deletion apps/admin/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
"vx": {
"isBundled": true,
"services": [
"../../../services/converter-ms-sems",
"../backend"
]
}
Expand Down
10 changes: 0 additions & 10 deletions apps/central-scan/backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ TIMESTAMP := $(shell date --iso-8601=seconds --utc | sed 's/+.*$\//g' | tr ':' '
FORCE:

install:
sudo apt-get -y update
ifeq ($(OS),bionic)
sudo apt-get install -y libsane build-essential libx11-dev libjpeg-dev libpng-dev libpcsclite1 libpcsclite-dev
endif
ifeq ($(OS),focal)
sudo apt install -y libsane build-essential libpixman-1-dev libcairo2-dev libpango1.0-dev libjpeg8-dev libgif-dev libpcsclite1 libpcsclite-dev
endif
ifeq ($(OS),bullseye)
sudo apt install -y libsane libpng-dev libjpeg-dev libx11-dev libpixman-1-dev libcairo2-dev libpango1.0-dev libgif-dev libpcsclite1 libpcsclite-dev
endif

build: FORCE
pnpm install && pnpm build
Expand Down
3 changes: 1 addition & 2 deletions apps/central-scan/frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
# a phony dependency that can be used as a dependency to force builds
FORCE:

# install any required dependencies here, i.e. `sudo apt install -y DEPS`
install:

build: FORCE
pnpm install && pnpm build
pnpm install && pnpm --dir ../../../libs/ballot-interpreter build && pnpm build

bootstrap: install build

Expand Down
7 changes: 7 additions & 0 deletions apps/design/backend/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Placeholder for build

install:

build:

bootstrap:
1 change: 0 additions & 1 deletion apps/design/frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# a phony dependency that can be used as a dependency to force builds
FORCE:

# install any required dependencies here, i.e. `sudo apt install -y DEPS`
install:

build: FORCE
Expand Down
2 changes: 0 additions & 2 deletions apps/mark-scan/backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ build: FORCE
bootstrap: build

install:
sudo apt -y update
sudo apt -y install libpcsclite1 libpcsclite-dev

run:
pnpm start
3 changes: 1 addition & 2 deletions apps/mark-scan/frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ BACKEND := ../backend
# a phony dependency that can be used as a dependency to force builds
FORCE:

# install any required dependencies here, i.e. `sudo apt install -y DEPS`
install:

build-backend:
Expand All @@ -18,7 +17,7 @@ run-all:
(trap 'kill 0' SIGINT SIGHUP; make -C $(BACKEND) run & cd prodserver && node index.js)

build: FORCE
pnpm install && pnpm build
pnpm install && pnpm --dir ../../../libs/ballot-interpreter build && pnpm build

bootstrap: install build

Expand Down
2 changes: 0 additions & 2 deletions apps/mark/backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ build: FORCE
bootstrap: build

install:
sudo apt -y update
sudo apt -y install libpcsclite1 libpcsclite-dev

run:
pnpm start
1 change: 0 additions & 1 deletion apps/mark/frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ BACKEND := ../backend
# a phony dependency that can be used as a dependency to force builds
FORCE:

# install any required dependencies here, i.e. `sudo apt install -y DEPS`
install:

build-backend:
Expand Down
10 changes: 0 additions & 10 deletions apps/scan/backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ TIMESTAMP := $(shell date --iso-8601=seconds --utc | sed 's/+.*$\//g' | tr ':' '
FORCE:

install:
sudo apt-get -y update
ifeq ($(OS),bionic)
sudo apt-get install -y libsane build-essential libx11-dev libjpeg-dev libpng-dev libpcsclite1 libpcsclite-dev
endif
ifeq ($(OS),focal)
sudo apt install -y libsane build-essential libpixman-1-dev libcairo2-dev libpango1.0-dev libjpeg8-dev libgif-dev libpcsclite1 libpcsclite-dev
endif
ifeq ($(OS),bullseye)
sudo apt install -y libsane libpng-dev libjpeg-dev libx11-dev libpixman-1-dev libcairo2-dev libpango1.0-dev libgif-dev libpcsclite1 libpcsclite-dev
endif

build: FORCE
pnpm install && pnpm build
Expand Down
3 changes: 1 addition & 2 deletions apps/scan/frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
# a phony dependency that can be used as a dependency to force builds
FORCE:

# install any required dependencies here, i.e. `sudo apt install -y DEPS`
install:

build: FORCE
pnpm install && pnpm build
pnpm install && pnpm --dir ../../../libs/ballot-interpreter build && pnpm build

bootstrap: install build

Expand Down
1 change: 0 additions & 1 deletion libs/auth/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
install-script-dependencies:
sudo apt install -y default-jdk wget
wget 'https://github.com/martinpaljak/GlobalPlatformPro/releases/download/v20.08.12/gp.jar'
@echo 'Checking hash of downloaded gp.jar'
@sha256sum gp.jar | diff scripts/gp.jar.sha256sum - || (echo '❌ Hash check of downloaded gp.jar failed' && rm gp.jar && exit 1)
Expand Down
6 changes: 0 additions & 6 deletions libs/ballot-interpreter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ This library requires a
[supported version of Node and Rust](https://github.com/neon-bindings/neon#platform-support).
The easiest way to install Rust is via [rustup](https://rustup.rs/).

Then run:

```sh
$ pnpm install
```

## Build

This will build both the Rust library and the Node package.
Expand Down
6 changes: 3 additions & 3 deletions libs/ballot-interpreter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
],
"scripts": {
"benchmark": "jest --runInBand --projects benchmarks",
"build": "pnpm build:rust-addon && pnpm build:ts",
"build:rust-addon": "cargo-cp-artifact -nc build/hmpb-ts/rust_addon.node -- cargo build --message-format=json-render-diagnostics --release",
"build": "pnpm install:rust-addon && pnpm build:rust-addon && pnpm build:ts",
"build:rust-addon": "cargo-cp-artifact -nc build/hmpb-ts/rust_addon.node -- cargo build --message-format=json-render-diagnostics --release --offline",
"build:ts": "tsc --build tsconfig.build.json",
"clean": "cargo clean && rm -rf build tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo",
"install": "pnpm build:rust-addon",
"install:rust-addon": "cargo fetch",
"lint": "pnpm type-check && eslint .",
"lint:fix": "pnpm type-check && eslint . --fix",
"pre-commit": "lint-staged",
Expand Down
2 changes: 2 additions & 0 deletions libs/monorepo-utils/src/circleci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ commands:
name: Setup Dependencies
command: |
pnpm install --frozen-lockfile
pnpm --dir libs/ballot-interpreter install:rust-addon
pnpm --dir libs/ballot-interpreter build:rust-addon
- save_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum
Expand Down
9 changes: 6 additions & 3 deletions script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

set -euo pipefail

# pixman-1 is effectively a dependency in all pnpm calls, go ahead and install it
sudo apt install -y libsane libpng-dev libjpeg-dev libx11-dev libpixman-1-dev libcairo2-dev libpango1.0-dev libgif-dev build-essential
local_user=`logname`
local_user_home_dir=$( getent passwd "${local_user}" | cut -d: -f6 )

# Make sure PATH includes cargo and /sbin
export PATH="${local_user_home_dir}/.cargo/bin:${PATH}:/sbin/"

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

for app in ${DIR}/../frontends/* ${DIR}/../services/* ${DIR}/../apps/*/frontend ${DIR}/../apps/*/backend; do
for app in ${DIR}/../apps/*/frontend ${DIR}/../apps/*/backend; do
if [ -d "${app}" ]; then
make -C "${app}" bootstrap
fi
Expand Down
2 changes: 1 addition & 1 deletion script/src/prod-build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { rmrf } from './utils/rmrf';

export function main({ stdout }: IO): void {
// Ensure pipenv places the virtualenv in the project.
process.env.PIPENV_VENV_IN_PROJECT = '1';
process.env.PIPENV_VENV_IN_PROJECT = '0';

const root = getDependencyGraph(process.cwd(), PackageType.Frontend);
stdout.write(`ℹ️ Building ${root.path} for production\n`);
Expand Down
13 changes: 4 additions & 9 deletions services/converter-ms-sems/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@

add-ppa:
apt-cache search --names-only "^python3.9$$" | grep python || sudo add-apt-repository -y ppa:deadsnakes/ppa # add deadsnakes only if we need to

install-python: add-ppa
sudo apt install -y python3.9 python3.9-dev python3-distutils python3-pip

install: install-python
install:

install-dependencies:
python3.9 -m pip install pipenv
Expand All @@ -14,7 +7,9 @@ install-dependencies:
install-dev-dependencies:
python3.9 -m pipenv install --dev

build: install-dependencies
build:

build_deprecated: install-dependencies

bootstrap: install build install-dev-dependencies

Expand Down