1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '0 9 * * 1'
env:
CARGO_TERM_COLOR: always
jobs:
build-bootstrapped:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: 🏗️ Setup build cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cache/repro-env/pkgs/
target/
key: ${{ runner.os }}-cargo-release-bootstrapped-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-release-bootstrapped-
- name: 🛠️ Build
run: make
- name: 🔍 SHA256
run: sha256sum target/x86_64-unknown-linux-musl/release/repro-env
- name: 📦 Upload binary
uses: actions/upload-artifact@v4
with:
name: bin
path: target/x86_64-unknown-linux-musl/release/repro-env
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-release-
- name: Build
run: cargo build --release --verbose
build-ubuntu:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install -y repro-env
- name: 🏗️ Setup build cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cache/repro-env/pkgs/
target/
key: ${{ runner.os }}-cargo-release-ubuntu-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-release-ubuntu-
- name: 🛠️ Build
run: repro-env build -- make build2
- name: 🔍 SHA256
run: sha256sum target/x86_64-unknown-linux-musl/release/repro-env
integration-test:
needs: build-bootstrapped
strategy:
fail-fast: false
matrix:
test:
- folder: examples/rust
cmd: cargo build --release
output: target/release/rust
sha256: ea8997342bef06680784c9ea6ef7e22f7ba089e98927e870905503d0bf39acb1
- folder: examples/golang
cmd: go build .
output: hello
sha256: dd41bdb93af4fb798f6b079368d6ee50a6907044c292ba6d2c98420ca8f012bf
- folder: examples/debian
cmd: gcc -static -o hello hello.c
output: hello
sha256: 2b24cfa838189c3aa6fa2440afe8508654830b6d3bad85d9b31958ae5c3fb429
- folder: examples/archlinux
cmd: gcc -static -o hello hello.c
output: hello
sha256: 04e03fd681793db603feb66a4c8e8df3858f1e31372dc017d7a0cf255faf84c5
#- folder: examples/alpine
# cmd: gcc -static -o hello hello.c
# output: hello
# sha256: a312585d54252990c2264351769f1cf2539f674db1142c7ea18fe10096debf12
name: ${{ matrix.test.folder }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: 🏗️ Setup build cache
uses: actions/cache@v4
with:
path: |
~/.cache/repro-env/pkgs/
key: repro-env-${{ matrix.test.folder }}
- name: 🛠️ Build artifact
run: chmod +x bin/repro-env && bin/repro-env -C ${{ matrix.test.folder }} build -- ${{ matrix.test.cmd }}
- name: 🔍 Verify artifact
run: cd ${{ matrix.test.folder }} && echo "${{ matrix.test.sha256 }} ${{ matrix.test.output }}" | sha256sum -c -
unit-test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-debug-
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Run tests
run: cargo test --verbose
deny:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Run cargo deny
run: |
docker run --rm -v "$PWD:/src" -w /src alpine:edge sh -c '
set -e
apk add cargo-deny --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing/ || apk add cargo-deny --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community/ || apk add cargo-deny
apk add cargo
exec cargo deny check
'
fmt:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Run cargo fmt
run: cargo fmt --all -- --check
docs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install scdoc
- name: Build
run: make docs
|