Skip to content

Commit

Permalink
ci: Linux用のCIを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
aznhe21 committed Sep 4, 2023
1 parent ec49d22 commit ba683b3
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 3 deletions.
30 changes: 27 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,25 @@ on: [push, pull_request]

jobs:
test:
runs-on: windows-latest
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- run: sudo ./.gitlab/setup-deps.sh
if: matrix.os == 'ubuntu-latest'
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_stable }}
- uses: Swatinem/rust-cache@v2
- run: cargo test --workspace

minrust:
runs-on: windows-latest
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -32,9 +40,25 @@ jobs:
RUSTFLAGS: "" # remove -Dwarnings

build:
runs-on: windows-latest
strategy:
matrix:
os: [ubuntu-latest]
image:
# 直近2バージョン+LTS
- ubuntu:22.04
- ubuntu:22.10
- ubuntu:23.04
- fedora:37
- fedora:38
include:
- os: windows-latest
image: null
runs-on: ${{ matrix.os }}
container: ${{ matrix.image }}
steps:
- uses: actions/checkout@v3
- run: ./.gitlab/setup-deps.sh
if: matrix.os == 'ubuntu-latest'
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_stable }}
Expand Down
38 changes: 38 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,44 @@ windows:build:
script:
- cargo build -p tavoo

linux:test:
extends: [.rust-cache]
image: rust:slim-bookworm
before_script:
- ./.gitlab/setup-deps.sh
script:
- cargo test --workspace

linux:minrust:
extends: [.rust-cache]
image: rust:$rust_min-slim-bullseye
variables:
RUSTFLAGS: "" # remove -Dwarnings
before_script:
- apt-get update && apt-get install -y --no-install-recommends gcc gcc-multilib
script:
- cargo check -p isdb --all-features

linux:build:
extends: [.rust-cache]
needs: [linux:test]
parallel:
matrix:
- IMAGE:
# 直近2バージョン+LTS
- ubuntu:22.04
- ubuntu:22.10
- ubuntu:23.04
- fedora:37
- fedora:38
image: $IMAGE
before_script:
- ./.gitlab/setup-deps.sh
- ./.gitlab/setup-rust.sh stable
- . ./env
script:
- cargo build -p tavoo

##############################

.rust-cache:
Expand Down
20 changes: 20 additions & 0 deletions .gitlab/setup-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -euo pipefail

. /etc/os-release

case "$ID" in
debian | ubuntu)
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl gcc gcc-multilib webkit2gtk-4.1-dev
;;
fedora)
dnf install --setopt=install_weak_deps=False -y \
curl gcc webkit2gtk4.1-devel
;;
*)
echo "unknown distro"
exit 1
;;
esac
17 changes: 17 additions & 0 deletions .gitlab/setup-rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -euo pipefail

if [ $# -ne 1 ]; then
exit 1
fi

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q -y --profile minimal --default-toolchain "$1"

cat <<'EOF' > ./env
if [[ $CARGO_HOME ]]; then
export PATH="$PATH:$CARGO_HOME/bin"
else
export PATH="$PATH:$HOME/.cargo/bin"
fi
EOF

0 comments on commit ba683b3

Please sign in to comment.