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

merge back to master #27

Merged
merged 10 commits into from
Jan 28, 2024
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
46 changes: 24 additions & 22 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ jobs:
uses: taiki-e/install-action@just
- name: Install sea-orm-cli
run: cargo install sea-orm-cli
- name: Install docker
uses: docker-practice/actions-setup-docker@master
- name: Lint
run: |
cargo fmt --all -- --check
Expand All @@ -60,7 +58,7 @@ jobs:
steps:
- name: Check out
uses: actions/checkout@v3
- name: Checkout submodules
- name: Checkout submodule
run: git submodule update --init --recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
Expand All @@ -70,38 +68,42 @@ jobs:
components: clippy, rustfmt
- name: Install Just
uses: taiki-e/install-action@just
- name: Install sea-orm-cli
run: cargo install sea-orm-cli
- name: Install docker
uses: docker-practice/actions-setup-docker@master
- name: build nsjail
run: cd judger && just build-nsjail
- name: build rlua-54
run: cd judger && just release-docker
- name: Log in to the Container registry
uses: docker/login-action
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build judger
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: "judger"
push: true
tags: "staging"
labels: "judger"
- name: build backend
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
uses: docker/build-push-action@v5
with:
context: "backend"
build-args: ARCH=x86_64
context: "."
file: "backend/Dockerfile"
push: true
tags: "staging"
labels: "backend"
- name: build migration
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
uses: docker/build-push-action@v5
with:
build-args: ARCH=x86_64
context: "."
file: "backend/migration/Dockerfile"
push: true
tags: "staging"
labels: "backend/migration"
- name: build nsjail
run: cd judger && just build-nsjail
- name: build rlua-54
run: cd judger && just release-docker
- name: build judger
uses: docker/build-push-action@v5
with:
context: "backend/migration"
build-args: ARCH=x86_64
context: "."
file: "judger/Dockerfile"
push: true
tags: "staging"
labels: "backend/migration"
labels: "judger"
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "judger/nsjail-docker"]
path = judger/nsjail-docker
url = git@github.com:mdcpp/static-binary-zoo.git
url = https://github.com/mdcpp/static-binary-zoo.git
3 changes: 3 additions & 0 deletions backend/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ entity-codegen:
sea-orm-cli migrate -u sqlite://database/backend.sqlite?mode=rwc
sea-orm-cli generate entity -u sqlite://database/backend.sqlite?mode=rwc -o src/pending

# release-docker:
# sudo docker build --build-arg ARCH=$(uname -m) -f ./Dockerfile -t mdoj-backend ..

run:
cargo run

Expand Down
2 changes: 1 addition & 1 deletion backend/migration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN rustup target add ${ARCH}-unknown-linux-musl

WORKDIR /complier
COPY . .
RUN cargo install --target ${ARCH}-unknown-linux-musl --path migration
RUN cargo install --target ${ARCH}-unknown-linux-musl --path backend/migration

FROM scratch
COPY --from=builder /usr/local/cargo/bin/migration /
Expand Down
2 changes: 1 addition & 1 deletion judger/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ release-plugin:
cd plugins sh export-all.sh

build-nsjail:
cd nsjail-docker && sudo make nsjail-3.1
cd nsjail-docker && sudo make nsjail-3.1 > /dev/null
cp nsjail-docker/output/*-linux-musl/nsjail-* .

prepare:
Expand Down
2 changes: 1 addition & 1 deletion judger/plugins/c-11/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mkdir -p rootfs
sudo docker build -t c-11-mdoj-plugin .
sudo docker export $(sudo docker create c-11-mdoj-plugin) | tar -C rootfs -xvf -
sudo docker export $(sudo docker create c-11-mdoj-plugin) | tar -C rootfs -xvf - > /dev/null
2 changes: 1 addition & 1 deletion judger/plugins/cpp-11/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mkdir -p rootfs
sudo docker build -t cpp-11-mdoj-plugin .
sudo docker export $(sudo docker create cpp-11-mdoj-plugin) | tar -C rootfs -xvf -
sudo docker export $(sudo docker create cpp-11-mdoj-plugin) | tar -C rootfs -xvf - > /dev/null
2 changes: 1 addition & 1 deletion judger/plugins/rlua-54/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mkdir -p rootfs
sudo docker build --build-arg ARCH=$(uname -m) -t rlua-54-mdoj-plugin .
sudo docker export $(sudo docker create rlua-54-mdoj-plugin) | tar -C rootfs -xvf -
sudo docker export $(sudo docker create rlua-54-mdoj-plugin) | tar -C rootfs -xvf - > /dev/null