Skip to content

Commit f4a83da

Browse files
authored
Merge pull request #132 from cobalt-language/auto-builds
Automatically build artifacts
2 parents a2745f6 + 20e4b4e commit f4a83da

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/build.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build Artifacts
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
CARGO_TERM_COLOR: always
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
os:
14+
- runner: ubuntu-latest
15+
name: linux
16+
- runner: macos-latest
17+
name: apple
18+
llvm: [15, 16]
19+
profile: [debug, release]
20+
runs-on: "${{ matrix.os.runner }}"
21+
if: "${{ !cancelled() }}"
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
- name: Install LLVM (Homebrew)
26+
if: matrix.os.runner == 'macos-latest' && matrix.llvm >= 16
27+
run: |
28+
brew install llvm@${{ matrix.llvm }}
29+
echo /usr/local/opt/llvm@${{ matrix.llvm }}/bin >> $GITHUB_PATH
30+
- name: Install LLVM (Action)
31+
if: matrix.os.runner != 'macos-latest' || matrix.llvm <= 15
32+
uses: KyleMayes/install-llvm-action@v1
33+
with:
34+
version: "${{ matrix.llvm }}.0"
35+
- name: Cache Build Outputs
36+
uses: actions/cache@v3
37+
with:
38+
key: build-${{ matrix.os.runner }} -${{ github.ref_name }}-${{ hashFiles('**/src') }}
39+
restore-keys: |
40+
build-${{ matrix.os.runner }}-${{ github.ref_name }}-
41+
build-${{ matrix.os.runner }}
42+
path: |
43+
Cargo.lock
44+
target/
45+
- name: Build
46+
run: "cargo build --profile ${{ matrix.profile == 'debug' && 'dev' || matrix.profile }} --no-default-features -F build-default,llvm-${{ matrix.llvm }}"
47+
- name: Compress
48+
run: "gzip -fN9 'target/${{ matrix.profile }}/co'"
49+
- name: Upload
50+
uses: actions/upload-artifact@v3
51+
with:
52+
name: "co-${{ matrix.profile }}-${{ matrix.os.name }}-${{ matrix.link }}-${{ matrix.llvm }}.gz"
53+
path: "target/${{ matrix.profile }}/co.gz"

0 commit comments

Comments
 (0)