-
Notifications
You must be signed in to change notification settings - Fork 109
Switch to GitHub Actions 🚀 #338
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
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
2b4dc91
First attempt at using GitHub actions
niik 8dab294
Skip 32bit linux
niik 43f6a3f
Use env var from actions
niik ca36af5
wip
niik 30aceb5
typo
niik 46b03e7
Finish that thought I had about using jq
niik ba7f919
Remove appveyor and travis build configs
niik ac79eb7
Forgot this
niik c067745
Also trigger on actions branch
dennisameling f95d0be
Does this trigger CI?
dennisameling 1db9420
Does it trigger now?
dennisameling 0b01b96
Fix CS + try to fix shellcheck
dennisameling 7217ae5
Fix LFS checksum on Linux
dennisameling cc02d37
Show OS arch in GH Actions log
dennisameling 9718ec5
Try to get things working on Ubuntu, improve errors
dennisameling e1442c8
Fix Ubuntu + Windows builds (hopefully)
dennisameling 316d3a8
Fix Ubuntu build
dennisameling feba6ec
Fix bugs in ubuntu + Windows build scripts
dennisameling 50a99b1
Fix several bugs
dennisameling 4e488fc
Add TARGET_ARCH to Windows CI
dennisameling 0f7c678
Add release job
dennisameling 6dbeba9
Fix prettier
dennisameling 44689b5
Create release script
dennisameling 1ac8e69
Fix prettier
dennisameling 1886908
Apply suggestions from code review
dennisameling ca798ed
Try bumping OS versions
dennisameling 3b81c25
Rework release notes script 🚀
dennisameling bf616be
Fix prettier ✨
dennisameling 5125f16
Fix tag recognition + artifacts dir
dennisameling 86dcf32
Fix tag name recognition
dennisameling 6551b7a
Change owner to desktop
dennisameling File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- v* | ||
pull_request: | ||
|
||
jobs: | ||
shellcheck: | ||
name: Shellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run ShellCheck | ||
run: | | ||
sudo apt-get install shellcheck | ||
shopt -s globstar; shellcheck script/**/*.sh | ||
|
||
build: | ||
name: ${{ matrix.friendlyName }} ${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-11.0, windows-2019, ubuntu-20.04] | ||
arch: [32, 64] | ||
include: | ||
- os: macos-11.0 | ||
friendlyName: macOS | ||
targetPlatform: macOS | ||
- os: windows-2019 | ||
friendlyName: Windows | ||
targetPlatform: win32 | ||
- os: ubuntu-20.04 | ||
friendlyName: Linux | ||
targetPlatform: ubuntu | ||
exclude: | ||
- os: macos-11.0 | ||
arch: 32 | ||
- os: ubuntu-20.04 | ||
arch: 32 | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
# Needed for script/package.sh to work | ||
fetch-depth: 0 | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Check formatting | ||
run: npm run prettier | ||
- name: Build tools | ||
run: npm run check | ||
- name: Install extra dependencies for building Git on Ubuntu | ||
if: matrix.targetPlatform == 'ubuntu' | ||
run: sudo apt-get install libcurl4-openssl-dev libexpat1-dev gettext | ||
- name: Build | ||
shell: bash | ||
run: script/build.sh | ||
env: | ||
TARGET_PLATFORM: ${{ matrix.targetPlatform }} | ||
TARGET_ARCH: ${{ matrix.arch }} | ||
- name: Package | ||
shell: bash | ||
run: script/package.sh | ||
env: | ||
TARGET_PLATFORM: ${{ matrix.targetPlatform }} | ||
TARGET_ARCH: ${{ matrix.arch }} | ||
- name: Upload output artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: | ||
dugite-native-${{ matrix.targetPlatform }}-${{ matrix.arch }}-output | ||
path: ./output | ||
retention-days: 5 | ||
|
||
release: | ||
name: Create GitHub release | ||
needs: [build, shellcheck] | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Download all artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: './artifacts' | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
working-directory: './artifacts' | ||
|
||
- name: Get tag name without prefix | ||
run: | | ||
DUGITE_TAG=${GITHUB_REF/refs\/tags\//} | ||
echo "DUGITE_TAG=${DUGITE_TAG}" >> $GITHUB_ENV | ||
tagNameWithoutPrefix="${DUGITE_TAG:1}" | ||
echo "DUGITE_TAG_WITHOUT_PREFIX=${tagNameWithoutPrefix}" >> $GITHUB_ENV | ||
|
||
- name: Generate release notes | ||
run: | | ||
npm ci | ||
node -r ts-node/register script/generate-release-notes.ts "${{ github.workspace }}/artifacts" "${{ env.DUGITE_TAG }}" "${{ secrets.GITHUB_TOKEN }}" | ||
RELEASE_NOTES_FILE=script/release_notes.txt | ||
if [[ ! -f "$RELEASE_NOTES_FILE" ]]; then | ||
echo "$RELEASE_NOTES_FILE does not exist. Something might have gone wrong while generating the release notes." | ||
exit 1 | ||
fi | ||
echo 'DUGITE_RELEASE_NOTES<<EOF' >> $GITHUB_ENV | ||
cat ${RELEASE_NOTES_FILE} >> $GITHUB_ENV | ||
echo 'EOF' >> $GITHUB_ENV | ||
|
||
- name: Create release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Git ${{ env.DUGITE_TAG_WITHOUT_PREFIX }} | ||
body: ${{ env.DUGITE_RELEASE_NOTES }} | ||
draft: true | ||
prerelease: false | ||
|
||
- name: Upload release assets | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
# Workaround since actions/upload-release-asset doesn't support wildcard paths | ||
script: | | ||
const script = require(`${process.env.GITHUB_WORKSPACE}/script/create-release.js`); | ||
const artifactsDir = `${process.env.GITHUB_WORKSPACE}/artifacts`; | ||
const releaseId = '${{ steps.create_release.outputs.id }}'; | ||
console.log(script({github, context, artifactsDir, releaseId})); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Created a release assets script by taking inspiration from actions/upload-release-asset#47 (comment) 🤓