Skip to content

Commit 769617c

Browse files
committed
github compilation
1 parent 16a860d commit 769617c

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

.github/workflows/ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Build cbm-basic on all platforms
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
tags: [ "v*" ]
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
name: Build (${{ matrix.os }})
12+
runs-on: ${{ matrix.os }}
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- os: ubuntu-latest
19+
artifact: basic-linux
20+
archive: basic-linux.tar.gz
21+
outdir: linux
22+
bin: basic
23+
- os: macos-latest
24+
artifact: basic-macos
25+
archive: basic-macos.tar.gz
26+
outdir: mac
27+
bin: basic
28+
- os: windows-latest
29+
artifact: basic-windows
30+
archive: basic-windows.zip
31+
outdir: windows
32+
bin: basic.exe
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
38+
- name: Build (Unix)
39+
if: runner.os != 'Windows'
40+
run: |
41+
make
42+
43+
- name: Build (Windows)
44+
if: runner.os == 'Windows'
45+
run: |
46+
choco install -y make
47+
make
48+
49+
- name: Package artifact (Unix)
50+
if: runner.os != 'Windows'
51+
run: |
52+
mkdir -p out/${{ matrix.outdir }}
53+
cp ${{ matrix.bin }} out/${{ matrix.outdir }}/basic
54+
cd out
55+
tar czf ${{ matrix.archive }} ${{ matrix.outdir }}
56+
57+
- name: Package artifact (Windows)
58+
if: runner.os == 'Windows'
59+
shell: bash
60+
run: |
61+
mkdir -p out/${{ matrix.outdir }}
62+
cp ${{ matrix.bin }} out/${{ matrix.outdir }}/basic.exe
63+
cd out
64+
powershell -Command "Compress-Archive -Path '${{ matrix.outdir }}' -DestinationPath '${{ matrix.archive }}'"
65+
66+
- name: Upload build artifact
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: ${{ matrix.artifact }}
70+
path: out/${{ matrix.archive }}
71+
72+
release:
73+
name: Release tagged build
74+
needs: build
75+
if: startsWith(github.ref, 'refs/tags/')
76+
runs-on: ubuntu-latest
77+
78+
steps:
79+
- name: Download artifacts
80+
uses: actions/download-artifact@v4
81+
with:
82+
path: dist
83+
84+
- name: Create GitHub Release
85+
uses: softprops/action-gh-release@v1
86+
with:
87+
files: dist/**/*
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+

0 commit comments

Comments
 (0)