Skip to content

Commit ddbbf8a

Browse files
committed
chore(ci): migrate to cross-platform-actions for *BSD targets
1 parent 03fd93c commit ddbbf8a

File tree

1 file changed

+28
-64
lines changed

1 file changed

+28
-64
lines changed

.github/workflows/ci.yml

+28-64
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
steps:
5555
- name: Checkout
56-
uses: actions/checkout@v2
56+
uses: actions/checkout@v4
5757

5858
- name: Install toolchain
5959
uses: actions-rs/toolchain@v1
@@ -77,80 +77,44 @@ jobs:
7777

7878
test-qemu:
7979
name: Test (${{ matrix.target }})
80-
runs-on: ubuntu-20.04
81-
env: { SSHPASS: 12345 }
80+
runs-on: ubuntu-latest
8281
strategy:
8382
matrix:
8483
include:
8584
- target: x86_64-unknown-freebsd
86-
image: https://gitlab.com/kit-ty-kate/qemu-base-images/-/raw/master/FreeBSD-13.2-RELEASE-amd64.qcow2?inline=false
87-
md5: 33b6bc89cdc675f5cbaf92e71ae648f8
88-
args: -net nic
85+
os: freebsd
86+
os-version: '14.0'
87+
setup: |
88+
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
89+
export PATH="$HOME/.cargo/bin:$PATH"
8990
- target: x86_64-unknown-openbsd
90-
image: https://gitlab.com/kit-ty-kate/qemu-base-images/-/raw/master/OpenBSD-7.4-amd64.qcow2?inline=false
91-
md5: 1b7f3867c72f1dac3901b4a08257f580
92-
args: -net nic
91+
os: openbsd
92+
os-version: '7.4'
93+
setup: |
94+
sudo pkg_add rust
95+
- target: x86_64-unknown-netbsd
96+
os: netbsd
97+
os-version: '9.3'
98+
setup: |
99+
sudo pkgin install mozilla-rootcerts
100+
sudo mozilla-rootcerts install
101+
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
102+
export PATH="$HOME/.cargo/bin:$PATH"
93103
fail-fast: false
94104

95105
steps:
96106
- name: Checkout
97-
uses: actions/checkout@v2
98-
99-
- name: Install QEMU
100-
run: sudo apt-get update && sudo apt-get install -y qemu-system-x86
107+
uses: actions/checkout@v4
101108

102-
- name: Lookup image
103-
id: lookup-image
104-
uses: actions/cache@v2
109+
- name: Run tests (cargo)
110+
uses: cross-platform-actions/[email protected]
105111
with:
106-
path: ~/image.qcow2
107-
key: ${{ matrix.target }}-image
108-
109-
- name: Download image
110-
if: steps.lookup-image.outputs.cache-hit != 'true'
111-
run: |
112-
wget -O - --progress=dot:mega "${{ matrix.image }}" \
113-
| tee ~/image.qcow2 \
114-
| md5sum -c <(echo "${{ matrix.md5 }} -")
115-
116-
- name: Boot image
117-
run: |
118-
qemu-system-x86_64 -m 2048 -display none -snapshot -daemonize \
119-
-drive if=ide,media=disk,file=$HOME/image.qcow2 \
120-
-net user,hostfwd=tcp::1025-:22 \
121-
${{ matrix.args }}
122-
123-
- name: Configure SSH
124-
run: |
125-
ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa
126-
cat > ~/.ssh/config <<EOF
127-
Host qemu
128-
User root
129-
HostName localhost
130-
Port 1025
131-
EOF
132-
chmod og-rw ~
133-
parallel -t --retries 20 --delay 5 ::: 'sshpass -e ssh-copy-id -o StrictHostKeyChecking=no qemu'
134-
135-
- name: Install toolchain (rustup)
136-
if: ${{ contains(matrix.target, 'freebsd') }}
137-
run: |
138-
ssh qemu <<'EOF'
139-
pkg install -y curl
140-
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
141-
ln -s ~/.cargo/bin ~/bin
142-
EOF
143-
144-
- name: Install toolchain (pkg)
145-
if: ${{ contains(matrix.target, 'openbsd') }}
146-
run: ssh qemu "pkg_add rust"
147-
148-
- name: Copy crate
149-
run: scp -r $PWD qemu:crate
150-
151-
# TODO: Respect RUST_TEST_THREADS
152-
- name: Run tests
153-
run: ssh qemu "cd crate && cargo test"
112+
operating_system: ${{ matrix.os }}
113+
architecture: ${{ matrix.architecture || 'x86-64' }}
114+
version: ${{ matrix.os-version }}
115+
run: |
116+
${{ matrix.setup }}
117+
cargo test
154118
155119
check:
156120
name: Check (${{ matrix.target }})

0 commit comments

Comments
 (0)