Skip to content

Commit 89a64e4

Browse files
committed
ci: use alpine container
drop bash
1 parent 0c8ecdf commit 89a64e4

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

.github/workflows/artifacts.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
arch: "x86-64",
2727
extra_ldflags: "",
2828
platform: "linux",
29+
docker: true,
30+
docker_platform: "linux/amd64",
31+
image: "alpine:3.22",
2932
}
3033
- {
3134
name: "Ubuntu 22.04 GCC ARM64",
@@ -36,6 +39,9 @@ jobs:
3639
arch: "arm64",
3740
extra_ldflags: "",
3841
platform: "linux",
42+
docker: true,
43+
docker_platform: "linux/arm64",
44+
image: "alpine:3.22",
3945
}
4046
- {
4147
name: "Ubuntu 22.04 GCC RISC-V",
@@ -46,7 +52,7 @@ jobs:
4652
extra_ldflags: "-latomic",
4753
docker: true,
4854
docker_platform: "linux/riscv64",
49-
image: "riscv64/ubuntu:22.04",
55+
image: "riscv64/alpine:3.22",
5056
arch: "risc-v",
5157
platform: "linux",
5258
}
@@ -139,7 +145,7 @@ jobs:
139145
uses: docker/setup-qemu-action@v3
140146

141147
# Build RISC-V in Docker
142-
- name: Build in Docker (RISC-V)
148+
- name: Build in Docker
143149
if: matrix.config.docker == true
144150
run: |
145151
sudo apt-get update
@@ -148,12 +154,12 @@ jobs:
148154
-v ${{ github.workspace }}:/workspace \
149155
-w /workspace \
150156
${{ matrix.config.image }} \
151-
bash -c "
152-
apt-get update &&
153-
apt-get install -y build-essential g++ make &&
157+
sh -c "
158+
apk add --no-cache build-base g++ make &&
154159
make -j2 build=release EXTRA_LDFLAGS='${{ matrix.config.extra_ldflags }}' NATIVE='${{ matrix.config.native }}' COMPILER='${{ matrix.config.compiler }}' COMPILE_MSG='compiled for ${{ matrix.config.os }} ${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }} (CI)' &&
155160
strip ./fastchess${{ matrix.config.ext }} || true &&
156-
mv fastchess${{ matrix.config.ext }} fastchess-${{ matrix.config.platform }}${{ matrix.config.ext }} &&
161+
find . -type f \( -name "*.o" -o -name "*.d" \) -delete &&
162+
find . -type d -name "sha" -exec rm -rf {} + &&
157163
./fastchess* -version
158164
"
159165
@@ -163,12 +169,10 @@ jobs:
163169
run: |
164170
make -j2 build=release EXTRA_LDFLAGS='${{ matrix.config.extra_ldflags }}' NATIVE="$NATIVE" COMPILER="$COMPILER" COMPILE_MSG="compiled for ${{ matrix.config.os }} ${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }} (CI)"
165171
strip ./fastchess$EXT || true
172+
find . -type f \( -name "*.o" -o -name "*.d" \) -delete
173+
find . -type d -name "sha" -exec rm -rf {} +
166174
./fastchess* -version
167175
168-
- name: Find and remove empty files
169-
run: rm -rf *.o *.d sha
170-
shell: bash
171-
172176
- name: Archive binaries
173177
uses: actions/upload-artifact@v4
174178
with:

.github/workflows/fastchess.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
Artifacts:
1313
if: github.ref == 'refs/heads/master' || github.ref_type == 'tag'
1414
uses: ./.github/workflows/artifacts.yml
15-
PreCreateRelease:
15+
Precreate-Release:
1616
needs: [Artifacts]
1717
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
1820
steps:
1921
- name: Checkout code
2022
uses: actions/checkout@v4
@@ -25,11 +27,11 @@ jobs:
2527
with:
2628
draft: true
2729
generate_release_notes: true
28-
token: ${{ secrets.token }}
30+
token: ${{ secrets.GITHUB_TOKEN }}
2931

3032
Release:
3133
if: github.ref_type == 'tag'
32-
needs: [PreCreateRelease]
34+
needs: [Precreate-Release]
3335
permissions:
3436
contents: write
3537
uses: ./.github/workflows/release.yml

.github/workflows/release.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
required: true
88
jobs:
99
Artifacts:
10-
name: ${{ matrix.config.name }} Binary
10+
name: ${{ matrix.config.os }} ${{ matrix.config.arch }} binary
1111
runs-on: ubuntu-latest
1212
permissions:
1313
contents: write
@@ -17,32 +17,32 @@ jobs:
1717
config:
1818
# Linux
1919
- {
20-
os: ubuntu,
20+
os: "ubuntu",
2121
arch: "x86-64",
2222
platform: "linux",
2323
archive_ext: "tar",
2424
}
2525
- { os: ubuntu, arch: "arm64", platform: "linux", archive_ext: "tar" }
2626
- {
27-
os: ubuntu,
27+
os: "ubuntu",
2828
arch: "risc-v",
2929
platform: "linux",
3030
archive_ext: "tar",
3131
}
3232

3333
# macOS
34-
- { os: macos, arch: "x86-64", platform: "mac", archive_ext: "tar" }
35-
- { os: macos, arch: "arm64", platform: "mac", archive_ext: "tar" }
34+
- { os: "macos", arch: "x86-64", platform: "mac", archive_ext: "tar" }
35+
- { os: "macos", arch: "arm64", platform: "mac", archive_ext: "tar" }
3636

3737
# Windows (MSYS2 / MinGW)
3838
- {
39-
os: windows,
39+
os: "windows",
4040
archive_ext: "zip",
4141
arch: "x86-64",
4242
platform: "windows",
4343
}
4444
- {
45-
os: windows,
45+
os: "windows",
4646
archive_ext: "zip",
4747
arch: "arm64",
4848
platform: "windows",
@@ -63,13 +63,13 @@ jobs:
6363
path: fastchess-${{ matrix.config.platform }}-${{ matrix.config.arch }}
6464

6565
- name: Create tar
66-
if: ${{ matrix.config.os }} != 'windows'
66+
if: matrix.config.os != 'windows'
6767
run: |
6868
chmod +x ./fastchess-${{ matrix.config.platform }}-${{ matrix.config.arch }}/fastchess
6969
tar -cvf fastchess-${{ matrix.config.platform }}-${{ matrix.config.arch }}.tar fastchess-${{ matrix.config.platform }}-${{ matrix.config.arch }}
7070
7171
- name: Create zip
72-
if: ${{ matrix.config.os }} == 'windows'
72+
if: matrix.config.os == 'windows'
7373
run: |
7474
zip -r fastchess-${{ matrix.config.platform }}-${{ matrix.config.arch }}.zip fastchess-${{ matrix.config.platform }}-${{ matrix.config.arch }}
7575

0 commit comments

Comments
 (0)