Skip to content

Commit

Permalink
refactor GitHub workflows
Browse files Browse the repository at this point in the history
Currently the workflows repeat steps unnecessarily. Compute and power
may be cheap but it's not free.
  • Loading branch information
MadnessASAP committed Dec 11, 2024
1 parent 411dc2a commit 271c949
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 1 deletion.
100 changes: 100 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build
on:
push:
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
shellcheck:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Differential ShellCheck
id: ShellCheck
uses: redhat-plumbers-in-action/differential-shellcheck@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload artifact with ShellCheck defects in SARIF format
uses: actions/upload-artifact@v4
with:
name: Differential ShellCheck SARIF
path: ${{ steps.ShellCheck.outputs.sarif }}

build:
strategy:
matrix:
go:
- oldstable
- stable
- tip
runs-on: ubuntu-22.04
steps:
- name: Install Dependencies
run: |
sudo add-apt-repository ppa:cowsql/stable -y --no-update
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
autoconf \
automake \
libcowsql-dev \
libacl1-dev \
libcap-dev \
liblxc1 \
liblz4-dev \
libsqlite3-dev \
libudev-dev \
libuv1-dev \
lxc-dev \
make \
pkg-config
- name: Checkout
uses: actions/checkout@v4

- name: Install Go (${{ matrix.go }})
if: matrix.go != 'tip'
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Install Go (tip)
if: matrix.go == 'tip'
run: |
go install golang.org/dl/gotip@latest
gotip download
~/sdk/gotip/bin/go version
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV
- name: Save Go env
id: go-env
run: go env >> $GITHUB_OUTPUT

- name: Check compatible min Go version
run: |
go mod tidy
- name: Download go dependencies
run: |
go mod download
- name: Run Incus build
run: |
make
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: incus
path: |
./
${{ steps.go-env.GOPATH }}/
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ jobs:

- name: Create build directory
run: |
mkdir bin
mkdir bin
- name: Build static x86_64 incus
env:
Expand Down

0 comments on commit 271c949

Please sign in to comment.