Skip to content

Commit fe6aa61

Browse files
authored
Merge pull request #7 from qryxip/some-internal-improvements
Some improvements
2 parents aff49a7 + 30f6bd0 commit fe6aa61

File tree

10 files changed

+221
-183
lines changed

10 files changed

+221
-183
lines changed

.github/workflows/actionlint.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: actionlint
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
actionlint:
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Update ShellCheck
13+
run: |
14+
sudo apt-get update
15+
sudo apt-get install -y shellcheck
16+
shellcheck -V
17+
18+
- name: actionlint
19+
run: |
20+
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
21+
./actionlint -color

.github/workflows/build.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
test:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
include:
12+
- { target: x86_64-pc-windows-msvc, os: windows-2019 }
13+
- { target: x86_64-pc-windows-msvc, os: windows-2022 }
14+
- { target: x86_64-apple-darwin, os: macos-11 }
15+
- { target: x86_64-apple-darwin, os: macos-12 }
16+
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 }
17+
- { target: x86_64-unknown-linux-gnu, os: ubuntu-22.04 }
18+
name: test (${{ matrix.target }})
19+
runs-on: ${{ matrix.os }}
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Read ./rust-toolchain
24+
id: read-rust-toolchain
25+
run: echo "toolchain=$(cat ./rust-toolchain)" >> "$GITHUB_OUTPUT"
26+
shell: bash
27+
28+
- name: Set up Rust
29+
uses: dtolnay/rust-toolchain@master
30+
with:
31+
toolchain: ${{ steps.read-rust-toolchain.outputs.toolchain }}
32+
targets: ${{ matrix.target }}
33+
34+
- name: Test (main)
35+
run: cargo test --target ${{ matrix.target }}
36+
37+
docker-build:
38+
runs-on: ubuntu-22.04
39+
steps:
40+
- uses: actions/checkout@v3
41+
42+
- name: Update ShellCheck
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get install -y shellcheck
46+
shellcheck -V
47+
48+
- name: Read ./rust-toolchain
49+
id: read-rust-toolchain
50+
run: echo "toolchain=$(cat ./rust-toolchain)" >> "$GITHUB_OUTPUT"
51+
shell: bash
52+
53+
- name: Set up Rust
54+
uses: dtolnay/rust-toolchain@master
55+
with:
56+
toolchain: ${{ steps.read-rust-toolchain.outputs.toolchain }}
57+
58+
- name: Generate install-command.bash
59+
run: cargo xtask gen-command > ./install-command.bash
60+
61+
- name: docker-build
62+
run: docker build .

.github/workflows/ci.yml

-174
This file was deleted.

.github/workflows/licenses.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Licenses
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
cargo-deny:
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Read ./rust-toolchain
13+
id: read-rust-toolchain
14+
run: echo "toolchain=$(cat ./rust-toolchain)" >> "$GITHUB_OUTPUT"
15+
shell: bash
16+
17+
- name: Set up Rust
18+
uses: dtolnay/rust-toolchain@master
19+
with:
20+
toolchain: ${{ steps.read-rust-toolchain.outputs.toolchain }}
21+
22+
- name: Install cargo-binstall
23+
uses: taiki-e/install-action@cargo-binstall
24+
25+
- name: Install cargo-deny
26+
run: cargo binstall cargo-deny@^0.13 --no-confirm --log-level debug
27+
28+
- name: cargo-deny (main)
29+
run: cargo deny check
30+
31+
bottlerocket-license-scan:
32+
runs-on: ubuntu-22.04
33+
steps:
34+
- uses: actions/checkout@v3
35+
36+
- name: Read ./rust-toolchain
37+
id: read-rust-toolchain
38+
run: echo "toolchain=$(cat ./rust-toolchain)" >> "$GITHUB_OUTPUT"
39+
shell: bash
40+
41+
- name: Set up Rust
42+
uses: dtolnay/rust-toolchain@master
43+
with:
44+
toolchain: ${{ steps.read-rust-toolchain.outputs.toolchain }}
45+
46+
- name: Install bottlerocket-license-scan
47+
run: cargo install bottlerocket-license-scan --git https://github.com/bottlerocket-os/bottlerocket-sdk
48+
49+
- name: bottlerocket-license-scan (main)
50+
run: |
51+
git clone https://github.com/spdx/license-list-data.git /tmp/license-list-data --depth 1
52+
~/.cargo/bin/bottlerocket-license-scan --clarify ./clarify.toml --out-dir ./license_files --spdx-data /tmp/license-list-data/json/details cargo ./Cargo.toml
53+
tree ./license_files

.github/workflows/rust-lint.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Rust Lint
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
rustfmt:
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Read ./rust-toolchain
13+
id: read-rust-toolchain
14+
run: echo "toolchain=$(cat ./rust-toolchain)" >> "$GITHUB_OUTPUT"
15+
shell: bash
16+
17+
- name: Set up Rust
18+
uses: dtolnay/rust-toolchain@master
19+
with:
20+
toolchain: ${{ steps.read-rust-toolchain.outputs.toolchain }}
21+
components: rustfmt
22+
23+
- name: Rustfmt (main)
24+
run: cargo fmt --all -- --check
25+
26+
- name: Rustfmt (xtask)
27+
run: cargo fmt --all --manifest-path ./xtask/Cargo.toml -- --check
28+
29+
clippy:
30+
runs-on: ubuntu-22.04
31+
steps:
32+
- uses: actions/checkout@v3
33+
34+
- name: Read ./rust-toolchain
35+
id: read-rust-toolchain
36+
run: echo "toolchain=$(cat ./rust-toolchain)" >> "$GITHUB_OUTPUT"
37+
shell: bash
38+
39+
- name: Set up Rust
40+
uses: dtolnay/rust-toolchain@master
41+
with:
42+
toolchain: ${{ steps.read-rust-toolchain.outputs.toolchain }}
43+
components: clippy
44+
45+
- name: Clippy (xtask)
46+
run: cargo clippy --manifest-path ./xtask/Cargo.toml

.github/workflows/typos.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: typos
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
typos:
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- uses: crate-ci/typos@master

Dockerfile

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
FROM ubuntu:22.10
2-
RUN mkdir /judge
3-
WORKDIR /judge
4-
COPY ./install-command.bash /tmp/
52
RUN apt-get update
63
RUN apt-get install -y --no-install-recommends sudo
4+
RUN groupadd -g 1000 runner && \
5+
useradd -g runner -G sudo -m runner && \
6+
echo 'runner ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
7+
mkdir /judge && \
8+
chown runner:runner /judge
9+
COPY ./install-command.bash /tmp/
10+
USER runner
11+
WORKDIR /judge
712
RUN bash /tmp/install-command.bash

0 commit comments

Comments
 (0)