-
Notifications
You must be signed in to change notification settings - Fork 249
[cicd] Unify lint, add caching #1549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
1c3a5b1
44c631a
e68691d
bb51199
dd0bf27
d75588f
2cfc1bf
c367219
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,32 @@ env: | |
DEVBOX_DEBUG: 1 | ||
|
||
jobs: | ||
build-devbox: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: ./go.mod | ||
- name: Mount golang cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg | ||
key: go-devbox-build-${{ runner.os }}-${{ hashFiles('go.sum') }} | ||
- name: Build devbox | ||
run: go build -o dist/devbox ./cmd/devbox | ||
- name: Upload devbox artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: devbox-${{ runner.os }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we throw in |
||
path: ./dist/devbox | ||
retention-days: 7 | ||
|
||
typos: | ||
name: Spell Check with Typos | ||
if: github.ref != 'refs/heads/main' | ||
|
@@ -85,15 +111,10 @@ jobs: | |
key: go-${{ runner.os }}-${{ hashFiles('go.sum') }} | ||
|
||
# Use main devbox for now to ensure it supports runx | ||
- run: go run ./cmd/devbox run fmt | ||
|
||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
with: | ||
args: "--out-${NO_FUTURE}format colored-line-number --timeout=10m" | ||
skip-cache: true | ||
- run: go run ./cmd/devbox run lint | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the built artifact here too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed this, but I think longer term we can use the released devbox instead for speed since this is one of the first tests we want to see complete. |
||
|
||
test: | ||
needs: build-devbox | ||
strategy: | ||
matrix: | ||
is-main: | ||
|
@@ -133,8 +154,13 @@ jobs: | |
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: ./go.mod | ||
- name: Build devbox | ||
run: go install ./cmd/devbox | ||
- name: Mount golang cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg | ||
key: go-devbox-tests-${{ runner.os }}-${{ hashFiles('go.sum') }} | ||
- name: Install additional shells (dash, zsh) | ||
run: | | ||
if [ "$RUNNER_OS" == "Linux" ]; then | ||
|
@@ -171,17 +197,18 @@ jobs: | |
go test -v -timeout $DEVBOX_GOLANG_TEST_TIMEOUT ./... | ||
|
||
auto-nix-install: # ensure Devbox installs nix and works properly after installation. | ||
needs: build-devbox | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
- name: Download devbox | ||
uses: actions/download-artifact@v3 | ||
with: | ||
go-version-file: ./go.mod | ||
- name: Build devbox | ||
run: go install ./cmd/devbox | ||
name: devbox-${{ runner.os }} | ||
- run: chmod +x ./devbox | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it also needs to be added to the PATH. |
||
- name: Install nix and devbox packages | ||
run: | | ||
export NIX_INSTALLER_NO_CHANNEL_ADD=1 | ||
|
@@ -198,18 +225,19 @@ jobs: | |
# Run a sanity test to make sure Devbox can install and remove packages with | ||
# the last 3 Nix releases. | ||
test-nix-versions: | ||
needs: build-devbox | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
nix-version: [2.15.1, 2.16.1, 2.17.0, 2.18.0] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
- name: Download devbox | ||
uses: actions/download-artifact@v3 | ||
with: | ||
go-version-file: ./go.mod | ||
- name: Build devbox | ||
run: go install ./cmd/devbox | ||
name: devbox-${{ runner.os }} | ||
- run: chmod +x ./devbox | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v4 | ||
with: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be faster to build all platforms on a single machine and set GOOS/GOARCH?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a bit slower no? In this case they can run in parallel?